SRL Archive - Discussions and Debates

Flaw in MouseSpeed ?


Sumilion

2006-10-30 12:05:10

I don't know if i missed something, but i ran a 'test' script to see the time every MouseSpeed takes to move from the upper left corner to the lower right corner. Here are the results :
Time = 938
Speed = 0
Time = 3078
Speed = 1
Time = 4531
Speed = 2
Time = 4531
Speed = 3
Time = 4563
Speed = 4
Time = 4547
Speed = 5
I stopped at 5 since the results are obvious. MouseSpeed didn't seem to change for me after Speed = 2 … If you want to test it yourself and if you are too lazy to make it, here it is :
program New;
{.include SRL/SRL.scar}
Var
MouseSpeedTime : Array[0..30] of integer;
Counter, Marker : integer;
Const
ScreenX = 1023; //Horizontal px count -1
ScreenY = 767; //Vertical px count -1
begin
SetupSRL;
Repeat;
MoveMouse(0,0);
MouseSpeed := Counter;
MarkTime(Marker);
MMouse(ScreenX, ScreenY, 0, 0);
MouseSpeedTime[Counter] := TimeFromMark(Marker);
Writeln('Time = '+IntToStr(TimeFromMark(Marker)));
Counter := Counter+1;
Writeln('Speed = '+IntToStr(MouseSpeed))
Until(Counter = 30);
end.
:confused: tags seem to have messed up my enters, dont be to lazy to fix it if it doesnt work ;)

I'm not sure if it's a bug since MouseSpeed is somewhat complicated of finding out how it works.

Boreas

2006-10-30 14:47:20

Do the test with each speed 10 times each and find the average. If the average time generally increases with the speed number then it's probably just randomness and not a flaw. Besides, humans don't move the mouse at the same speed all the time. I've never looked at how mouse speed works though so I dunno.

weibs

2006-10-30 19:48:12

I don't really understand mouse speed that well, either, but, I have a guess: because the spline paths that are generated can sometimes have large curves ( Which may take longer, not sure ) and sometimes have small curves ( Which may take less time, not sure ) could make it seem like the mouse speed wasn't changing, but again, I'm not sure.

I'll test it out and see what I come up with.

