Replace all your MM/Mouses with a copy from SRL, but with writelning the values? It's probably object finding, TileToMS is weird. (I assume you're using Reflection, anyways)
Try something like this (I use this, works like a charm, no longer leaves the screen):
Simba Code:
function r_TileOnMSH(moix,moiy: integer) : Boolean; // Drags111
begin
Result := PointInBox(Point(moix,moiy), IntToBox(MSX1, MSY1, MSX2, MSY2));
end;
procedure objStuff;
var J: TPoint; tx,ty: integer;
begin
J := TileToMS(Tile(3048,3270), 300); // example - replace it with something like
if r_TileOnMSH(J.X,J.Y) then
begin
Mouse(J.X,J.Y,10,10,True);
writeln('etc');
end else
begin
WriteLn('run the object finding again / walkToTile (if static object) / etc');
wait(1);
end;
end;