SRL Archive - Discussions & Debates

Humanlike mousing


Floor66

2011-03-28 16:54:32

Weird title but what the heck. Anyway, SRLs mouse funcs are as we all know a huge improvement to ClickMouse etc. but it still isnt really humanlike. It's too much of "move from pt a to pt b". Try to record yourself playing. Do you do that? I dont, I usually move from pt a to somewhere near b (call it c, if you will) and THEN move to b.

Also, after clicking an object, do you keep your mouse there, still? I know that I usually twitch somehow :p

Take a look at RobotzInDisguise. I purchased their PC bot and o boy is that mouse humanlike. Try their free bots, judge by yourself.

Tl;dr: lets make pr0 humanlike mouse funcs.

Ps: typed on my ipod so might have typos

ridvid:
http://www.youtube.com/watch?v=N7N3iQEZlqc

i luffs yeww

2011-03-28 17:02:39

The problem you brought up about moving from point a to near point b © and then move back to point b is bad scripting, not SRLs fault. I know what you're talking about and it is a problem, but more so with teaching people how to utilize SRL than with SRL itself.

I do think a better mouse function could be fun to mess with (purely for debugging/programming amusement), but I don't think it's really necessary.

kitchenrange

2011-03-28 17:49:24

I think you misunderstood him. He would prefer it to move to point c first.

Also better mouse functions would be worth a hell of a lot more than amusement. I've also noticed the differences in some of the paid bots mouse movement. It is much much more advanced. I'm not sure if they are using the gaussian(sp?) way or what but it kicks ass and we need to get on it.

Rich

2011-03-28 17:55:56

Posted ages ago.

i luffs yeww

2011-03-28 18:00:56

The phenomena he's talking about is the combination between MMouse and Mouse.


MMouse(50, 50, 4, 4);
if(IsUpText('aw lobster'))then //See, Zyt3x? People don't use full words 100% of the time. ;D
//begin
// GetMousePos(x, y);
// Mouse(x, y, 0, 0);
//end;
Mouse(50, 50, 4, 4, True); //Take this out if you remove the comments, obvi.

If you just add the commented lines it will go to "point c" first and not do the whole three movements for a click.

Also, there are a handful of valid Gaussian mouse functions on SRL already. They just haven't been added to SRL. And I don't see why it'd be better than amusement. Our ban rate is low with the mouse we've used for ages. Changing it won't make a noticeable difference (and it wouldn't be valid data really.. too many variables and unknowns). Personalization/accuracy is still something I think would be cool.

TomTuff

2011-03-28 20:19:36

Guess which one is me and which is MMouse? I like our mouse functions.

HarryJames

2011-03-28 20:21:11

First one is bot.
Second one is you?

Flight

2011-03-28 21:51:34

Your problem is the MMouse procedure. It uses Windmouse, which is effected by static Wind and Gravity factors. Because by default, gravity is higher than wind in the MMouse procedure, there's not much curve getting from point A to B.

Try this this out:
{*******************************************************************************
Procedure HumanMouse;
By: Flight
Description: Random human-like mouse movement
*******************************************************************************}
Procedure HumanMouse;
var
randSpeed: extended;
x, y, firstSpeed: integer;
begin
if IsMining then begin
case(Random(10000)) of
9901..9999:
begin
firstSpeed := mouseSpeed;

mouseSpeed := RandomRange(3,5);
randSpeed := (random(MouseSpeed) / 2.0 + MouseSpeed) / 10.0;
GetMousePos(x, y);
{
We make the wind higher than gravity to give more curve, this is what
MMouse lacks...
}
WindMouse(x, y, RandomRange(x - 75, x + 75), RandomRange(y - 75, y + 75),
30, 55, 10.0 / randSpeed, 12.0 / randSpeed, 10.0 * randSpeed, 10.0 * randSpeed);

mouseSpeed := firstSpeed;
end;
end;
end;
end;

This uses a direct call to Windmouse, not relying on the standard MMouse. Now, after you've given that a test run, try increasing the speed and you'll see a dramatic improvement in the curve.


Nava2

2011-03-29 00:23:14

I'll just leave this here…

http://villavu.com/forum/showthread.php?t=58305

TomTuff

2011-03-29 00:53:32

