SRL Archive - SRL Suggestions

ColorMouse


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

Gu3st...

2011-10-28 12:36:20

I don't really like this kind of functions… We already have a lot of object finding methods and these stuff should really be up to the scripter in my opinion

Sir R. M8gic1an

2011-10-28 12:40:58

There really isn't much for the scripter to think about here.

You pretty much always need an uptext check. And this is in no way an object finding function.. This just somewhat reinforces the mouse function to avoid wrong clicks.

-RM

i luffs yeww

2011-10-28 14:19:41

At the very least I'd have the uptext check be changed to..


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);
if(text <> "")then //Added this, in case someone doesn't want an uptext check
Result := WaitUpText(text, 500);

if((not result) and (text <> ""))then exit; //If there was no text with the if then I added, it'd always exit here.

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;

noidea

2011-10-28 15:20:28

Ill be honest. I dont think these types of functions have a place in SRL. Its not something we need to load it up with when people can easily do it themselves.