SRL Archive - Test corner

BezierMouse


nielsie95

2007-06-18 09:12:35

Hey,

some of you may have noticed this thread.. In that thread I posted the Bezier Curve function.
With that function I made (another) mouse function; BezierMouse..

Features
  • Randomness at the endpoint.
  • Randomness in the spline.
  • It will slowdown when it's reaching the end.
  • It will speed up when it's starting.
  • All of the above points are fully customize-able.


Images


The first image displays (top-bottom) BenMouse - RsNMouse - BezierMouse (0 randomness).
You can see that BezierMouse with 0 randomness is the same as RsNMouse.




The second image displays (top-bottom) BenMouse - RsNMouse - BezierMouse (25 randomness).
You can see that BezierMouse with 25 randomness (just like BenMouse) creates a random path..



Please test the code beneath in paint and tell me what you think.


program BezierMouse;
{.Include SRL/SRL.SCAR}

const Speed = 13;
Randomness = 25;
SlowDown = 12;

function GetMidPoints(Ar: TPointArray; Points: Integer): TPointArray;
var
i: integer;
TempX, TempY: Extended;
begin
SetArrayLength(Result, Points);
TempX := Ar[1].x - Ar[0].x;
TempY := Ar[1].y - Ar[0].y;

TempX := TempX div Points;
TempY := TempY div Points;

for i := 0 to Points -1 do
if i > 0 then Result[i] := Point(Round(TempX * (i + 1)) + Ar[0].x, Round(TempY * (i + 1)) + Ar[0].y) else
Result[i] := Point(Round(TempX * (i)) + Ar[0].x, Round(TempY * (i)) + Ar[0].y)
end;

function CreateSplinePoints(sp, ep: TPoint): TPointArray;
var
i: Integer;
TempArray: TPointArray;
RanX, RanY: Extended;
begin
SetArrayLength(Result, 4);
TempArray := [sp, ep];
TempArray := GetMidPoints(TempArray, 4);
Result[0] := sp;
Result[3] := ep;

for i := 1 to 2 do
begin
case Random(3) of
0: RanX := ((Randomness + Random(Randomness * 2)) * (Rand * 2));
1: RanX := ((Randomness * Rand) + Random(Round(Randomness * 1.25))) * (Rand * 2);
2: RanX := ((Randomness + Random(Randomness)) * (Rand));
end;
if Random(2) = 0 then RanX := -(RanX);
case Random(3) of
0: RanY := ((Randomness + Random(Round(Randomness * 2))) * (Rand * 2));
1: RanY := ((Randomness * Rand) + Random(Round(Randomness * 1.25))) * (Rand * 2);
2: RanY := ((Randomness + Random(Randomness)) * (Rand));
end;
if Random(2) = 1 then RanY := -(RanY);
Result[i] := Point(Round(TempArray[i].x + RanX), Round(TempArray[i].y + RanY));
end;
end;

function PointOnCubicBezier(cp: TPointArray; t, Curve: Extended): TPoint;
var
ax, ay, bx, by, cx, cy,
tSquared, tCubed: Extended;
i: integer;
begin
cx := Curve * (cp[1].x - cp[0].x);
bx := Curve * (cp[2].x - cp[1].x) - cx;
ax := cp[3].x - cp[0].x - cx - bx;

cy := Curve * (cp[1].y - cp[0].y);
by := Curve * (cp[2].y - cp[1].y) - cy;
ay := cp[3].y - cp[0].y - cy - by;

tSquared := t * t;
tCubed := tSquared * t;

result.x := Round((ax * tCubed) + (bx * tSquared) + (cx * t) + cp[0].x);
result.y := Round((ay * tCubed) + (by * tSquared) + (cy * t) + cp[0].y);
end;

function BezierSpline(cp: TPointArray; NumberOfPoints: Integer; Curve: Extended): TpointArray;
var
dt: Extended;
i: Integer;
begin
dt := 1.0 / (NumberOfPoints - 1);
SetArrayLength(Result, 0);

for i := 0 to NumberOfPoints do
begin
SetArrayLength(Result, Length(Result) +1);
Result[i] := PointOnCubicBezier(cp, i * dt, Curve);
end;
end;

