SRL Archive - SRL Suggestions

MissMouse


Rich

2010-06-08 13:15:50

Nothing exciting. Will move near to X and Y, and if it isn't within X + randomness and Y + randomness, will slowly move to X + randomness and Y + randomness…

{*******************************************************************************
procedure MissMouse(X, Y, RandX, RandY, Action : Integer);
By: R1ch
Description: Moves the mouse near to X and Y like a human would, then if not
near enough (set by RandX and RandY) will move closer. Action:
1 = Left click
2 = Right click
Any other = Move only
*******************************************************************************}
procedure MissMouse(X, Y, RandX, RandY, Action : Integer);
var
Cx, Cy, Ms : Integer;

begin
Ms:= MouseSpeed;
Cx:= (X - (RandX * 2) + Random(RandX * 4));
Cy:= (Y - (RandY * 2) + Random(RandY * 4));
MMouse(Cx, Cy, 0, 0);
Wait(RandomRange(300, 500));
if (not InRange(Cx, (X - RandX), (X + RandX)) or
not InRange(Cy, (Y - RandY), (Y + RandY))) then
begin
MouseSpeed:= Ms - Random(6);
MMouse(X, Y, RandX, RandY);
end;
Wait(RandomRange(300, 800));
GetMousePos(Cx, Cy);
case Action of
1 : Mouse(Cx, Cy, 0, 0, True);
2 : Mouse(Cx, Cy, 0, 0, False);
end;
MouseSpeed:= Ms;
end;

I'm not expecting very good feedback for this, but thought I may as well post it.

weequ

2010-06-08 16:04:28

Cool :)

How about
Cx:= (X - RandX + Random(RandX*2+1));
Cy:= (Y - RandX + Random(RandX*2+1));

Becouse atm if your using higher than 60 random values it would not work unlike normal

Edit: Tried to make it a little shorter
procedure MissMouse(X, Y, RandX, RandY, Action : Integer);
var
Cx, Cy, Ms : Integer;

begin
Ms:= MouseSpeed;
Cx:= (X - 30 + Random(60));
Cy:= (Y - 30 + Random(60));
MMouse(Cx, Cy, 0, 0);
Wait(RandomRange(300, 500));
if (not InRange(Cx, (X - RandX), (X + RandX)) or
not InRange(Cy, (Y - RandY), (Y + RandY))) then
begin
MouseSpeed:= Ms - Random(6);
MMouse(X, Y, RandX, RandY);
end;
Wait(RandomRange(300, 800));
GetMousePos(Cx, Cy);
case Action of
1 : Mouse(Cx, Cy, 0, 0, True);
2 : Mouse(Cx, Cy, 0, 0, False);
end;
MouseSpeed:= Ms;
end;

Rich

2010-06-08 17:08:26

^Thanks. I'll change first post :)