SRL Archive - Help

Personal Walking Procedure Help.


laakerules

2012-04-14 13:05:11

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

2012-04-14 13:15:07

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.X, parth.Y, P.X, P.Y);

laakerules

2012-04-14 16:19:47

Nahhh it walks a path.