procedure BezierMouse(cx, cy, rx, ry: Integer);
var
PointArray, ResultArray: TPointArray;
i, tx, ty, SlowDownWait, Dist: Integer;
begin
GetMousePos(tx, ty);
try
Dist := Distance(tx, ty, cx, cy);
if Dist <= Round((rx + ry) / 2) then Exit;
except Exit; end;
if Random(2) = 0 then PointArray := CreateSplinePoints(Point(tx, ty), Point(cx + Random(rx), cy + Random(ry))) else
PointArray := CreateSplinePoints(Point(tx, ty), Point(cx - Random(rx), cy - Random(ry)))
ResultArray := BezierSpline(PointArray, Round(Distance(tx, ty, cx, cy) / Abs(12 - (MouseSpeed mod 3))), 3.0);

for i := 0 to Length(ResultArray) -1 do
begin
MoveMouse(ResultArray[i].x, ResultArray[i].y);
SlowDownWait := Round((i div (Length(ResultArray) -1)) * 100);
if SlowDownWait <= (SlowDown / 2) then Wait(Ceil(MouseSpeed + iAbs(((SlowDown / 2) +1) - SlowDownWait) * (MouseSpeed div 5))) else
if SlowDownWait >= (100 - SlowDown) then Wait(Ceil(MouseSpeed + iAbs((101 - SlowDown) - SlowDownWait) * (MouseSpeed div 5))) else
if (MouseSpeed < 3) and (Random(2) = 0) then Wait(0) else Wait(Ceil(MouseSpeed + Random(MouseSpeed div 5)));
if Distance(cx, cy, ResultArray[i].x, ResultArray[i].y) <= Round((rx + ry) / 2) then Break;
end;
end;

var i, tx, ty: integer;
begin
SetupSRL;
MouseSpeed := Speed;

for i := 0 to 2 do
begin
case i of
0 : WriteLn('MMouse - BenMouse: True - Straight line');
1 : WriteLn('MMouse - BenMouse: False - Straight line');
2 : WriteLn('BezierMouse - Randomness: '+IntToStr(Randomness)+' - Straight line');
end
if i = 1 then BenMouse := False;
tx := 30;
ty := 50 + (150 * i);
MoveMouse(tx, ty);
HoldMouse(tx, ty, True);
case i of
0, 1: MMouse(tx + 700, ty, 0, 0);
2: BezierMouse(tx + 700, ty, 0, 0);
end;
GetMousePos(x, y);
ReleaseMouse(x, y, True);
MoveMouse(tx, ty);
HoldMouse(tx, ty, True);
ty := 100 + (150 * i);
case i of
0 : WriteLn('MMouse - BenMouse: True - Diagonal line');
1 : WriteLn('MMouse - BenMouse: False - Diagonal line');
2 : WriteLn('BezierMouse - Randomness: '+IntToStr(Randomness)+' - Diagonal line');
end
case i of
0, 1: MMouse(tx + 700, ty, 0, 0);
2: BezierMouse(tx + 700, ty, 0, 0);
end;
GetMousePos(x, y);
ReleaseMouse(x, y, True);
end;
end.

Bobarkinator

2007-06-18 09:28:59

Randomness-30 Speed-13 SlowDown-12


I think that maybe the curve is a little bit to big.

nielsie95

2007-06-18 09:37:39

Try to play a bit with the randomness..
If you want less curve, use less randomness :)

Bobarkinator

2007-06-18 09:44:13

Randomness-12 Slowdown-12 Speedup- 13
This seems to resemble me moving the mouse the most

Dark_Sniper

2007-06-18 10:50:53

well i like this new mouse procedure…

the curves no matter what if i went the same speed and everything i get the same curves…

even though i do not spline my curves… when i move the mouse i just make one curve… i rarely spline them…

nielsie95

2007-06-18 11:24:09

To change the curve; you need to change the randomness.

even though i do not spline my curves… when i move the mouse i just make one curve… i rarely spline them…


Can you make an image in paint of how you would move your mouse? :)

shaunthasheep

2007-06-18 12:15:23

heres some details on how to make the mouse more human like


maybe holdmouse on diffrent pixel, but close to the destination pixel, you know what im saying, and the faster your doing something, the bigger the holdmouse pixel is farther from the releasemouse pixel.

Bebe

2007-06-18 13:03:44

/me waits for Ben to post….

Nice work nielsie, I will have to test this later and give you feedback.

nielsie95

2007-06-18 14:32:56

Thanks for the nice comments and suggestions :)

@The_Rs_Monkey:


