SRL Archive - SRL Archives

More Humanlike Mouse Movements


Rich

2009-05-13 22:01:19

I read this from here,

Q: The mouse thing will affect honest players.
A: Not many people know this, but every time you try to click something, the mosue speed jumps high, then decreases to nearly zero upon gettin close to the target. Basically, a player needs some time to check if the mouse is on the right position before clicking, but autoers do that instantly.


This got me thinking, because he's right. When I play legit, I do exactly what he says, and (M)Mouse don't do that (as far as I can see), so I came up with these.

//procedure HMMouse(X, Y, RX, RY : Integer);
//By R1ch
//Example: HMMouse(X, Y, 7, 7);
procedure HMMouse(X, Y, RX, RY : Integer);
var
XX, YY : Integer;
begin
MouseSpeed:= 15 + Random(3);
case Random(2) of
0: XX:= X + Random(40);
1: XX:= X - Random(40);
end;
case Random(2) of
0: YY:= Y + Random(40);
1: YY:= Y - Random(40);
end;
MMouse(XX, YY, 10, 5);
MouseSpeed:= 4 + Random(3);
Wait(50 + Random(25));
MMouse(X, Y, RX, RY);
end;

What the above (HMMouse) does is moves the mouse to a point, (50 X randomness, and 45 Y randomness) at a normal human speed, then as it reaches the "random 50, 45 point", it slows down, like a human, then goes to the point the user specified.

//procedure HMouse(X, Y, RX, RY : Integer; LClick : Boolean);
//By R1ch
//Example: HMouse(X, Y, 7, 7, True)
procedure HMMouse(X, Y, RX, RY : Integer; LClick : Boolean);
var
XX, YY : Integer;
begin
MouseSpeed:= 15 + Random(3);
case Random(2) of
0: XX:= X + Random(40);
1: XX:= X - Random(40);
end;
case Random(2) of
0: YY:= Y + Random(40);
1: YY:= Y - Random(40);
end;
MMouse(XX, YY, 10, 5);
MouseSpeed:= 4 + Random(3);
Wait(50 + Random(25));
Mouse(X, Y, RX, RY, LClick);
end;

This does the same as HMMouse, but it also clicks.

Comments?

noidea

2009-05-13 23:28:59

I made one.
Except mine is "smart" - Determines which side to move the mouse by the mouse pos.

Rich

2009-05-13 23:53:33

I did that, but then felt like doing this, because sometimes you overrun where your target is, and sometimes you don't go far enough, which is just what this simulates.

EDIT: You mean like this?:
//procedure HMMouse(X, Y, RX, RY : Integer);
//By R1ch
//Example: HMMouse(X, Y, 7, 7)
procedure HMMouse(X, Y, RX, RY : Integer);
var
XX, YY : Integer;
begin
MouseSpeed:= 15 + Random(3);
GetMousePos(XX, YY);
if XX > X then
XX:= X + Random(40) else
XX:= X - Random(40);
if YY > Y then
YY:= Y + Random(40) else
YY:= Y - Random(40);
MMouse(XX, YY, 10, 5);
MouseSpeed:= 4 + Random(3);
Wait(50 + Random(25));
MMouse(X, Y, RX, RY);
end;

DeSnob

2009-05-14 01:06:40

I'll check them out. I'll edit this post when i test them out.

Sandstorm

2009-05-14 01:09:10

I've made one to (not trying to hijack your thread):

program New;
{.include srl/srl.scar}

var
xx, yy: integer;

procedure HMouse(x, y, Randx, Randy: integer; click, left: boolean);
var
Startspeed: integer;
begin
Startspeed := MouseSpeed;
WriteLn('Mouse speed is: ' + IntToStr(MouseSpeed));
WriteLn('X is: ' + IntToStr(x) + ' Y is: ' + IntToStr(y));
Xx := x;
Yy := y;
GetMousePos(x, y);
if (x < Xx) and (y < yy) then
begin
x := Xx
y := Yy
WriteLn('Mouse speed: ' + IntToStr(Mousespeed));
WriteLn('Above');
wait(1)
Mmouse(x - 20 - random(5), y - 20 - random(5), Randx, Randy);
Mousespeed := Mousespeed - 5 - random(3);
WriteLn('Mouse speed: ' + IntToStr(Mousespeed));
wait(1)
Mmouse(x - 10 - random(5), y - 10 - random(5), Randx, Randy);
Mousespeed := Mousespeed - 5 - random(3);
WriteLn('Mouse speed: ' + IntToStr(Mousespeed));
wait(1)
if Click then
begin
if Left then
begin
Mouse(x, y, Randx, Randy, true);
end else
Mouse(x, y, Randx, Randy, false);
end else
Mmouse(x, y, Randx, Randy);
MouseSpeed := StartSpeed;
end else
begin
x := Xx
y := Yy
WriteLn('Below');
wait(1);
Mmouse(x + 20 + random(5), y + 20 + random(5), Randx, Randy);
Mousespeed := Mousespeed - 5 + random(2);
WriteLn('Mouse speed is: ' + IntToStr(MouseSpeed));
wait(1)
Mmouse(x + 10 + random(5), y + 10 + random(5), Randx, Randy);
Mousespeed := Mousespeed - 5 + random(2);
WriteLn('Mouse speed is: ' + IntToStr(MouseSpeed));
wait(1)
if Click then
begin
if Left then
begin
Mouse(x, y, Randx, Randy, true);
end else
Mouse(x, y, Randx, Randy, false);
end else
Mmouse(x, y, Randx, Randy);
MouseSpeed := StartSpeed;
end;
end;

begin
Setupsrl;
Wait(1000);
HMouse(500, 500, 3, 3, False, True);
end.

