SRL Archive - Help and Support

speed for mouse moving


lardmaster

2006-10-21 12:55:07

lets, say a wanted to make a script that moved the mouse in random circles and loops, like i do when im bored. i would like to know some stats about mouse movements such as

how often should i simulate a mouse leap?
how far on average should the leaps be?

here is my script so far, it runs, but it pretty buggy


program crazy circles;
var lastspeed:integer;

procedure movetowards(var lastx,lasty:integer; shouldx,shouldy:integer);
var distx,disty,tomove:integer;
begin
distx:=shouldx-lastx;
disty:=shouldy-lasty;
tomove:=lastspeed-1+random(3);
movemouse(round(tomove*distx/sqrt(sqr(distx)+sqr(disty)))+lastx,round(tomove*disty/sqrt(sqr(distx)+sqr(disty)))+lasty);
getmousepos(lastx, lasty);
lastspeed:=tomove;
end;

var i,radius,inc:extended;
pixelmilsec,lastx,lasty,shouldx,shouldy:integer;
begin
i:=1
lastspeed:=1+random(3);
while i<50 do begin
radius:=i*10-5+random(10);
pixelmilsec:=lastspeed-1+random(3);
inc:=pixelmilsec/radius;
i:=i+inc;
sleep(random(3));
shouldx:=round(334+radius*cos(i))-1+random(2);
shouldy:=round(148+radius*sin(i))-1+random(2);
if (random(6)=1) then begin
movemouse(shouldx, shouldy);
getmousepos(lastx,lasty);
end
else if (random(2)=1) then begin
movemouse(lastx-3+random(7),lasty-3+random(7));
getmousepos(lastx,lasty);
end
else
movetowards(lastx,lasty,shouldx, shouldy);
end
end.

Bam Bam

2006-10-22 07:49:04

Was a math error in line ten I fixed it

program crazycircles;
var lastspeed:integer;

procedure movetowards(var lastx,lasty:integer; shouldx,shouldy:integer);
var distx,disty,tomove:integer;
begin

distx:=shouldx-lastx;
disty:=shouldy-lasty;
tomove:=lastspeed-1+random(3);
movemouse(round(tomove*distx/sqrt(sqr(distx)+sqr(disty)))+lastx,round(tomove*disty/sqrt(sqr(distx)+sqr(disty)))+lasty);
getmousepos(lastx, lasty);
lastspeed:=tomove;
end;

var
i,radius,inc:extended;
pixelmilsec,lastx,lasty,shouldx,shouldy:integer;

begin
i:=1
lastspeed:=1+random(3);

while i<50 do begin
radius:=i*10-5+random(10);
pixelmilsec:=lastspeed-1+random(3);
inc:=pixelmilsec/radius;
i:=i+inc;
sleep(random(3));
shouldx:=round(334+radius*cos(i))-1+random(2);
shouldy:=round(148+radius*sin(i))-1+random(2);

if (random(6)=1) then begin
movemouse(shouldx, shouldy);
getmousepos(lastx,lasty);
end
else begin
if (random(2)=1) then begin
movemouse(lastx-3+random(7),lasty-3+random(7));
getmousepos(lastx,lasty);
end
else
movetowards(lastx,lasty,shouldx, shouldy);
end
end
end.

There you go still buggy but no more actual errors

lardmaster

2006-10-22 11:53:01

hm… yeah, i quit doing that script, i rewrote it, but thnks for helping me!

here is the link to the rewritten script! http://www.villu-reborn.com/showthread.php?t=3754