Sir R. M8gic1an
2011-10-28 12:22:17
function ColorMouse(x, y, color, tol: integer; text: string): boolean;
begin
Result := FindColorTolerance(x, y, x-3, y-3, x+3, y+3, color, tol);
if not Result then exit;
MMouse(x, y, 3, 3);
Result := WaitUpText(text, 500);
if not Result then exit;
if FindColorTolerance(x, y, x-3, y-3, x+3, y+3, color, tol) then
begin
GetMousePos(x, y); // maybe leave this out?
Mouse(x, y, 0, 0, LEFT_CLICK);
Result := DidClick(500);
end;
end;
Just a little something… The double colour checking avoids misclicking moving targets or e.g. rocks that have just got out of ore (very common for iron).
I realise many of these functions have already been propped forward and turned down several times but oh well.. I intend to use this and thought I might post it in case we have a change of heart. It does cut through much repetitiveness in object clicking.
-RM