Gu3st...
2009-06-03 17:25:17
This procedure will move the mouse and miss the target and then move the mouse to the actual target, just like a humen would do.
The current mouse procedure is very accurate and do never miss the target.
EDIT2: Added Ceil-stuff to "Dist := ;" part and removed L and U : Boolean;
The current mouse procedure is very accurate and do never miss the target.
procedure MissMMouse(mousex, mousey, randx, randy : Integer);
var
Dist, MissX, MissY, CurX, CurY : Integer;
begin
GetMousePos(CurX, CurY);
Dist := Distance(CurX, CurY, MouseX, MouseY);
if Dist < 5 then
begin
MMouse(MouseX, MouseY, RandX, RandY);
Exit;
end;
Dist := (Ceil(Dist / 34) - Ceil(Dist / 100) + 3/2) / 2;
if Dist > 5 then Dist := 5;
if Dist < 1 then Dist := 1;
MissX := Round(MouseX + ((MouseX - CurX) / abs(MouseX - CurX)) * Random((20 * Dist)) + Random(RandX));
MissY := Round(MouseY + ((MouseY - CurY) / abs(MouseY - CurY)) * Random((20 * Dist)) + Random(RandY));
if MissX < 0 then MissX := 0;
if MissY < 0 then MissY := 0;
MMouse(MissX, MissY, 0, 0);
Wait(60+Random(50));
MMouse(MouseX, MouseY, RandX, RandY);
end;
procedure MissMouse(mousex, mousey, randx, randy : Integer; Left : Boolean);
var
x, y: Integer;
begin
MissMMouse(MouseX, MouseY, RandX, RandY);
GetMousePos(x, y);
Mouse(x, y, 0, 0, Left);
end;EDIT1: Oops, forgot to add "Dist := 1;"EDIT2: Added Ceil-stuff to "Dist := ;" part and removed L and U : Boolean;