http://villavu.com/forum/showthread.php?t=59944

More specifically:

{===============================================================================
function InfGM_GaussFunction : Integer;
By: Cstrike
Acts as a gaussian function. Is a pre-determined one for easy on-the-fly result.
===============================================================================}
function InfGM_GaussFunction : Integer;
var coefficient : Integer;
begin
case random(30) of
0: coefficient := 100;
1: coefficient := 99;
2: coefficient := 97;
3: coefficient := 96;
4: coefficient := 92;
5: coefficient := 91;
6: coefficient := 88;
7: coefficient := 87;
8: coefficient := 84;
9: coefficient := 82;
10: coefficient := 80;
11: coefficient := 78;
12: coefficient := 74;
13: coefficient := 72;
14: coefficient := 69;
15: coefficient := 67;
16: coefficient := 64;
17: coefficient := 62;
18: coefficient := 60;
19: coefficient := 58;
20: coefficient := 54;
21: coefficient := 48;
22: coefficient := 46;
23: coefficient := 36;
24: coefficient := 28;
25: coefficient := 21;
26: coefficient := 16;
27: coefficient := 12;
28: coefficient := 7;
29: coefficient := 4;
30: coefficient := 0;
end;
result := 100-coefficient;
end;

{===============================================================================
function InfGM_GaussFunctionSmall : Integer;
By: Cstrike
See above, though if the mouse values are small this takes it into account.
===============================================================================}
function InfGM_GaussFunctionSmall : Integer;
var coefficient : Integer;
begin
case random(30) of
0: coefficient := 100;
1: coefficient := 98;
2: coefficient := 95;
3: coefficient := 92;
4: coefficient := 90;
5: coefficient := 85;
6: coefficient := 82;
7: coefficient := 80;
8: coefficient := 76;
9: coefficient := 74;
10: coefficient := 71;
11: coefficient := 68;
12: coefficient := 66;
13: coefficient := 64;
14: coefficient := 60;
15: coefficient := 67;
16: coefficient := 54;
17: coefficient := 52;
18: coefficient := 50;
19: coefficient := 48;
20: coefficient := 44;
21: coefficient := 40;
22: coefficient := 35;
23: coefficient := 30;
24: coefficient := 25;
25: coefficient := 21;
26: coefficient := 16;
27: coefficient := 12;
28: coefficient := 7;
29: coefficient := 4;
30: coefficient := 0;
end;
result := 100-coefficient;
end;

{===============================================================================
procedure InfGM_GMouse (x, y, xR, yR : Integer; LeftClick : Boolean);
By: Cstrike
Using the gaussian function, clicks mouse at center point and random deviates
both up/down/left/right from the center based on a random gaussian value.
Idea originally thought of to my knowledge by Xtensity. I didn't use this code
though, since I couldn't convert it to a useable format.
===============================================================================}
procedure InfGM_GMouse (x, y, xR, yR : Integer; LeftClick : Boolean);
var xP, yP, xnew, ynew, xpos, ypos : Integer;
begin
if (x < 5) then xP := InfGM_GaussFunctionSmall else xP := InfGM_GaussFunction;
if (y < 5) then yP := InfGM_GaussFunctionSmall else yP := InfGM_GaussFunction;
xnew := round((xR*xP)/100.0);
ynew := round((yR*yP)/100.0);
case random (5) of
0..2 : xpos := x + xnew;
3..5 : xpos := x - xnew;
end;
case random (5) of
0..2 : ypos := y + ynew;
3..5 : ypos := y - ynew;
end;
Mouse (xpos, ypos, 0, 0, LeftClick);
end;

{===============================================================================
procedure InfGM_GMMouse (x, y, xR, yR : Integer);
By: Cstrike
See InfGM_GMouse.
===============================================================================}
procedure InfGM_GMMouse (x, y, xR, yR : Integer);
var xP, yP, xnew, ynew, xpos, ypos : Integer;
begin
if (x < 5) then xP := InfGM_GaussFunctionSmall else xP := InfGM_GaussFunction;
if (y < 5) then yP := InfGM_GaussFunctionSmall else yP := InfGM_GaussFunction;
xnew := round((xR*xP)/100.0);
ynew := round((yR*yP)/100.0);
case random (5) of
0..2 : xpos := x + xnew;
3..5 : xpos := x - xnew;
end;
case random (5) of
0..2 : ypos := y + ynew;
3..5 : ypos := y - ynew;
end;
MMouse (xpos, ypos, 0, 0);
end;

