Simba Code:
function radialCompassWalk(color, startRad, endRad, xOffset, yOffset, flagDist: Integer): Boolean;
var
TPA: TPointArray;
p: TPoint;
currentAngle, i, newStart, newEnd, x, y: Integer;
begin
Result := False;
currentAngle := Round(rs_GetCompassAngleDegrees);
if InRange(currentAngle, 0, 5) or InRange(currentAngle, 355, 360) then
begin
newStart := startRad;
newEnd := endRad;
end else
begin
newStart := startRad - currentAngle;
newEnd := endRad - currentAngle;
end;
if newStart < 0 then
newStart := newStart + 360;
if newEnd < 0 then
newEnd := newEnd + 360;
FindColors(TPA, color, MMX1, MMY1, MMX2, MMY2);
FilterPointsPie(TPA, newStart, newEnd, 10, 76, MMCX, MMCY);
if Length(TPA) > 0 then
begin
p := MiddleTPA(TPA);
p := RotatePoint(Point(p.x + xOffset, p.y + yOffset),
2 * PI - rs_GetCompassAngleRadians,
p.x, p.y);
i := Round(FixD(Degrees(ArcTan2(p.y - MMCY, p.x - MMCX)) + 90)) / 45;
case i of
0, 7, 8 : y := 1;
1, 2 : x := -1;
3, 4 : y := -1;
5, 6 : x := 1;
end;
i := 0;
while ( not rs_OnMinimap(p.x, p.y) ) and
( i < 45 ) do
begin
p.x := p.x + x;
p.y := p.y + y;
i := i + 1;
end;
Result := rs_OnMinimap(p.x, p.y);
if ( not Result ) then
Exit;
Mouse(p.x, p.y, 0, 0, True);
FFlag(flagDist);
end;
end;