Rich
2008-11-17 14:08:10
Basically, I was bored, and decided to make colour finding and mouse moving easier, and into one function.
Since these use/are modified versions of MMouse and Mouse, I must give credits to Benland100, Mutant Squirrel, and Hy for modifying them. The actual credits for these functions go to meh :p
MColour:
What this does is, if it finds the colour that was specified in the box that you set, it will move the mouse there, then check for the uptext. If the uptext and colour are both found, it returns true.
So instead of having to have
You could just have
MCColour:
What this does is the same as MColour, except that it clicks. I won't bother to write an example, but hopefully you can see how easier it is to use these.
If you want to use these, just place them in Mouse.scar, in the Core folder.
Thanks to everyone who helped me improve and pointed out little bugs!
Since these use/are modified versions of MMouse and Mouse, I must give credits to Benland100, Mutant Squirrel, and Hy for modifying them. The actual credits for these functions go to meh :p
MColour:
{*******************************************************************************
function MColour(colour, tol, x, y, randx, randy, x1, y1, x2, y2 : Integer; uptxt : string):Boolean;
By: R1ch4 (Richard)
Description: If the colour specified was found in the box, it moves the mouse there,
and checks for the uptext.
Used: Eg. MColour(123456, 50, x, y, 7, 7, 0, 0, 50, 50, 'uptxt');
*******************************************************************************}
function MColour(colour, tol, x, y, randx, randy, x1, y1, x2, y2 : Integer; uptxt : string):Boolean;
var
a : Integer;
begin
repeat
if FindColorSpiralTolerance(x, y, colour, x1, y1, x2, y2, tol) then
begin
MMouse(x, y, randx, randy);
Wait(150 + Random(150));
if IsUpText(uptxt) then
Break;
end else
a:= a + 1;
end else
a:= a + 1;
until(a > 5);
end;What this does is, if it finds the colour that was specified in the box that you set, it will move the mouse there, then check for the uptext. If the uptext and colour are both found, it returns true.
So instead of having to have
var a, x, y : Integer;
begin
repeat
if FindColorSpiralTolerance(123456, x, y, 0, 0, 50, 50, 50) then
begin
Wait(100 + Random(150))
MMouse(x, y);
if IsUpText('uptxt') then
Break;
else
a:= a + 1;
until(a > 5);
end;You could just have
MColour(123456, 50, x, y, 7, 7, 0, 0, 50, 50, 'uptxt'); Easier?MCColour:
{*******************************************************************************
function MCColour(colour, tol, x, y, randx, randy, x1, y1, x2, y2 : Integer; uptxt : string; left: Boolean):Boolean
By: R1ch4 (Richard)
Description: If the colour specified was found in the box, it moves the mouse to it,
checks for the uptext, then clicks.
Used: Eg. MCColour(123456, 50, x, y, 7, 7, 0, 0, 50, 50, 'uptxt', True);
*******************************************************************************}
function MCColour(colour, tol, x, y, randx, randy, x1, y1, x2, y2 : Integer; uptxt : string; left: Boolean);
var
a, b, c: Integer;
begin
repeat
if FindColorSpiralTolerance(x, y, colour, x1, y1, x2, y2, tol) then
begin
Mouse(x, y, randx, randy, left);
Wait(150 + Random)150));
if IsUpText(uptxt) then
Break;
else
a:= a + 1;
end else
a:= a + 1;
until(a > 5);
end;
What this does is the same as MColour, except that it clicks. I won't bother to write an example, but hopefully you can see how easier it is to use these.
If you want to use these, just place them in Mouse.scar, in the Core folder.
Thanks to everyone who helped me improve and pointed out little bugs!