procedure BezierClickMouse(cx, cy, rx, ry: Integer; Left: Boolean);
var
PointArray, ResultArray: TPointArray;
i, tx, ty, SlowDownWait, Dist: Integer;
begin
GetMousePos(tx, ty);
try
Dist := Distance(tx, ty, cx, cy);
if Dist <= Round((rx + ry) / 2) then Exit;
except Exit; end;
if Random(2) = 0 then PointArray := CreateSplinePoints(Point(tx, ty), Point(cx + Random(rx), cy + Random(ry))) else
PointArray := CreateSplinePoints(Point(tx, ty), Point(cx - Random(rx), cy - Random(ry)))
ResultArray := BezierSpline(PointArray, Round(Distance(tx, ty, cx, cy) / Abs(12 - (MouseSpeed mod 3))), 3.0);

for i := 0 to Length(ResultArray) -1 do
begin
MoveMouse(ResultArray[i].x, ResultArray[i].y);
SlowDownWait := Round((i div (Length(ResultArray) -1)) * 100);
if SlowDownWait <= (SlowDown / 2) then Wait(Ceil(MouseSpeed + iAbs(((SlowDown / 2) +1) - SlowDownWait) * (MouseSpeed div 5))) else
if SlowDownWait >= (100 - SlowDown) then Wait(Ceil(MouseSpeed + iAbs((101 - SlowDown) - SlowDownWait) * (MouseSpeed div 5))) else
if (MouseSpeed < 3) and (Random(2) = 0) then Wait(0) else Wait(Ceil(MouseSpeed + Random(MouseSpeed div 5)));
try
if Distance(cx, cy, ResultArray[i].x, ResultArray[i].y) <= Round((rx + ry) / 2) then Break;
except Break; end;
end;

GetMousePos(tx, ty);
HoldMouse(tx, ty, Left);
if (rx <> 0) and (ry <> 0) then MoveMouseSmooth(RandomRange(cx -(rx mod 3), cx +(rx mod 3)), RandomRange(cy -(ry mod 3), cy +(ry mod 3)));
Wait(Round(5 + (MouseSpeed / 2) + Random(5)));
GetMousePos(tx, ty);
ReleaseMouse(tx, ty, Left);
end;

That should move the mouse a little while clicking, the rx and ry also define the movements while clicking.. So 0 wont move and 4 will move quite a bit. :)

shaunthasheep

2007-06-18 20:43:43

maybe we can have:

TypeSend('Ill think i try playing with my left hand');

and just have the mouse be a peice of shit. Moves slow and huge criss-crosses and weird jaggety curves.

lol :o

Bobarkinator

2007-06-18 21:31:36

That would be hilarious

Dark_Sniper

2007-06-18 23:11:23

looking at rs monkeys he moves the mouse fairly slow and rough….


i do mine fast and semi accurately… :




but i guess i do spline a tiny bit just not as much as ben mouse gives off…(knowing ben he will destroy us all with his extreme math powers…..)

i did make a mouse my self(before divi….)
that mimicked my mouse movements…. but i though well i guess ben knows what he is doing and i shall not try to rival him XD@!

Bobarkinator

2007-06-18 23:30:47

I've always thought that BenMouse was a little bit to curvy/slow but if you set it to false it's to straight and accurateh

Dark_Sniper

2007-06-19 00:30:34

well in this picture of a human using the spray paint it will show you how fast and slow and accurate a human is compared to bens mouse…

here is the human pic:



as you can see… short distances take a longer time to get to…

when i spline… while making the spline the mouse moves slower…(see mouse movement from buttom right hand corner… to other box… you can see the darker spot where i spline which means i slowed down.)

when Starting and ending the mouse moving is the slowest.



now for bens mouse :


As you can see not as human as everyone thinks… but still the very best we got XD(for now)


benmouse speed can change yes…. even if you speed it up it does not look the same as mine (except for the speed) but when it splines i do not see it slowing as much… and when starting it starts off fairly faster than avg…

now as you can see there can be a few fixes.. but its fine as it is…


this does prove ben mouse does slow when finishing its movement… except for the top right hand corner wtf…. thats untampered with data right there XD! wtf it speed up?

what do you guys think?



also compare my human (longest mouse movement) with bens… its almost identical … except for speed which can be changed….








why use spray paint?

because it helps show the speed of the mouse the darker the spot the slower if it skips the faster…. easy and shows so much info people just have not seen XD!

