Originally Posted by
Officer Barbrady
Thanks, I looked at the reflection TileToMM and I think this should work (assuming every 4 pixels on the minimap = 1 tile.. this may have to be ajusted, also is MMCX and MMCY is the direct center of the minimap AKA were the player square is located right?)
99.99% Benlands. (I named the function therfor get .001% credit tee hee)
Simba Code:
function GLX_TileToMM(Tile:TPoint):TPoint;
var
Location:TPoint;
angle, tileX, tileY:Extended;
begin
angle := GL_CompassRad;
Location := GetLocalPos;
tileX := ((Tile.x - Location.x) * 4);
tileY := ((Location.y - Tile.y) * 4);
result.x := round(tileX *cos(angle) + tileY*sin(angle)) + MMCX;
result.y := round(tileY*cos(angle) - tileX*sin(angle)) + MMCY;
end;
then ofc walking would be easy
Simba Code:
function walkTile(Point:TPoint):boolean
var
pnt:TPoint;
begin
pnt := GLX_TileToMM(Point);
Mouse(pnt.x, pnt.y, 2, 2);
wait(random(200) + 250);
result := FlagPresent;
while (FlagPresent) do
wait(random(50) + 25);
end;
Uhh that will never work. Well I tested it and the point is not even close the to MM.. It's far off. Isn't that algorithm for OSRS?
My math skills isn't all that great anymore but I managed to come up with:
Simba Code:
Function MSToMM(P: TPoint): TPoint;
var
MMBounds: TBox;
X1, Y1, X2, Y2: Integer;
TL, BL, BR, TR: FloatPoint;
W, H, DX, DY, RatioX, RatioY, Angle: Extended;
begin
MMBounds := GL_MMBounds;
GLXViewPort(X1, Y1, X2, Y2); //Should really use player location but this works well enough.
W := X2 - X1; H := Y2 - Y1;
RatioX := W / MMBounds.Width;
RatioY := H / MMBounds.Height;
DX := (P.X - (W / 2));
DY := (P.Y - (H / 2));
DX := DX / RatioX;
DY := DY / RatioY;
P.X := MMBounds.MidPoint.X;
P.Y := MMBounds.MidPoint.Y;
GL_GetMapCoords(TL, BL, BR, TR);
Angle := FixRad(ArcTan2(TR.Y - TL.Y, TR.X - TL.X));
Result.X := Round(P.X + DX);
Result.Y := Round(P.Y + DY);
Result := RotatePoint(Result, Angle, P.X, P.Y);
//Result.X := Result.X + (MMBounds.Width div 256); //Needed if the minimap is HUGE.
//Result.Y := Result.Y - (MMBounds.Height div 64); //Needed if the minimap is HUGE.
end;
which works pretty well.