EDIT: Alright, scratch my theory above, lol. I just ran 5 tests each going up to a mouse speed of 4 ( Didn't have much time ) and came out with these results and averages:


---------------------------------------------------
The number within the first brackets is the test #.
The number within the seconds brackets is the mouse speed.
Example:
MouseSpeedTime[0][3]:
Test # --------------^ ^
MouseSpeed ---------^
---------------------------------------------------


MouseSpeedTime[0][0]:
Time = 968

MouseSpeedTime[0][1]:
Time = 2891

MouseSpeedTime[0][2]:
Time = 4531

MouseSpeedTime[0][3]:
Time = 4516

MouseSpeedTime[0][4]:
Time = 4531

MouseSpeedTime[1][0]:
Time = 891

MouseSpeedTime[1][1]:
Time = 2797

MouseSpeedTime[1][2]:
Time = 4531

MouseSpeedTime[1][3]:
Time = 4531

MouseSpeedTime[1][4]:
Time = 4531

MouseSpeedTime[2][0]:
Time = 813

MouseSpeedTime[2][1]:
Time = 2906

MouseSpeedTime[2][2]:
Time = 4531

MouseSpeedTime[2][3]:
Time = 4532

MouseSpeedTime[2][4]:
Time = 4515

MouseSpeedTime[3][0]:
Time = 922

MouseSpeedTime[3][1]:
Time = 3125

MouseSpeedTime[3][2]:
Time = 4531

MouseSpeedTime[3][3]:
Time = 4547

MouseSpeedTime[3][4]:
Time = 4532

MouseSpeedTime[4][0]:
Time = 875

MouseSpeedTime[4][1]:
Time = 2890

MouseSpeedTime[4][2]:
Time = 4563

MouseSpeedTime[4][3]:
Time = 4531

MouseSpeedTime[4][4]:
Time = 4531

Mouse Speed: 0 Average Time: 893.8

Mouse Speed: 1 Average Time: 2921.8

Mouse Speed: 2 Average Time: 4537.4

Mouse Speed: 3 Average Time: 4531.4

Mouse Speed: 4 Average Time: 4528

It is weird, the last three averages are almost exact, perhaps there is an error in the mouse speed..?

Oh, and if you want the test script I was using, here ya go, just set the constants, and run it:

program New;
{.include SRL/SRL.scar}
Var
MouseSpeedTime : Array of Array of integer;
Average: Array of Extended;
Counter, Counter2, Marker, s, t, i: integer;

Const
MaxMouseSpeed = 5; //Max MouseSpeed used during the tests.
NumOfTests = 5; //Number of tests to perform.
ScreenX = 1023; //Horizontal px count -1
ScreenY = 767; //Vertical px count -1

Begin
SetupSRL;
SetArrayLength(MouseSpeedTime, NumOfTests);
For i := 0 To NumOfTests-1 Do
SetArrayLength(MouseSpeedTime[i], MaxMouseSpeed);
SetArrayLength(Average, MaxMouseSpeed);
WriteLn('---------------------------------------------------');
WriteLn('The number within the first brackets is the test #.');
WriteLn('The number within the seconds brackets is the mouse speed.');
WriteLn('Example:');
WriteLn(' MouseSpeedTime[0][3]:');
WriteLn(' Test # ---------^ ^');
WriteLn(' MouseSpeed -------^');
WriteLn('---------------------------------------------------');
Wait(2000);
WriteLn('');
WriteLn('');
Repeat
MoveMouse(0,0);
MouseSpeed := Counter;
MarkTime(Marker);
MMouse(ScreenX, ScreenY, 0, 0);
MouseSpeedTime[Counter2][Counter] := TimeFromMark(Marker);
WriteLn('MouseSpeedTime[' + IntToStr(Counter2) + '][' + IntToStr(Counter) + ']:');
Writeln(' Time = '+IntToStr(TimeFromMark(Marker)));
WriteLn('');
Counter := Counter+1;
If Counter = GetArrayLength(MouseSpeedTime[0]) Then
Begin
Counter := 0;
Counter2 := Counter2 + 1;
End;
Until(Counter2 = GetArrayLength(MouseSpeedTime));
For t := 0 To GetArrayLength(MouseSpeedTime)-1 Do
Begin
For s := 0 To GetArrayLength(MouseSpeedTime[0])-1 Do
Average[s] := Average[s] + MouseSpeedTime[t][s];
End;

For s := 0 To GetArrayLength(Average)-1 Do
Begin
Average[s] := Average[s] / GetArrayLength(MouseSpeedTime);
WriteLn('Mouse Speed: ' + IntToStr(s) + ' Average Time: ' + FloatToStr(Average[s]));
WriteLn('');
End;
end.

Cheesehunk

2006-10-30 20:55:27

You're guys results are messed :p :
Time = 687
Speed = 0
Time = 844
Speed = 1
Time = 1141
Speed = 2
Time = 1250
Speed = 3
Time = 1343
Speed = 4
Time = 1469
Speed = 5
Time = 1625
Speed = 6
Time = 1813
Speed = 7
Time = 1843
Speed = 8
Time = 1969
Speed = 9
Time = 2203
Speed = 10
Time = 2297
Speed = 11
Time = 2391
Speed = 12
Time = 2500
Speed = 13
Time = 2656
Speed = 14
Time = 2828
Speed = 15
Time = 2860
Speed = 16
Time = 3031
Speed = 17
Time = 3219
Speed = 18
Time = 3375
Speed = 19
Time = 3375
Speed = 20
Time = 3547
Speed = 21
Time = 3703
Speed = 22
Time = 3875
Speed = 23
Time = 3875
Speed = 24
Time = 4031
Speed = 25
Time = 4219
Speed = 26

weibs

2006-10-30 21:10:59

Woah, what the heck? Did you change anything in the test script?

Boreas

2006-10-30 22:41:16

I looked at mmouse and mousespeed isn't used in a direct relationship. It is used multiple times in different way. There is also a random factor. I wouldn't worry about, since being exact would be a bad thing anyway. Maybe benland100 can clear things up.

Sumilion

2006-10-31 02:27:14

Hmm, check this out, after MouseSpeed 15 it went a bit slower again… very strange, BenLand, help pls :p

Time = 985
Speed = 0
Time = 2953
Speed = 1
Time = 4562
Speed = 2
Time = 4578
Speed = 3
Time = 4532
Speed = 4
Time = 4531
Speed = 5
Time = 4531
Speed = 6
Time = 4547
Speed = 7
Time = 4531
Speed = 8
Time = 4547
Speed = 9
Time = 4531
Speed = 10
Time = 4532
Speed = 11
Time = 4547
Speed = 12
Time = 4546
Speed = 13
Time = 4547
Speed = 14
Time = 4532
Speed = 15
Time = 4562
Speed = 16
Time = 4594
Speed = 17
Time = 4609
Speed = 18
Time = 4625
Speed = 19
Time = 4672
Speed = 20
Time = 4641
Speed = 21
Time = 4672
Speed = 22
Time = 4671
Speed = 23
Time = 4704
Speed = 24
Time = 4703
Speed = 25
Time = 4906
Speed = 26
Time = 5187
Speed = 27
Time = 5375
Speed = 28
Time = 5391
Speed = 29

BenLand100

2006-11-04 00:58:44

Confucius say, "Higher MouseSpeed makes a slower mouse."
"Scar is not accurate beyond 20 ms," quoth Buddha.
And then Jesus said, "Amen, Amen, I say to you, no two computers will ever get the same values"
Benjamin Land speakth, "Thou shalt not tryest to comprehend my mathematical implementations."

Edit: I might make that last one my signature lol

WhiteShadow

2006-11-04 01:42:15

Interesting way to explain. Btw though, Buddha no speak English. x\ Confucius is noob also.

xD!

BenLand100

2006-11-04 02:10:55

From: WhiteShadow
Interesting way to explain. Btw though, Buddha no speak English. x\ Confucius is noob also.

xD!

What can I say, it leaves a lasting impression does it not :P

Sumilion

2006-11-04 04:47:59

Haha… :confused: i don't get the half of it ^^

What i think to understand from your post is that … ? its scar ?

And no, 2 computers did not get the same result, but nearly the same.

Bebe

2006-11-04 09:00:48

The lower the number for Mousespeed the fast the mouse moves.
They are random though, so you will never get the same times for the movement.

Sumilion

2006-11-04 10:43:59

From: Bebemycat2
The lower the number for Mousespeed the fast the mouse moves.
They are random though, so you will never get the same times for the movement.


Bebemy, you can count on it that i know that ;) both things, but after mousespeed 2 it would hardly get slower for me and for Yakman for that matter. Did you even read the thread ?

