Well if you want it to look more human like think of it like this,
MMouse can be replaced with Windmouse ;) That means you get a slight bit of x axis being thrown of (Which does happen, people do move their mouse up and a little left or right).
for the hold and release thats fine :)
(*
WindMouse
~~~~~~~~~
.. code-block:: pascal
procedure WindMouse(xs, ys, xe, ye, gravity, wind, minWait, maxWait, maxStep, targetArea: extended);
Moves the mouse along a spline defined by
.. note::
by Benland100
Example:
.. code-block:: pascal
*)
procedure WindMouse(xs, ys, xe, ye, gravity, wind, minWait, maxWait, maxStep, targetArea: extended);
var
veloX, veloY, windX, windY, veloMag, dist, randomDist, lastDist, step: extended;
lastX, lastY: integer;
sqrt2, sqrt3, sqrt5: extended;
begin
try
sqrt2:= sqrt(2);
sqrt3:= sqrt(3);
sqrt5:= sqrt(5);
while hypot(xs - xe, ys - ye) > 1 do
begin
dist:= hypot(xs - xe, ys - ye);
wind:= minE(wind, dist);
if dist >= targetArea then
begin
windX:= windX / sqrt3 + (random(round(wind) * 2 + 1) - wind) / sqrt5;
windY:= windY / sqrt3 + (random(round(wind) * 2 + 1) - wind) / sqrt5;
end else
begin
windX:= windX / sqrt2;
windY:= windY / sqrt2;
if (maxStep < 3) then
begin
maxStep:= random(3) + 3.0;
end else
begin
maxStep:= maxStep / sqrt5;
end;
end;
veloX:= veloX + windX;
veloY:= veloY + windY;
veloX:= veloX + gravity * (xe - xs) / dist;
veloY:= veloY + gravity * (ye - ys) / dist;
if hypot(veloX, veloY) > maxStep then
begin
randomDist:= maxStep / 2.0 + random(round(maxStep) div 2);
veloMag:= sqrt(veloX * veloX + veloY * veloY);
veloX:= (veloX / veloMag) * randomDist;
veloY:= (veloY / veloMag) * randomDist;
end;
lastX:= Round(xs);
lastY:= Round(ys);
xs:= xs + veloX;
ys:= ys + veloY;
if (lastX <> Round(xs)) or (lastY <> Round(ys)) then
MoveMouse(Round(xs), Round(ys));
step:= hypot(xs - lastX, ys - lastY);
wait(round((maxWait - minWait) * (step / maxStep) + minWait));
lastdist:= dist;
end;
if (Round(xe) <> Round(xs)) or (Round(ye) <> Round(ys)) then
MoveMouse(Round(xe), Round(ye));
except
end;
end;
Procedure DragUp;
var randomScroll: integer;
begin
randomScroll := RandomRange(100, 150);
* if(FindColorTolerance(x, y, 3911923, 230, 210, 232, 290, 20)) then
* begin
* * Holdmouse(x, y, mouse_left);
* * wait(random(150));
* * WindMouse();
* *// wait(random(150));
* * ReleaseMouse(x, y-randomScroll, mouse_left);
* end else
* begin
* * if(FindColorTolerance(x, y, 3911923, 229, 90, 231, 110, 20)) then
* * begin
* * * Holdmouse(x, y, mouse_left);
* * * wait(random(150));
* * * WindMouse();
* * // *wait(random(150));
* * * ReleaseMouse(x, y+randomScroll, mouse_left);
* * end;
* end;
end;
This looks human like + allows for slight pixel change :)