SRL Archive - Reflection Development

WalkToTileEx


**BANNED The Man

2010-12-26 11:26:05

Will walk to the tile if it is a certain distance away.
Say for example you want to check if you are lost and if you are then walk back.

function WalkToTileEx(TheTile: TTile; Randomness, FlagD, MaxDistFrom: Integer): Boolean;
var
wTile: TPoint;
t: Integer;
begin
Result := False;
TheTile := RandomizeTile(TheTile, Randomness, Randomness);
wTile := TileToMM(TheTile);
if not rs_OnMiniMap(wTile.X, wTile.Y) then
Exit;
if not DistanceFrom(wTile > MaxDistFrom) then
Exit;
Mouse(wTile.x, wTile.y, 1, 1, true);
Wait(RandomRange(80, 100));
t := getsystemtime;
if (FlagD = 0)then
begin
R_Flag;
end else
R_FFlag(FlagD);
Result := (GetSystemTime - t) < 60000;
end;

-Boom

marpis

2010-12-26 12:33:34

From: Dynamite
Will walk to the tile if it is a certain distance away.
Say for example you want to check if you are lost and if you are then walk back.

function WalkToTileEx(TheTile: TTile; Randomness, FlagD, MaxDistFrom: Integer): Boolean;
var
wTile: TPoint;
t: Integer;
begin
Result := False;
TheTile := RandomizeTile(TheTile, Randomness, Randomness);
wTile := TileToMM(TheTile);
if not rs_OnMiniMap(wTile.X, wTile.Y) then
Exit;
if not DistanceFrom(wTile > MaxDistFrom) then
Exit;
Mouse(wTile.x, wTile.y, 1, 1, true);
Wait(RandomRange(80, 100));
t := getsystemtime;
if (FlagD = 0)then
begin
R_Flag;
end else
R_FFlag(FlagD);
Result := (GetSystemTime - t) < 60000;
end;

-Boom


Looks nice, but I'll point out a few things:
function WalkToTileEx(TheTile: TTile; Randomness, FlagD, MaxDistFrom: Integer): Boolean;
var
wTile: TPoint;
t: Integer;
begin
Result := False;
TheTile := RandomizeTile(TheTile, Randomness, Randomness);
wTile := TileToMM(TheTile);
if not rs_OnMiniMap(wTile.X, wTile.Y) then
Exit;
if DistanceFrom(TheTile) > MaxDistance then // should be like this
Exit;
Mouse(wTile.x, wTile.y, 1, 1, true);
Wait(RandomRange(80, 100));
if (FlagD = 0)then
begin
R_Flag;
end else
R_FFlag(FlagD);
Result := DistanceFrom(TheTile) <= 5; // this would be better than timing I think
end;

Nice to have new people writing functions for everyone to use :)

**BANNED The Man

2010-12-26 12:38:53

From: marpis
Looks nice, but I'll point out a few things:
function WalkToTileEx(TheTile: TTile; Randomness, FlagD, MaxDistFrom: Integer): Boolean;
var
wTile: TPoint;
t: Integer;
begin
Result := False;
TheTile := RandomizeTile(TheTile, Randomness, Randomness);
wTile := TileToMM(TheTile);
if not rs_OnMiniMap(wTile.X, wTile.Y) then
Exit;
if DistanceFrom(TheTile) > MaxDistance then // should be like this
Exit;
Mouse(wTile.x, wTile.y, 1, 1, true);
Wait(RandomRange(80, 100));
if (FlagD = 0)then
begin
R_Flag;
end else
R_FFlag(FlagD);
Result := DistanceFrom(TheTile) <= 5; // this would be better than timing I think
end;

Nice to have new people writing functions for everyone to use :)


Ok :)
And it is nice to help out :)

-Boom

mormonman

2010-12-26 12:49:02

function WalkToTileEx(TheTile: TTile; Randomness, FlagD, MaxDistFrom: Integer): Boolean;
var
wTile: TPoint;
t: Integer;
begin
Result := False;
TheTile := RandomizeTile(TheTile, Randomness, Randomness);
wTile := TileToMM(TheTile);
if not rs_OnMiniMap(wTile.X, wTile.Y) then
Exit;
if DistanceFrom(TheTile) > MaxDistance then // should be like this
Exit;
Mouse(wTile.x, wTile.y, 1, 1, true);
WaitToMove(450);//much better failsafe
if (FlagD = 0)then
begin
R_Flag;
end else
R_FFlag(FlagD);
Result := DistanceFrom(TheTile) <= 5; // this would be better than timing I think
end;

Just a tad better.

**BANNED The Man

2011-01-24 13:31:34

Bump? :)
I still use this and could be helpful :)

-Boom