Log in

View Full Version : Personal Walking Procedure Help.



laakerules
04-14-2012, 05:05 PM
procedure Walker(Path: TPointArray);
var
I, H, T, D: integer;
P, MM, A, B: TPoint;
begin
H := High(Path);
begin

P := SPS_GetMyPos;
for I := H downto 0 do
begin
A := Sps_GetMyPos;
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, 1, 1, mouse_Left);

FFlag(Integer(I <> H) * 15);
repeat
Wait(50);
until Not isMoving;

B := Sps_GetMyPos;
if (Distance(A.X, A.Y, B.X, B.Y) < 6) then Exit;
If InFight or BlueDead then Exit;

Break;
end;
end;


end;
end;

Wont move or do anything.

masterBB
04-14-2012, 05:15 PM
There are a few logical flaws in it.

P := SPS_GetMyPos;
for I := H downto 0 do
begin
A := Sps_GetMyPos;
MM.X := MMCX + Path[I].X - P.X;
MM.Y := MMCY + Path[I].Y - P.Y;

probably should be something like:


for I := H downto 0 do
begin
P := Sps_GetMyPos;
MM.X := MMCX + Path[I].X - P.X;
MM.Y := MMCY + Path[I].Y - P.Y;

Just use some debugging to get more information. Does it find your position? Are the required maps loaded? Maybe P is always 0,0 and that's why distance will always be > 70. I need more information.

edit:
I've never used SPS before, but shouldn't D be; D := Distance(parth[i].X, parth[i].Y, P.X, P.Y);

laakerules
04-14-2012, 08:19 PM
Nahhh it walks a path.