{===============================================================================
function InfGM_GMouseFail (x, y, xMax, yMax, xOutsideBounds, yOutsideBounds : Integer) : Boolean;
By: Cstrike
Purposely fails to act human, then clicks in the specified range. Returns true
if left click, false if right click
===============================================================================}
function InfGM_GMouseFail (x, y, xMax, yMax, xOutsideBounds, yOutsideBounds : Integer) : Boolean;
var cx, cy, xP, yP, xnew, ynew, xpos, ypos : Integer;
begin
Result := False; // Guess it doesnt matter
if (x < 5) then xP := InfGM_GaussFunctionSmall else xP := InfGM_GaussFunction;
if (y < 5) then yP := InfGM_GaussFunctionSmall else yP := InfGM_GaussFunction;
xnew := round((xOutsideBounds*xP)/100.0);
ynew := round((yOutsideBounds*yP)/100.0);
case random (5) of
0..2 : xpos := x + xnew;
3..5 : xpos := x - xnew;
end;
case random (5) of
0..2 : ypos := y + ynew;
3..5 : ypos := y - ynew;
end;

// If were inside the normal range... [Need to fix this]
if (xpos <= xMax) and (ypos <= yMax) then
begin
Mouse (xpos, ypos, 0, 0, false) // Needs to be fixed to include -ve's
Result := False;
end else // else if were outside
begin
case random(11) of
0..3: begin
Mouse (xpos, ypos, 0, 0, true);
wait (55+random(53));
InfGM_GMouse (x, y, xMax, yMax, true);
Result := True;
end;
4..11: begin
Mouse (xpos, ypos, 0, 0, false);
wait (185+random(153));
GetMousePos(cx, cy);
MMouse (cx + RandomRange(70,130), cy + RandomRange(-150, 150), 0, 0);
wait (115+random(155));
InfGM_GMouse (x, y, xMax, yMax, false);
Result := False;
end;
end;
end;
end;

Permission was given by Cstrike upon his departure to use his code.

cycrosism

2011-03-29 01:03:29

Yeah I do not really like the Mouse function, my brother was using MSI and after watching it for 15 minutes he never used it again he said the mouse kept "teleporting" while he was powercutting, in other words it kept jumping to the location really fast, while it was dropping the logs and stuff.

I told him to use RSbot instead

Coh3n

2011-03-29 02:33:07

From: cycrosism
Yeah I do not really like the Mouse function, my brother was using MSI and after watching it for 15 minutes he never used it again he said the mouse kept "teleporting" while he was powercutting, in other words it kept jumping to the location really fast, while it was dropping the logs and stuff.

I told him to use RSbot instead

LOL.

You talking about moving from log to log really fast when dropping? I think if you watch yourself drop a full inventory, you go a lot faster than you'd think.

I would very much like to see a mouse function written that works like RiD.

Floor66

2011-03-29 02:52:05

Wow a lot of response :P Nice to wake up like this!

@i luffs yew;
I'm not implying we replace SRL's mouse, just saying I might try to develop my own that's like RiDs mouse.

I tried cstrike's code, looks nice but not what I mean.

I'll put up a vid shortly of what I mean. of RiD :P

Gu3st...

2011-03-29 02:58:37

I agree with Coh3n :)

i luffs yeww

2011-03-29 02:58:48

I know what RID's mouse is like. CX Gamer had some good Gaussian functions iirc.

cycrosism

2011-03-29 05:43:41

From: Coh3n
You talking about moving from log to log really fast when dropping? I think if you watch yourself drop a full inventory, you go a lot faster than you'd think.


I don't teleport my mouse to the log and then teleport it to the drop button

Floor66

2011-03-29 09:29:13