rkroxpunk

2007-06-19 03:12:15

dunno if u still need em but here's mine. Red box is start (making green end) ;)



I still don't know how I make it full pic, no link i use works >.<

Dark_Sniper

2007-06-19 03:41:42

that helps me when i draw the conclusion that benmouse "over" splines…

notice how yours is slow in the begining and ending…


you slow down when you do make splines…

lol just what i thihnk about the thing.

The Claw

2007-06-19 06:27:10


hmm, i slow down near the end but start off fast. Everyone has different ways of using the mouse it seems. Maybe we could take a sample of say 10 or 15 people and make a mouse procedure which when it moves the mouse, randomly uses one way of moving it?

nielsie95

2007-06-19 07:53:53

Thanks for everyones mousepaths :)..
But have you guys actually tested BezierMouse..?
From all the paths I see, I think you can create pretty similar movements with BezierMouse.. Just play around a bit with randomness and speed.

Smartzkid

2007-06-25 21:16:06

From: Dark Sniper
but still the very best we got XD(for now)


I thought the best was deadmouse?

Will test this…looks very nice; good work Nielsie, you're brilliant

Pyro

2007-06-25 21:46:32

Yes deadmouse is very good. You cant really compare rsn mouse. I dont actually think it is rsns mouse. Correct me if im worng. But the mouse in SI just absolutely owned. With the over shooting and what not. From pics it looks ok.

Wizzup?

2007-06-26 03:31:14

What is dead mouse?

Santa_Clause

2007-06-26 04:24:12

I was about to ask the same.

Sumilion

2007-06-26 05:24:08

Ehm… <3 Beziermouse.

nielsie95

2007-06-26 07:03:02

Thanks Sum :)

Here I found something about DeadMouse. It looks pretty good to me, though it creates almost similar paths as BenMouse.

The Claw

2007-06-28 05:47:46

How can I test this?

rkroxpunk

2007-06-28 06:18:47

open paint. click the pencil. drag the crosshair onto the paint window drawing thingy tidlybit and hit playzor!

Hugolord

2007-06-28 07:04:45

i like this nielsie great job again?

erm ill try getting my mouse paths soon ppl
once again great job

dontpanic

2007-06-28 09:52:02

VERY NICE MOUSING PROCEDURE!
This is good because it only takes one big curve, which is what humans usually do(atleast what I do(I had to test myself in paint :P)). One thing that could push this over the edge (in a good way) is to add some way to have corners and slow down at certain points inside the curve. Maybe even have 2 of your lines in one normal one, because humans often think about what there clicking while they move the mouse, and that causes them to stop for a second.

Sumilion

2007-06-28 09:55:10

Vote on adding it to the repos ?

Hugolord

2007-06-28 10:23:15

From: Sumilion
Vote on adding it to the repos ?


yes sure ;p!

LordGregGreg

2007-06-28 10:30:05

Hmm, wow, i defanilty like this new mouse. It si very very good. I really like the slow down feature. Here some ideas if you are bored, but dont get me wrong, its really good now. First of, mouse pads and laptop pads are only so big, so to get to a point make take more than one movement. Also, The slow down is nice, but it seems to be a lenear slow down. Perhaps make it exponential. Anyhows, here what made me thing this.




Hope this helps, and GREAT job!

Smartzkid

2007-06-28 11:11:20

From: Wizzup?
What is dead mouse?