The only problem is it doesn't recognize lower left and upper right quadrants, but besides that it works pretty well.

~Sandstorm

BazzBarrett

2009-05-14 01:43:29

defonatly a good point, we need to make sure its random eg somtimes you overshoot your target and you bring your mouse back and im sure tehre is alreayd a procedure for this but to add it to the actual MMouse would be nice. the little jerk u make when u pick up the mouse. sorry for making you more work id do it but i cba :P

Wizzup?

2009-05-14 01:50:07

As far as I know WindMouse already does this. :)

Dynamite

2009-05-14 02:16:35

sorry to be offtopic but:
Mouse(x, y, Randx, Randy, true);
end else
Mouse(x, y, Randx, Randy, false);

:D

T~M

Sandstorm

2009-05-14 04:18:33

T~M, what do you mean? If you mean that's a name, then yes. I live with someone named Randy.

~Sandstorm

Rich

2009-05-15 00:18:40

From: Sandstorm
I've made one to (not trying to hijack your thread):

program New;
{.include srl/srl.scar}

var
xx, yy: integer;

procedure HMouse(x, y, Randx, Randy: integer; click, left: boolean);
var
Startspeed: integer;
begin
Startspeed := MouseSpeed;
WriteLn('Mouse speed is: ' + IntToStr(MouseSpeed));
WriteLn('X is: ' + IntToStr(x) + ' Y is: ' + IntToStr(y));
Xx := x;
Yy := y;
GetMousePos(x, y);
if (x < Xx) and (y < yy) then
begin
x := Xx
y := Yy
WriteLn('Mouse speed: ' + IntToStr(Mousespeed));
WriteLn('Above');
wait(1)
Mmouse(x - 20 - random(5), y - 20 - random(5), Randx, Randy);
Mousespeed := Mousespeed - 5 - random(3);
WriteLn('Mouse speed: ' + IntToStr(Mousespeed));
wait(1)
Mmouse(x - 10 - random(5), y - 10 - random(5), Randx, Randy);
Mousespeed := Mousespeed - 5 - random(3);
WriteLn('Mouse speed: ' + IntToStr(Mousespeed));
wait(1)
if Click then
begin
if Left then
begin
Mouse(x, y, Randx, Randy, true);
end else
Mouse(x, y, Randx, Randy, false);
end else
Mmouse(x, y, Randx, Randy);
MouseSpeed := StartSpeed;
end else
begin
x := Xx
y := Yy
WriteLn('Below');
wait(1);
Mmouse(x + 20 + random(5), y + 20 + random(5), Randx, Randy);
Mousespeed := Mousespeed - 5 + random(2);
WriteLn('Mouse speed is: ' + IntToStr(MouseSpeed));
wait(1)
Mmouse(x + 10 + random(5), y + 10 + random(5), Randx, Randy);
Mousespeed := Mousespeed - 5 + random(2);
WriteLn('Mouse speed is: ' + IntToStr(MouseSpeed));
wait(1)
if Click then
begin
if Left then
begin
Mouse(x, y, Randx, Randy, true);
end else
Mouse(x, y, Randx, Randy, false);
end else
Mmouse(x, y, Randx, Randy);
MouseSpeed := StartSpeed;
end;
end;

begin
Setupsrl;
Wait(1000);
HMouse(500, 500, 3, 3, False, True);
end.

The only problem is it doesn't recognize lower left and upper right quadrants, but besides that it works pretty well.

~Sandstorm


I didn't actually read all of that…I'm too tired, but I'll read it when I have some energy, but I can see what you're trying to say.

From: BazzBarrett
defonatly a good point, we need to make sure its random eg somtimes you overshoot your target and you bring your mouse back and im sure tehre is alreayd a procedure for this but to add it to the actual MMouse would be nice. the little jerk u make when u pick up the mouse. sorry for making you more work id do it but i cba :P


:norris:

From: Wizzup?
As far as I know WindMouse already does this. :)


WindMouse makes the moving of the mouse more random, but it does not visibly slow down as it approaches X and Y like a human would, and also doesn't sometimes overrun X and Y, like a human would. Don't get me wrong, WindMouse is great, but there is definitely room for improvement.

From: The Man
sorry to be offtopic but:
Mouse(x, y, Randx, Randy, true);
end else
Mouse(x, y, Randx, Randy, false);

:D

T~M
From: Sandstorm
T~M, what do you mean? If you mean that's a name, then yes. I live with someone named Randy.

~Sandstorm


Lame…:norris:

Wizzup?

2009-05-15 03:48:03

From: R1ch
WindMouse makes the moving of the mouse more random, but it does not visibly slow down as it approaches X and Y like a human would, and also doesn't sometimes overrun X and Y, like a human would. Don't get me wrong, WindMouse is great, but there is definitely room for improvement. :


I think it does, actually. I have never looked at the actual source much, but I have played around with the modifiers.
(It's fun to play around with them, eventually you can mod them so it never actually reaches the destination and only circles around it in a wind-alike way.)

Rich

2009-05-15 11:06:28

Hmm…I'll have a read of the source later on, but I personally have never seen it overrun X and Y, not saying you're wrong, of course.

Wizzup?

2009-05-16 02:26:32

From: R1ch
Hmm…I'll have a read of the source later on, but I personally have never seen it overrun X and Y, not saying you're wrong, of course.


You can say that I am wrong whenever you want. :)
I haven't looked at the source for quite some time, and I might be wrong.

Mystic

2009-05-16 03:11:58

Mmk, anyone know exactly how to use WindMouse?
procedure WindMouse(xs, ys, xe, ye, gravity, wind, minWait, maxWait, maxStep, targetArea: extended);
I've tried but can't seem to get it to work. Thanks!