Quickmarch
2009-05-21 18:56:08
This was a function created by Cazax quite a while back, but it didn't take x and y as params. I just edited it to add the radius and angle dynamically. Full credits to Cazax for the original.
What it does is click on the same x and y even if the compass is rotated.
//By me and Cazax.
procedure MouseMM(x, y, xmod, ymod: Integer);
var
D2, R, Ang, MX, MY: Integer;
begin
Ang := Round(Degrees(ArcTan2(y - MMCY, x - MMCX)) + 90);
while Ang < 0 do Ang := Ang + 360;
D2 := Ang - Round(rs_GetCompassAngleDegrees);
R := Distance(MMCX, MMCY, x, y);
MX := MMCX + Round(R * Cos(Radians(D2 - 90)));
MY := MMCY + Round(R * Sin(Radians(D2 - 90)));
if rs_OnMiniMap(MX, MY) then Mouse(MX, MY, xmod, ymod, True);
end;
//Version 2, mixster
procedure MouseMM(x, y, randX, randY: Integer);
var
p: TPoint;
begin
if not rs_OnMinimap(x, y) then
exit;
p := RotatePoint(Point(x, y), rs_GetCompassAngleRadians, MMCX, MMCY);
Mouse(p.x, p.y, randX, randY, True);
end;
What it does is click on the same x and y even if the compass is rotated.