(* Realistic mouse script by *DEAD*
Ok, this is my first mouse script worthy of releasing, and it looking really good.
Its a different type of mouse script design from all my others and most others
ive seen. It works by "homing" in on a target, which means you can "bump" the mouse
randandomly change its direction, and it would correct itself, much like a real person would.

There are lots of required varables, so ill go through them.

tomouse(targx,targy,maxspeed,minspeed,square,accuracy,turnspeed,acceleration,deceleration:integer; finishingtouch:boolean);
targx and targy are the x,y coords of the point the mouse is to move to.
maxspeed is the speed at which the mouse accelerates to.
minspeed is the minimum speed of the mouse, with out it the mouse would stop (i intend to find a work around which will fix this).
Think of square as the randomness of each small mouse movement. Each time the script is given a coordanate to move to, the mouse moves to a coordanate close to that point which is inside a square.
accuracy is how close the cursor has to be to the target before it stops
turnspeed is how fast the mouse can change direction. This is actually a percentage (0 - 100) of the difference between the target angle and the current angle (i recomend 20 - 25) (known glitch, sometimes it will just keep circling around the target, im working on it)
acceleration is the rate at which the mouse accelerates(%)
deceleration is the rate at which the mouse decelerates(%)

finishingtouch will move the mouse to the target after the main move mouse script stops. With out this, the mouse could stop within "accuracy" pixels from the target
there is one more varable, curangle. This is a global, but when i release the actual script it will be fixed. Curangle is the angle at which the mouse is traveling at any given time. If you change its start value, the mouse will start moving in a different direction. Remember, since on a computer screen the y axis is at the top of the screen and counts up as it goes down, the circle will be inverted. so 90 is downward, 270 is upward, 0 is right, and 180 is left.


The best thing about this script is that its easy to add on to.
Ive included a "bump" procedure which randomly change the mouses direction,
and the the mouse will correct itself all by itself. cool eh. This means
you can do anything from making a quick jolt, to emulating the mouse falling
off the desk.

(UPDATE)
now that the script is complete, i have made it alot simpler.
the procedure is now
deadmouse(targx,targy,speed,turnspeed,acceleration:integer; finishingtouch:boolean);
finishing touch isnt really neccesary any more, however i guess it would help.

Enjoy
*)

program deadmouse;
{.include SRL/SRL.scar}

var
x1,y1,curangle:integer;
i,j:extended;

function loge(i:extended) : extended;
var
count,exp:integer;
xval:extended;
begin
exp:= 1;
xval:= (i - 1) / (i + 1);
for count:= 1 to 5 do
begin
result:= result + pow(xval,exp)/exp;
exp:= exp + 2;
end;
result:= result * 2;
end;

function logb(base,i:extended) : extended;
begin
result:= loge(i)/loge(base);
end;

function spabs(i : extended) : extended;
begin
i:= sqrt(i*i);
result := i;
end;

function fact(i : integer) : integer;
var
holdi,res : integer;
begin
holdi := i;
res := 1;
for i := 1 to holdi do
begin
res := i * res
end;
result := res;
end;

function arctan(e : extended) : extended;
var
count : integer;
res : extended;
inv : boolean;
begin
if(spabs(e) > 1)then
begin
e := pow(e,-1);
inv := true;
end else
begin
inv := false;
end;
for count := 0 to 6 do
begin
res := res + ( ( pow(2,2 * count) * pow(fact(count),2) ) / fact(2 * count + 1) ) * ( ( pow(e,2*count+1) ) / ( pow(1 + pow(e,2),count + 1) ) );
end;
if(inv)then
begin
res := 1.5707963267 - res;
end;
result := res;
end;

procedure findintercept(targx,targy,radius:integer);
begin
x1:= round(x1 + i * radius);
y1:= round(y1 + j * radius);
end;

procedure adjangle(targx,targy,rate:integer);
var
targangle,spdegrees,angledifft,anglediffc:integer;
spradians:extended;
begin
if(targx - x1 = 0) or (targy - y1 = 0)then
begin
if(targx - x1 = 0)then
begin
if(targy - y1 > 0)then
begin
targangle:= 270;
end else
begin
targangle:= 90;
end;
end;
if(targy - y1 = 0)then
begin
if(targx - x1 > 0)then
begin
targangle:= 180;
end else
begin
targangle:= 0;
end;
end;
end else
begin
spdegrees:= round(arctan(spabs((x1 - targx)/(y1 - targy))) * 180 / pi);
if(targx - x1 > 0)then
begin
if(targy - y1 > 0)then
begin
targangle:= 90 - spdegrees;
end else
begin
targangle:= 270 + spdegrees;
end;
end else
begin
if(targy - y1 > 0)then
begin
targangle:= 90 + spdegrees;
end else
begin
targangle:= 270 - spdegrees;
end;
end;
end;
anglediffc:= curangle - targangle;
angledifft:= targangle - curangle;
if(anglediffc < 0)then
begin
anglediffc:= anglediffc + 360;
end;
if(angledifft < 0)then
begin
angledifft:= angledifft + 360;
end;
if(curangle <> targangle)then
begin
if(angledifft > anglediffc)then
begin
curangle:= curangle - round(rate / 100 * anglediffc);
end else
begin
curangle:= curangle + round(rate / 100 * angledifft);
end;
end;
spradians:= curangle * pi / 180;
i:= cos(spradians);
j:= sin(spradians);
end;

