it should be something like this...
the script start..(you should stand on a safe spot like the one at lesser demon on karamja or something)
use getmypos to set the safespot
SCAR Code:
function GetSafeSpot:TPoint;
var
me: Integer;
begin
me := SmartGetFieldObject(0,MyPlayer);
Result.x := SmartGetFieldInt(0,BaseX) + SmartGetFieldInt(me, CurrentX) shr 7;
Result.y := SmartGetFieldInt(0,BaseY) + SmartGetFieldInt(me, CurrentY) shr 7;
SmartFreeObject(me);
end;
procedure CheckSafeSpot;//should check and walk to safespot if moved from it
var
safespot: tpoint;
begin
safespot := GetSafeSpot;
walktotile(safespot, 0, 0);
end;
begin
SmartSetup('world10', True, True, False);
SetTargetDC(SmartGetDC);
SetupSRL;
ActivateClient;
getsafespot; // sets the safe spot
repeat
checksafespot;
// the rest of the script
until false;
end.