Originally Posted by
slacky
A trick I at times use is to throw a small loop around the walking like so:
Simba Code:
function TRSWalker.WalkPath2(Path: TPointArray; Tries:Int32=3): Boolean;
begin
for 1 to Tries do
if Self.WalkPath(Path) then
Exit(True)
else
Wait(600,900);
end;
Now it can be used like:
Simba Code:
if not Walk.WalkPath2(pBank) then
TerminateScript('[pBank] Failed to walk path');
because, it does happen that walking just fails on a rare occation, but it's able to recover if you just wait a little and retry.
Edit: I can probably add this directly to RSWalker
I wrote this function:
Simba Code:
function playerInArea(area : TPointArray): Boolean;
var
myPos: TPoint;
areaBox: TBox;
begin
myPos := Walk.GetMyPos();
areaBox := [area[0].X, area[0].Y, area[1].X, area[1].Y];
if (myPos.InBox(areaBox)) then
begin
writeln('Player is in area!');
Result := True;
end else
Result := False;
end;
which can be simplified to:
Simba Code:
function playerInArea(area : TPointArray): Boolean;
var
myPos: TPoint;
areaBox: TBox;
begin
myPos := Walk.GetMyPos();
areaBox := [area[0].X, area[0].Y, area[1].X, area[1].Y];
Result := myPos.InBox(areaBox);
end;
Not the cleanest function (the first one is used for debugging purposes), but you pass it a TPointArray of two coordinates and it will check if it is inside the area. It uses your InBox function, but I just wanted to be able to pass TPAs since I dont need to do any conversions when using the path generators.
I normally use this and a TTimeMarker so that I don't get caught in an infinite loop.
Originally Posted by
Nixes
I tried running the script once more and it ran for over 45 minutes. I then ran out of flax to spin. So it seemed to be working flawlessly this time around.
Cool! Good to hear!