procedure bump();
begin
if(random(10) < 1)then
begin
curangle:= round(curangle - 0.5 * 40 + random(40));
end;
end;

procedure accelerate(targx,targy,speed,acceleration:integer; var curspeed:extended; var decelerate:boolean);
var
dist,dedist,deceleration,time:extended;
begin
deceleration:= -acceleration / 100 + 1;
if(curspeed <> 0)then
begin
dist:= sqrt(pow(targx - x1, 2) + pow(targy - y1, 2));
time:= logb(deceleration,5/curspeed);
dedist:= curspeed * (1 - pow(deceleration,time))/(1 - deceleration);
end else
begin
dedist:= dist - 1;
end;
if(dist < dedist)then
begin
decelerate:= true;
end;
if(decelerate)then
begin
if(curspeed > 5)then
begin
curspeed:= curspeed * deceleration;
end;
end else
begin
curspeed:= curspeed + acceleration / 100 * (speed - curspeed);
end;
// writeln(floattostr(curspeed));
// writeln(floattostr(dist) + ':' + floattostr(time) + ':' + floattostr(dedist));
end;

procedure changeturnspeed(targx,targy,turnspeed,totaldist:integer; var curturnspeed :integer);
var
dist:extended;
hold:integer;
begin
dist:= sqrt(pow(targx - x1, 2) + pow(targy - y1, 2));
hold:= round(pow(100 - turnspeed,pow((totaldist - dist)/totaldist,2)) + turnspeed);
if(hold > curturnspeed)then
begin
curturnspeed:= hold;
end;
end;

procedure randomcurangle(targx,targy:integer);
var
targangle,spdegrees:integer;
begin
if(targx - x1 = 0) or (targy - y1 = 0)then
begin
if(targx - x1 = 0)then
begin
if(targy - y1 > 0)then
begin
targangle:= 270;
end else
begin
targangle:= 90;
end;
end;
if(targy - y1 = 0)then
begin
if(targx - x1 > 0)then
begin
targangle:= 180;
end else
begin
targangle:= 0;
end;
end;
end else
begin
spdegrees:= round(arctan(spabs((x1 - targx)/(y1 - targy))) * 180 / pi);
if(targx - x1 > 0)then
begin
if(targy - y1 > 0)then
begin
targangle:= 90 - spdegrees;
end else
begin
targangle:= 270 + spdegrees;
end;
end else
begin
if(targy - y1 > 0)then
begin
targangle:= 90 + spdegrees;
end else
begin
targangle:= 270 - spdegrees;
end;
end;
end;
curangle:= targangle - 45 + random(90);
if(curangle > 0)then
begin
curangle:= curangle + 360;
end;
end;

procedure gravity(gravpointx,gravpointy,grav,pull:integer);
var
gravx,gravy:integer;
slope:extended;
begin
if(x1 - gravpointx = 0)or(y1 - gravpointy = 0)then
begin
if(x1 - gravpointx = 0)then
begin
gravy:= grav;
end else
begin
gravx:= grav;
end;
end else
begin
slope:= (x1 - gravx)/(y1 - gravy);
gravx:= round(grav/(1 + slope));
gravy:= round((grav/(1 + slope)) * slope);
end;
if(gravpointx > x1)then
begin
x1:= x1 - gravx;
end else
begin
x1:= x1 + gravx;
end;
if(gravpointy > y1)then
begin
y1:= y1 - gravy;
end else
begin
y1:= y1 + gravy;
end;
end;

