Page 1 of 1

where the error?

Posted: 23.07.2014 19:56
by -k-
When i run this script, no recorded all in tiles_tree.txt, only "1000,", nothing more
code
Program WriteTXT;
var
x, y : integer;

procedure WriteToFile(filepath: string; coord: string);
var
file: TFileStream;
begin
try
file := TFileStream.Create(filepath,fmOpenReadWrite);
file.seek(0, soFromEnd);
except
file := TFileStream.Create(filepath,fmCreate);
end;
file.WriteBuffer(coord,Lenght(coord));
file.Free;
end;

Begin
X := 1000;
y := 9999;
WriteToFile('D:\progs\uo\txts\tree_tiles.txt', IntToStr(x)+ ',' +IntToStr(y)+ '-');
End.

Re: where the error?

Posted: 23.07.2014 20:12
by -k-
i found the error, but i dont understand. when i put "file.WriteBuffer(coord,Lenght(coord));", the script write only "1000,", but when i put "file.WriteBuffer(coord,Lenght(coord)*2);", the script write all in .txt

Re: where the error?

Posted: 23.07.2014 22:28
by drabadan
maybe try to initialize the string earlier;

Code: Select all


Begin
X := 1000;
y := 9999;
string1 := IntToStr(x) +',' + IntToStr(y) + '-';
WriteToFile('D:\progs\uo\txts\tree_tiles.txt', s);
End.
can ask you - why you need this, what is it for? Maybe there is another solution of your task?

Re: where the error?

Posted: 24.07.2014 0:56
by -k-
i use for mark respaw tree. =]]

Procedure Search(Tile, X, Y, Z: Integer);
Var
end : boolean;
Begin
if InJournal('elf') <> -1 then
begin
WriteToFile('D:\progs\uo\txts\elf.txt', IntToStr(Tile) +' ' +IntToStr(x) +' ' +IntToStr(y) +' ' +IntToStr(z) + #13#10);
end:=true;
clearjournal;
wait(100);
end;
end;


Search(TreesArray.Tile, TreesArray.X, TreesArray.Y, TreesArray.Z);

Re: where the error?

Posted: 24.07.2014 2:22
by Vizit0r
-k- wrote:i found the error, but i dont understand. when i put "file.WriteBuffer(coord,Lenght(coord));", the script write only "1000,", but when i put "file.WriteBuffer(coord,Lenght(coord)*2);", the script write all in .txt
just unicode, 1 char = 2 bytes. in old version 1 char = 1 byte.
thats mean your "WriteToFile" was outdated.
here - http://stealth.od.ua/forum/viewtopic.php?f=6&t=995 - its already changed and explained.

Re: where the error?

Posted: 24.07.2014 2:24
by Vizit0r
-k- wrote:i use for mark respaw tree. =]]

Procedure Search(Tile, X, Y, Z: Integer);
Var
end : boolean;
Begin
if InJournal('elf') <> -1 then
begin
WriteToFile('D:\progs\uo\txts\elf.txt', IntToStr(Tile) +' ' +IntToStr(x) +' ' +IntToStr(y) +' ' +IntToStr(z) + #13#10);
end:=true;
clearjournal;
wait(100);
end;
end;


Search(TreesArray.Tile, TreesArray.X, TreesArray.Y, TreesArray.Z);



oh shi.
use "clearjournal;" - bad way. really bad. injection\EUO-style.
use "injournalbetweentimes"

Re: where the error?

Posted: 24.07.2014 4:39
by -k-
hehe, thx man.
i gonna use betweentimes, thx so much

where the error

Posted: 06.10.2015 17:10
by kovalevserg
this is for andrexia the shard scripter. i have noticed that magic reflection items moonstone does not come up on the .myinfo prot list. only magic immunity.