Autor Beitrag
nabbl
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 51

Win XP Home
Delphi 7 PE
BeitragVerfasst: Sa 19.08.06 22:05 
Hi!
Ich habe ein Problem und zwar: Wenn ich diesen code ausführe:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
  mapslist := TStringlist.create;
  mapslist.loadfromfile('mapslist.txt');
    for l:=0 to mapslist.Count-1 do
    if mapslist.strings[l] <> '' then
      writeln(mapslist.strings[l]);
      begin
        if mapslist.strings[l] = RefreshMsg.MapName then
          nextmap := mapslist.Strings[l];
        if nextmap = '' then
          nextmap := mapslist.Strings[0];
      end;
,
dann erhalte ich den error: '... überschreitet Maximum (2) ...'. Nun ist es aber so, dass die mapslist.txt nur zwei Einträge enthält (also Zeile 0 und Zeile 1). Mapslist.count sollte also 2 ausgeben, wovon aber von sich aus gleich einer abgezogen wird.

Meine Frage: Wo steckt der Fehler?

MfG Nabbl.
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Sa 19.08.06 22:09 
Na gibt maplist.count den wirklich zwei aus?

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
jakobwenzel
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1889
Erhaltene Danke: 1

XP home, ubuntu
BDS 2006 Prof
BeitragVerfasst: Sa 19.08.06 22:09 
Du hast da irgendwas mit dem then vom if und dem begin durcheinandergebracht:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
  mapslist := TStringlist.create;
  mapslist.loadfromfile('mapslist.txt');
    for l:=0 to mapslist.Count-1 do
    if mapslist.strings[l] <> '' then
      writeln(mapslist.strings[l]);
      begin
        if mapslist.strings[l] = RefreshMsg.MapName then
          nextmap := mapslist.Strings[l];
        if nextmap = '' then
          nextmap := mapslist.Strings[0];
      end;

_________________
I thought what I'd do was, I'd pretend I was one of those deaf-mutes.
nabbl Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 51

Win XP Home
Delphi 7 PE
BeitragVerfasst: Sa 19.08.06 22:14 
user profile iconjakobwenzel hat folgendes geschrieben:
Du hast da irgendwas mit dem then vom if und dem begin durcheinandergebracht:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
  mapslist := TStringlist.create;
  mapslist.loadfromfile('mapslist.txt');
    for l:=0 to mapslist.Count-1 do
    if mapslist.strings[l] <> '' then
      writeln(mapslist.strings[l]);
      begin
        if mapslist.strings[l] = RefreshMsg.MapName then
          nextmap := mapslist.Strings[l];
        if nextmap = '' then
          nextmap := mapslist.Strings[0];
      end;


Wie peinlich :P

MfG Nabbl