YouTube vid of RiD's mouse for those of you who didn't try it yet:
http://www.youtube.com/watch?v=N7N3iQEZlqc
(it's a bit laggy because I was running some RAM intensive stuff)
Still processing too (3:28pm gmt+1)

Coh3n

2011-03-29 10:35:45

From: cycrosism
I don't teleport my mouse to the log and then teleport it to the drop button

Well you must move your mouse pretty slow then because I don't see anything wrong with SRL's dropping routines.

i luffs yeww

2011-03-29 13:17:36

From: Floor66
YouTube vid of RiD's mouse for those of you who didn't try it yet:
http://www.youtube.com/watch?v=N7N3iQEZlqc
(it's a bit laggy because I was running some RAM intensive stuff)
Still processing too (3:28pm gmt+1)


WOOOOOOOOOOOOOOOOOOOOOOOOOW. Not about the mouse, but about how crappy that bot runs. :x I'm very unimpressed with that bot..

The mouse is fine, but the bot seemed pretty non-dynamic. I wouldn't pay money for that tbh. :/

Coh3n

2011-03-29 13:22:38

I actually think it would be pretty easy to make a mouse function like that. Test out SleepAndMoveMouse. We could easily go off that to make it almost exactly the same. Come to think of it, the mouse movements look more like antiban then anything.

Floor66

2011-03-29 14:00:38

From: i luffs yeww
WOOOOOOOOOOOOOOOOOOOOOOOOOW. Not about the mouse, but about how crappy that bot runs. :x I'm very unimpressed with that bot..

The mouse is fine, but the bot seemed pretty non-dynamic. I wouldn't pay money for that tbh. :/


lolz that was just 1 crap round. it was just about the mouse. it does better.

footballjds

2011-03-29 14:45:20

From: Coh3n
I would very much like to see a mouse function written that works like RiD.


From: Zyt3x
I agree with Coh3n :)

absolutely!!

From: i luffs yeww
I know what RID's mouse is like. CX Gamer had some good Gaussian functions iirc.

lets see it then? (:
From: cycrosism
I don't teleport my mouse to the log and then teleport it to the drop button

you should use mouse-keys then, and teleport ;)

i luffs yeww

2011-03-29 14:47:55

Well Nava posted the other thread with a lot of different functions to choose from.

Here's CX's thread. http://villavu.com/forum/showthread.php?t=58179

In case you can't scroll, here's the thread Nava posted in this thread. http://villavu.com/forum/showthread.php?t=58305

Boreas

2011-03-29 18:42:10

If anyone gets their account banned due to SRLs Mouse, I will give them another one.

i luffs yeww

2011-03-29 18:45:48

From: Boreas
If anyone gets their account banned due to SRLs Mouse, I will give them another one.


Another account or another Mouse procedure? :p

Nava2

2011-03-29 19:32:15

Am I the only one that does not see anything different with the RiD mouse?

TomTuff

2011-03-29 20:43:33

From: Nava2
Am I the only one that does not see anything different with the RiD mouse?


Yes, you are.

As for whoever posted that video, make sure javaw.exe is set to Real Time priority in task manager :) It runs much much much better that way - MUCH.

lordsaturn

2011-03-29 21:38:10

From: Nava2
Am I the only one that does not see anything different with the RiD mouse?


The RiD mouse misses then comes back. I think it changes speed a lot too.

Boreas

2011-03-29 23:15:58

From: i luffs yeww
Another account or another Mouse procedure? :p[/QUOTEE]

Either. Both. Both plus a plate of cookies. Doesn't matter because it's not going to happen.

footballjds

2011-03-29 23:32:39

[all haters kill me]Timer's R_MoveMouse is pretty nice[/all haters kill me]

TomTuff

2011-03-29 23:58:36

From: footballjds
[all haters kill me]Timer's R_MoveMouse is pretty nice[/all haters kill me]


It's RSBot's Function converted into PS - which BenLand also wrote afaik.

Nava2

2011-03-30 00:06:16

From: TomTuff
It's RSBot's Function converted into PS - which BenLand also wrote afaik.


They used the WindMouse procedure found in many many bots. I would not be surprised if RiD uses the same one.

cycrosism

2011-03-30 01:09:01

From: Coh3n
Well you must move your mouse pretty slow then because I don't see anything wrong with SRL's dropping routines.


Don't ask the developer whats wrong, ask the user ;)

Edit: Never ask a developer what is wrong with his program/solution. It's up to the user to decide whether it is good or not. I mean could you imagine if you wanted a website created and you said you didn't like something and the web developer says "I don't see anything wrong with it"?

