Forum in READ ONLY mode! All questions and discussions on Discord official server, invite link: https://discord.gg/VxsGzJ7

read txt error

Ask for help
Post Reply
k-k
Posts: 2
Joined: 10.02.2016 1:23

read txt error

Post by k-k »

my tile.txt has that line, ex:

218,118-218,118-218,118-218,118-218,117-218,117

my code:

Code: Select all

Program TreeAnalyzer;
Var
    tiles : string;

procedure GetTiles;
var
   List : TStringList;
   i : integer;
begin
   List := TStringList.Create;
   List.LoadFromFile('D:\tiles.txt');
   for i := 0 to List.Count-1 do begin
      tiles := tiles + List.strings[i];
   end;           
end;   

Begin
    tiles := '';
    GetTiles;
    Addtosystemjournal(tiles);
End.   
script return this:
2

i need that script return all line in tile.txt. Where is error in code?

tnks =]
User avatar
Vizit0r
Developer
Developer
Posts: 3958
Joined: 24.03.2005 17:05
Contact:

Re: read txt error

Post by Vizit0r »

Code: Select all

15:10:49:781 [Inceptum - test]: Compiling
15:10:49:908 [Inceptum - test]: Compiled succesfully
15:10:49:912 [Inceptum - test]: 218,118-218,118-218,118-218,118-218,117-218,117
15:10:49:915 [Inceptum - test]: Succesfully executed
15:10:49:918 [Inceptum - test]: Script test_shrink.sc stopped successfuly
created file D:\tiles.txt with your line

your script.

so?
"Пишите код так, как будто сопровождать его будет склонный к насилию психопат, который знает, где вы живете". (с) Макконнелл, "Совершенный код".
k-k
Posts: 2
Joined: 10.02.2016 1:23

Re: read txt error

Post by k-k »

Code: Select all

15:52:54:003 [Char Name]: Compiling
15:52:54:017 [Char Name]: Compiled succesfully
15:52:54:017 [Char Name]: 2
15:52:54:018 [Char Name]: Succesfully executed
15:52:54:019 [Char Name]: Script teste3.sc stopped successfuly
i dont understand, waht i do wrong?

edit1: when I create the tile.txt , the script works normal, but when the tile.txt is created by stealth , the script does not work right

edit2: i find the problem, srry for the post =]]]
User avatar
Vizit0r
Developer
Developer
Posts: 3958
Joined: 24.03.2005 17:05
Contact:

Re: read txt error

Post by Vizit0r »

np)
"Пишите код так, как будто сопровождать его будет склонный к насилию психопат, который знает, где вы живете". (с) Макконнелл, "Совершенный код".
Macks
Apprentice
Apprentice
Posts: 250
Joined: 27.02.2006 22:23
Location: АоП - Age Of Power

Re: read txt error

Post by Macks »

k-k wrote:...
row

Code: Select all

tiles := tiles + List.strings[i];
change to

Code: Select all

tiles := tiles + List[i];
Post Reply