Been trying to get this stable for a last 2 days, most likely i'm doing it all wrong. So i could use some help.
The idea is to walk a certain distance under a certain angle, compensating for the "drift" of the flag. In a way that if you start at the same point all the time you should end up in the same spot give or take a few pixels.
SCAR Code:
program New;
{.include srl/srl.scar}
var
fx, fy, Ax, Ay, Modx, Mody: Integer;
Procedure AWalk3(Degree, Radius : Integer); //from starblaster100 and Avaphi
begin
Ax := Round ( Radius * Sin (Degree * Pi / 180)) + 648;
Ay := Round (- Radius * Cos (Degree * Pi / 180)) + 83;
Mouse(Ax, Ay, 0 + Modx, 0 + Mody, True);
end;
function FDist: Integer;
begin
if (FindColor(fx, fy, 255, 559, 0, 735, 166)) then
Result := Distance(fx + 2, fy + 2, 648, 84);
end;
Procedure DistWalk(Degree, Distance, Modx, Mody: Integer);
Var
TotalDistance, TempModx, TempMody: Integer;
begin
Repeat
TotalDistance := Distance;
if(TotalDistance > 55)then
TotalDistance := 50 + Random(5);
AWalk3(Degree, TotalDistance);
Distance := Distance - FDist;
TempModx := TempModx + ((fx + 2) - Ax);
TempMody := TempModx + ((fy + 2) - Ay);
if(TempModx > (Modx))then
Modx := - Modx;
if(TempModx < (-(Modx)))then
Modx := + Modx;
if(TempMody > (Mody))then
Mody := - Mody;
if(TempMody < (-(Mody)))then
Mody := + Mody;
FFlag(0);
Wait(200 + Random(50));
until(TotalDistance <= 0);
end;
begin
SetupSRL;
ActivateClient;
Wait(1000);
MakeCompass('e');
Wait(200 +Random(50));
MakeCompass('n');
DistWalk(310, 670, 2, 2);
end.