yosupg

2011-03-30 14:03:00

Quick question, is there any way to recognize if the bot has clicked on a rock or not while moving, it seems if it misses, it'll just sit patiently as if your actually mining, i guess im asking if you could use the mouse to atleast check if ur avatar is even next to a rock or not during the "mining time"

i luffs yeww

2011-03-30 14:05:20

The IsAnimating method could be used for color, but it would give false positives a lot. In reflection you can check easily if you're doing the correct animation.

Floor66

2011-03-30 14:13:23

From: yosupg
Quick question, is there any way to recognize if the bot has clicked on a rock or not while moving, it seems if it misses, it'll just sit patiently as if your actually mining, i guess im asking if you could use the mouse to atleast check if ur avatar is even next to a rock or not during the "mining time"


You can use "DidRedClick" to determine whether you clicked on an object or not.

Echo_

2011-03-31 10:06:44

From: Floor66
You can use "DidRedClick" to determine whether you clicked on an object or not.


Or animation detection through reflection.

Floor66

2011-03-31 10:16:50

Or instead of that (because it's mining; the animation doesn't stop, even if there's no more ore), check for a difference in the ID of the rock you're mining.

footballjds

2011-03-31 10:20:15

From: Echo_
Or animation detection through reflection.

then use reflection :D

{*******************************************************************************
function r_WaitCrossHairColor(CrossColor: Integer; Time: Integer): Boolean;
By: pyroryan & Naike
Description: Each crosshair stays up for about 500 milliseconds
CROSSHAIR_RED: clicked on something (red crosshairs).
CROSSHAIR_YELLOW: clicked on ground (yellow crosshairs).
CROSSHAIR_NONE: nothing (no crosshairs)
Waits for a crosshair color to appear.
*******************************************************************************}
function r_WaitCrossHairColor(CrossColor: Integer; Time: Integer): Boolean;
var
T: Integer;
begin
Result := False;
T := GetSystemTime + Time;
while (GetSystemTime < T) do
begin
if (r_GetCrossHairColor = CrossColor) then
begin
Result := True;
Exit;
end;
Wait(20 + Random(10));
end;
end;

Flight

2011-03-31 11:06:25

From: yosupg
Quick question, is there any way to recognize if the bot has clicked on a rock or not while moving, it seems if it misses, it'll just sit patiently as if your actually mining, i guess im asking if you could use the mouse to atleast check if ur avatar is even next to a rock or not during the "mining time"


Here's what I use in my code to tell me if we're mining or not. It's bullet-proof. The "Temp_ID" is declared when you initially click your rock object, then that ID is used to tell if the rock is still their 'after' we've clicked it. If it is and we get one of those 3 messages then yes, we're mining, if the rock id has changed since we started mining, then no we are not mining and we should find a new rock. :garfield:

Function IsMining: Boolean;
begin
Result := False;
if (FindRSObjectSimple(Temp_ID)) then //Is the obj still there?
begin
if (CharacterMoving Or
FindBlackChatMessage('You swing') Or //Started mining
FindOrangeChatMessage('Your ring') Or //Ring of wealth helping
FindBlackChatMessage('You just')) then //Found a gem
Result := True;
if InvFull or R_InvFull then //Fixes a small gem-related bug
Result := False;
end;
end;

tofurocks

2011-03-31 13:19:15

Anyone who has used RiD for a reasonable amount of time will know that it's dirt.
It's pure colour implemented terribly with overcompensating anti-ban.
I had trouble running it for an hour at a time when I owned their smelter.

Floor66

2011-03-31 13:21:37

From: tofurocks
Anyone who has used RiD for a reasonable amount of time will know that it's dirt.
It's pure colour implemented terribly with overcompensating anti-ban.
I had trouble running it for an hour at a time when I owned their smelter.


Well I've used the smelter for over 100 hours now and I've never had any errors that weren't fixed within 24 hours…

grats

2011-04-02 09:47:38

From: Nava2
I'll just leave this here…

http://villavu.com/forum/showthread.php?t=58305


I really liked reading that one, the idea of slightly more common misclicks is good, I do misclick a lot playing legit… especially when dropping stuff