SCAR Code:
function PerfectCompass(Direction: string): Boolean;
{*******************************************************************
function PerfectCompass(Direction: string): Boolean;
By: SRL and jukka
Description: Perfect compass using SMART and reflection
********************************************************************}
var
StartAngle, Angle, DirectionDeg, i: Extended;
Left: Boolean;
Mark: Integer;
begin
Result := False;
StartAngle := (GetMinimapAngleDeg);
if (StartAngle < 0) or (not LoggedIn) then Exit;
try
DirectionDeg := FixD(StrToFloat(Direction));
except
case LowerCase(Direction) of
'n': DirectionDeg := 0;
'w': DirectionDeg := 90;
's': DirectionDeg := 180;
'e': DirectionDeg := 270;
end;
end;
if (MinE(Abs(StartAngle - DirectionDeg), MinE(Abs(StartAngle - (DirectionDeg + 360)), Abs((StartAngle + 360) - DirectionDeg)))) <= 8.0 then
begin
Result := True;
Exit;
end;
Left := (Round((360 - StartAngle) + DirectionDeg) mod 360 > Round((StartAngle + 360) - DirectionDeg) mod 360);
if Left then
KeyDown(VK_LEFT)
else
KeyDown(VK_RIGHT);
Wait(10);
MarkTime(Mark);
repeat
Wait(1);
Angle:= GetMinimapAngleDeg;
if ((TimeFromMark(Mark) > 6000) and (i < 1.0)) or
((TimeFromMark(Mark) > 10000) and (i < 2.0)) or
((TimeFromMark(Mark) > 14000) and (i < 3.0)) then
begin
i := i + 1.0;
end;
until ((MinE(Abs(Angle - DirectionDeg), MinE(Abs(Angle - (DirectionDeg + 360)), Abs((Angle + 360) - DirectionDeg)))) <= (7.0 + i))
or (TimeFromMark(Mark) > 14000)
or (Angle < 0);
if Left then
KeyUp(VK_Left)
else
KeyUp(VK_Right);
Wait(10);
Result := ((MinE(Abs(Angle - DirectionDeg), MinE(Abs(Angle - (DirectionDeg + 360)), Abs((Angle + 360) - DirectionDeg)))) <= (7.0 + i));
end;
this one is better