Please excuse me if this feature has already been included
Is there a way to implement a walk timeout for SPS? So if the character is stuck, SPS_walkpath does not follow an infinite loop of trying to walk to the next flag
Please excuse me if this feature has already been included
Is there a way to implement a walk timeout for SPS? So if the character is stuck, SPS_walkpath does not follow an infinite loop of trying to walk to the next flag
You mean like marking the time before and repeating until the time is greater than a certain number?
i think its better to add a stuck detection in SPS_WalkPath.
so it return false stand for a stuck come.
use timeout to failsafe is not a good idea in my opinion.
Would be nice to see, Since something like a gate could close on you and the script would be clicking on the minimap for years :P
There is already a timeout built into SPS_WalkPath .. it has a 25 second timeout, I think when it goes back after clicking the minimap it should compare the position that it got to the old position and if it didnt change then exit.
Code:// Walks the path "Path"; always walks to the furthest point possible function SPS_WalkPath(Path: TPointArray): boolean; var I, H, T, D: integer; P, MM,tempP: TPoint; begin tempP := Point(-1,-1); H := High(Path); T := GetSystemTime + 20000 + Random(5000); while (not Result) and (GetSystemTime < T) do begin RunEnergy(20); P := SPS_GetMyPos; If tempP.X <> -1 then // check if player is stuck. if InRange(tempP.X, (P.X - 10), (P.X + 10)) then If InRange(tempP.Y, (P.Y - 10), (P.Y + 10)) then Begin Result := false; Exit; end; tempP := P; for I := H downto 0 do begin MM.X := MMCX + Path[I].X - P.X; MM.Y := MMCY + Path[I].Y - P.Y; D := Distance(MM.X, MM.Y, MMCX, MMCY); if (D < 10) then break else if (D < 70) then begin if (SPS_MultiMouse) then MultiMouse(MM.X, MM.Y, 25, 3, false) else Mouse(MM.X, MM.Y, 5, 5, mouse_Left); FFlag(Integer(I <> H) * 15); T := getSystemTime + 20000 + Random(1000); Break; end; end; Result := (I = H); end; end;
Last edited by shadowrecon; 04-20-2012 at 09:20 PM.
There are currently 1 users browsing this thread. (0 members and 1 guests)