procedure deadmouse(targx,targy,maxspeed,turnspeed,acceleration:integer; finishingtouch:boolean);
var
curspeed:extended;
square,totaldistance,curturnspeed,grav,gravpointx,gravpointy,pull:integer;
decelerate:boolean;
begin
getmousepos(x1,y1);
curspeed:= 0;
totaldistance:= round(sqrt(pow(targx - x1, 2) + pow(targy - y1, 2)));
randomcurangle(targx,targy);
pull:= random(2);
gravpointx:= random(round(spabs(targx-x1)));
gravpointy:= random(round(spabs(targy-y1)));
if(targx > x1)then
begin
gravpointx:= targx - gravpointx;
end else
begin
gravpointx:= targx + gravpointx;
end;
if(targy > y1)then
begin
gravpointy:= targy - gravpointy;
end else
begin
gravpointy:= targy + gravpointy;
end;
repeat
accelerate(targx,targy,maxspeed,acceleration,curspeed,decelerate);
changeturnspeed(targx,targy,turnspeed,totaldistance,curturnspeed);
adjangle(targx,targy,curturnspeed);
findintercept(targx,targy,round(curspeed));
if(decelerate <> true)then
begin
gravity(gravpointx,gravpointy,grav,pull);
end;
grav:= round(random(round(curspeed)) * 0.1);
bump();
square:= round(curspeed / 4);
x1:= round(x1 + random(square) - 0.5 * square);
y1:= round(y1 + random(square) - 0.5 * square);
movemouse(x1,y1);
wait(10);
until(y1 < targy + 10)and(y1 > targy - 10)and(x1 < targx + 10)and(x1 > targx - 10);
if(finishingtouch)then
begin
movemouse(targx,targy)
end;
end;

Procedure DMouseEx(mousex, mousey, ranx, rany, maxspeed, turnspeed, acceleration: integer; finishingtouch: boolean);
var
xx, yy, mx, my : integer;
begin
xx := mousex - ranx / 2 + random(ranx);
yy := mousey - rany / 2 + random(rany);
GetMousePos(mx, my);
//writeln(inttostr(Distance(mx, my, xx, yy)));
if(Distance(mx, my, xx, yy) > 200)then
begin
try
deadmouse(xx, yy, maxspeed, turnspeed, acceleration, finishingtouch);
except
//writeln('Failure in DeadMouse, switching to MMouse');
MMouse(mousex, mousey, ranx, rany);
end;
end else
MMouse(mousex, mousey, ranx, rany);
end;

Procedure CDMouseEx(mousex, mousey, ranx, rany, maxspeed, turnspeed, acceleration: integer; finishingtouch, left : boolean);
var
xx, yy : integer;
begin
DMouseEx(mousex, mousey, ranx, rany, maxspeed, turnspeed, acceleration, finishingtouch);
wait(10 + random(25));
GetMousePos(xx, yy);
HoldMouse(xx, yy, left);
wait(50 + random(50));
ReleaseMouse(xx, yy, left);
end;

Procedure DMouse(mousex, mousey, ranx, rany : integer);
var
xx, yy, mx, my : integer;
begin
xx := mousex - ranx / 2 + random(ranx);
yy := mousey - rany / 2 + random(rany);
GetMousePos(mx, my);
//writeln(inttostr(Distance(mx, my, xx, yy)));
if(Distance(mx, my, xx, yy) > 200)then
begin
try
deadmouse(xx, yy, 15, 6, 10, true);
except
writeln('Failure in DeadMouse, switching to MMouse');
MMouse(mousex, mousey, ranx, rany);
end;
end else
MMouse(mousex, mousey, ranx, rany);
end;

Procedure CDMouse(mousex, mousey, ranx, rany : integer; left : boolean);
var
xx, yy : integer;
begin
DMouse(mousex, mousey, ranx, rany);
wait(10 + random(25));
GetMousePos(xx, yy);
HoldMouse(xx, yy, left);
wait(50 + random(50));
ReleaseMouse(xx, yy, left);
end;

begin
SetupSRL;
repeat
MoveMouse(0,0);
wait(100);
DMouse(500, 500, 5, 5);
wait(500);
until(isfkeydown(12))
end.

I adjusted some procedure names to make it work with srl, and I made the DMouse (like mmouse) and CDMouse (like mouse) procedures. For distances under 100, MMouse is used (deadmouse seems to act a bit weird with short distances. MMouse is also used as a fallback in the case of a failure on deadmouse's part

Not sure how well the default settings work, if you don't like them, try experimenting with DMouseEx…

Still playing around with BezierMouse…I can't get it to move the mouse as humanly as I would like

EDIT:

Just noticed Nielsie's link, so I guess this wasn't needed…

LordGregGreg

2007-06-28 13:31:58

wow…
im..unworthy
i dont think io could ever make something so cool



why arent we using this CDMOUSE thing?
I think i like it better than mouse( at least.

Secet

2007-06-28 15:52:18

This is how I normally move my mouse:

http://img265.imageshack.us/img265/7889/mousevk1.png







:spot:

Bobarkinator

2007-06-28 17:27:41

Lol, I believe it.