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
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)/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));
end;
{*******************************************************************************
procedure MMouse(x, y, rx, ry: integer);
By: Benland100
Description: Moves the mouse.
*******************************************************************************}
//Randomness is just added to the x,y. Might want to change that.
procedure MMouse(x, y, rx, ry: integer);
var
cx, cy: integer;
randSpeed: extended;
begin
randSpeed:= (random(MouseSpeed)/2.0 + MouseSpeed)/10.0;
if randSpeed = 0.0 then
randSpeed := 0.1;
getMousePos(cx,cy);
X := x + random(rx);
Y := y + random(ry);
WindMouse(cx,cy,x,y,9.0,3.0,10.0/randSpeed,15.0/randSpeed,10.0*randSpeed,10.0*randSpeed);
end;
Dưới đây là một số phương pháp viết bằng SCAR. Chuyển đổi chúng C# không nên quá khó, đây là khá thực tế.
Bạn di chuyển chuột từ điểm A đến điểm B trong cung tròn? Tôi dường như đi theo một đường thẳng. Điều đó sẽ làm cho cuộc sống của bạn dễ dàng hơn nhiều. :) –
Vì vậy, câu hỏi là gì? Xây dựng trên ý tưởng của bạn? – JerSchneid
JP: trừ khi bạn làm việc với một người cai trị là tất cả những con đường mòn chuột của bạn thực sự đường thẳng? :) Tôi chỉ đang nghĩ đến các cách để di chuyển chuột theo những cách thực tế bằng cách sử dụng mã. Tôi đã googled, tìm kiếm một cơ sở mã nhưng nó là cái gì đó không thực sự được thực hiện. – flavour404