BenLand100

2006-11-04 10:48:30

From: Sumilion
Bebemy, you can count on it that i know that ;) both things, but after mousespeed 2 it would hardly get slower for me and for Yakman for that matter. Did you even read the thread ?

Dist:= Round(Sqrt((Path[i].X - Dx) * (Path[i].X - Dx) + (Path[i].Y - Dy) * (Path[i].Y - Dy)));
if Dist < 50 then
begin
SlowDown:= SlowDown + (0.05 * MouseSpeed);
end;
Wait(Round(((Random(2) + MouseSpeed) / 10) * Sqrt(Sqr(Path[i].X - Lx) + Sqr(Path[i].Y - Ly)) + SlowDown));
When that formula hits a sweet spot, it stays there. Other distances might be different ;)

lardmaster

2006-11-04 11:26:55

benland, i was just wondering, exactly what kind of path do you use to model the mouse movement?

Sumilion

2006-11-04 11:36:22

From: BenLand100
When that formula hits a sweet spot, it stays there. Other distances might be different ;)


So would that mean that in the end, mousespeed 10 and 20 aren't that different (and compared to 1 and 5)?

BenLand100

2006-11-04 15:47:50

1) I use my own special spline formula for the path
2) Try another distance and see what happens ;)

Sumilion

2006-11-04 16:14:27

Guess what… your absolutely right ! Still i find the times i got in my first post strange. How come the speed will go slower if you move the mouse more ?

Script:
program New;
{.include SRL/SRL.scar}
Var
MouseSpeedTime : Array[0..30] of integer;
Counter, Marker : integer;
Const
ScreenX = 1023; //Horizontal px count -1
ScreenY = 767; //Vertical px count -1
begin
SetupSRL;
Repeat;
MoveMouse(0,0);
MouseSpeed := Counter;
MarkTime(Marker);
MMouse(ScreenX, ScreenY, 0, 0);
MMouse(555, 87, 0, 0);
MMouse(132, 398, 0, 0);
MMouse(769, 427, 0, 0);
MouseSpeedTime[Counter] := TimeFromMark(Marker);
Writeln('Time = '+IntToStr(TimeFromMark(Marker)));
Counter := Counter+1;
Writeln('Speed = '+IntToStr(MouseSpeed)) Until(Counter = 30);
end.

Results:
Time = 1781
Speed = 0
Time = 2328
Speed = 1
Time = 3110
Speed = 2
Time = 3375
Speed = 3
Time = 3609
Speed = 4
Time = 3875
Speed = 5
Time = 4437
Speed = 6
Time = 4719
Speed = 7
Time = 4906
Speed = 8
Time = 5250
Speed = 9
Time = 5766
Speed = 10

Guess another thing … 500th post !!!!!!!!!!!!!!!!!!!!!!!!!

ruler

2006-11-04 16:22:40

For ibot i took a different view at speed.

I use a hyperbola to regulate speed. It starts and ends slow.

Also use bounds keep the mouse inside a rectagle through out the entire motion. Example Game Screen, a menu, ect.

Also modified the {ArrayList<Point> Controls} geneation.

The speed for the entire thing is also constainted by the time allowed. A higher timeallowed decreases the speed and a lower time allowed increases the speed.

mouseClickRight(int x, int y, Rectangle bounds, int timeAllowedInMillsecs)

BenLand100

2006-11-04 16:46:10

From: Sumilion
Guess what… your absolutely right!

Its not like I wrote it or anything :cool:
And ruler, I'ed like to see how you did the time allowed thing. Is it that you give it a time to move in and it moves fully within that time or does it just not go over that time?

ruler

2006-11-04 19:52:47

From: BenLand100
Its not like I wrote it or anything :cool:
And ruler, I'ed like to see how you did the time allowed thing. Is it that you give it a time to move in and it moves fully within that time or does it just not go over that time?

Moves fully in that time allowed. Does not go over, does not go under. Well mebe a millsec over or under due to multi-threads.

The manager is its own thread and takes orders from a script and random threads and decides pased on priority.

One can write a tracer where it send the order to click somewhere and then send a new order mid flight.