SRL Archive - Reflection Development

PickUpPath & NextTileIndex


Sir R. M8gic1an

2009-05-16 15:08:28


Function NextTileIndex(Path: TPointArray): Integer;
var
TP: TPoint;
i : integer;
begin
TP := NearestTile(Path, 0);
for i:= 0 to High(Path) do
if (TP.x = Path[i].x)and(TP.y = Path[i].y) then break;

if i > High(Path) then
begin
Result := 0;
exit;
end;

Result := i;

end;

Function PickUpPath(Path: TPointArray; FlagD: integer): boolean;
var i: integer;
begin
Result := True;
for i:= NextTileIndex(Path) to High(Path) do
begin
if TileOnMM(Path[i]) then
if not WalkToTile(Path[i], 1, 0) then
Result := false
else begin
FFlag(FlagD);
wait(200+Random(500))
end
else Result := false;

if not Result then exit;
end;

end;


very simple, NextTileIndex will return the number of the array of the walk path which is closest to you.

PickUpPath will use NextTileIndex for you to be able to start from anywhere close to the path. This is very good for when you log out, or something like that.

~RM

Floor66

2009-05-16 15:10:01

Sweet ;)
I'm seeing you're getting in reflection more and more :p

Sir R. M8gic1an

2009-05-16 15:28:34

i just realized that pick up path i useless, cus any loop with if not TileOnMM then continue will do the job :p

but i guess the first one can still have some use ;)

floor66: walking with colors is a pain in the ass :p i can do it, but takes so long to get it perfect that it stops me from releasing scripts as fast. :)

~RM

Floor66

2009-05-16 15:40:37

Reflection walking = longer runs ;)
Colour walking takes more skill

senrath

2009-05-16 16:27:36

I've been using something similar in my script. Here's how I did it:
function PathLocation(Path : TPointArray): Integer;
var
I, highPath: Integer;
begin
if not R_LoggedIn then Exit;
Result := -1;
highPath := High(Path);
for I := 0 to highPath do
begin
if DistanceFrom(Path[I]) < 15 then Result := I
else if Result <> -1 then Exit;
end;
end;

BobboHobbo

2009-05-16 17:38:52

From: Floor66
Reflection walking = longer runs ;)
Colour walking takes more skill


Colour walking makes it challenging and more anoying to make :).

Capricorn

2009-05-16 18:47:41

WalkToTile(NextTile(Path, 22), 2, 8);

works pretty good for me.

lordsaturn

2009-05-16 22:51:42

Changed it a bit..
function NextTileIndex(Path: TPointArray): Integer;
var
TP: TPoint;
i : integer;
begin
Result := -1;
TP := NearestTile(Path, 0);
Hi := High(Path);
for i:= 0 to Hi do
if (TP.x = Path[i].x)and(TP.y = Path[i].y) then
begin
Result := i;
Break;
end;
end;