Sign in to follow this  
Followers 0
hxhjx

Realistic MouseMove

15 posts in this topic

hi,

first of all english is not my main language. to my topic:

i already wrote some programms with autoit. but in my actual project i try to copy human mouse behaviour.

for example if i use autoit's mouseMove function it works perfect from the functional view. but i want a kind

of "human" mouse behaviour. i made a little picture to explain exactly what i mean

post-29189-1259231764243_thumb.jpg

the first line is ofc selfmade :) . the second one is made per computer. the computer line i have made with photoshop. (i know autoit has not a linear line but its like one). so is there already a kind of... "function" or "api" for human mouse behaviour?

if not maybe anyone have an idea how to solve this. I know ofc that it has something todo with Random(x,y) but maybe already someone thought about this problem and made an algorythm.

ps: alread used the search function with "MOUSE" and "REALISTIC". if there is already topic like this WITH A SOLUTION would be nice if you can post the link.

regards hxhjx

Share this post


Link to post
Share on other sites



hxhjx,

Could you please explain why you need this "human mouse behaviour"? I can think of a number of reasons but I would like to hear from you directly. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

hi,

thanks for you fast reply. i want to make a kind of anti cheat engine for a primitive game. i already have statistiks for "programm"-mouse moves. and need i detailed statistik on "human"-mouse moves.

and i also want to use it on a older project for drawing realistic images which are not perfect :)

ps: i am already really interested in any solutions for this "problem".

pss: "I can think of a number of reasons but I would like to hear from you directly.", ofc not a aimbot or something like that. would be to ineffectiv and would cause some problems with "following" a colour.

Edited by hxhjx

Share this post


Link to post
Share on other sites

hxhjx,

Here is a way to "randomise" the movement of the mouse as it travels between 2 points:

$iStart_X = 100
$iStart_Y = 100

$iEnd_X = 400
$iEnd_Y = 300

$nIncrement_X = ($iEnd_X - $iStart_X) / ($iEnd_Y - $iStart_Y)
$nIncrement_Y = ($iEnd_Y - $iStart_Y) / ($iEnd_X - $iStart_X)

; Most direct route
$nMouse_X = $iStart_X
$nMouse_Y = $iStart_Y
Do
    $nMouse_X += $nIncrement_X
    $nMouse_Y += $nIncrement_Y
    MouseMove(Int($nMouse_X), Int($nMouse_Y), 10)
Until $nMouse_X >= $iEnd_X Or $nMouse_Y >= $iEnd_Y

; Randomised route
$nMouse_X = $iStart_X
$nMouse_Y = $iStart_Y
Do
    $nMouse_X += $nIncrement_X * (Random(.5, 1.5))
    $nMouse_Y += $nIncrement_Y * (Random(.5, 1.5))
    MouseMove(Int($nMouse_X), Int($nMouse_Y), 10)
Until $nMouse_X >= $iEnd_X Or $nMouse_Y >= $iEnd_Y

You can easily change the degree of "randomness" by altering the Random parameters.

I am not sure that it makes the movement any more "human" - just a bit less direct. :) But if it is of use.....

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

I found this in my archiv ;-)

; Smoother Mouse Move
; by the DtTvB

; Ease in function
func __calci1($i, $sm)
    return $i ^ $sm;
endFunc

; Ease out function
func __calci2($i, $sm)
    return 1 - ((1 - $i) ^ $sm);
endFunc

; Ease in out function
func __calci($i, $sm)
    if ($i < 0.5) then
        return __calci1($i * 2, $sm) / 2;
    else
        return (__calci2(($i - 0.5) * 2, $sm) / 2) + 0.5;
    endIf
endFunc

; Ease backward function
func __calof($i, $sm)
    if ($i < 0.5) then
        return __calci($i * 2, $sm);
    else
        return __calci((1 - $i) * 2, $sm);
    endIf
endfunc

; MAIN FUNCTION
func mouseMove2($x2, $y2)
    $x1 = mouseGetPos(0);
    $y1 = mouseGetPos(1);
    $xv = random(-100, 100);
    $yv = random(-100, 100);
    $sm = random(1.5, 2.5);
    $m = random(50, 160);
    for $i = 0 to $m
        $ci = __calci($i / $m, $sm);
        $co = __calof($i / $m, $sm);
        $cx = $x1 + (($x2 - $x1) * $ci) + ($xv * $co);
        $cy = $y1 + (($y2 - $y1) * $ci) + ($yv * $co);
        mouseMove ($cx, $cy, 1);
    next
endFunc

; Test Script
mouseMove2 (512, 386);

Edit:

Here the post.

mousemove2

Edited by Tec

Share this post


Link to post
Share on other sites

really nice scripts. but the first from " Melba23" doesnt work o0

output: post-29189-12592435670646_thumb.jpg

the other funktion from "Tec" is really good too but its just a curve :)

any other ideas / code / advises?

Share this post


Link to post
Share on other sites

hxhjx,

What "doesn't work"? And where did you get the "output"? My code just moves the mouse. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Got a PM.

hi ,

in read in a topic that u created a random mousemovement (looks like human mouse move) for a game. maybe you can send me that part code?

in dont come to a solution... :)

I told him I wouldn't give out the source.

Just so everyone knows.

Edited by Manadar

Share this post


Link to post
Share on other sites

well i put in this code

Sleep(5000)
    MouseDown("left")   
    
    
    $iStart_X = 142
    $iStart_Y = 699

    $iEnd_X = 962
    $iEnd_Y = 190

    $nIncrement_X = ($iEnd_X - $iStart_X) / ($iEnd_Y - $iStart_Y)
    $nIncrement_Y = ($iEnd_Y - $iStart_Y) / ($iEnd_X - $iStart_X)

    ; Most direct route
    $nMouse_X = $iStart_X
    $nMouse_Y = $iStart_Y
    Do
        $nMouse_X += $nIncrement_X
        $nMouse_Y += $nIncrement_Y
        MouseMove(Int($nMouse_X), Int($nMouse_Y), 10)
    Until $nMouse_X >= $iEnd_X Or $nMouse_Y >= $iEnd_Y

    ; Randomised route
    $nMouse_X = $iStart_X
    $nMouse_Y = $iStart_Y
    Do
        $nMouse_X += $nIncrement_X * (Random(.5, 1.5))
        $nMouse_Y += $nIncrement_Y * (Random(.5, 1.5))
        MouseMove(Int($nMouse_X), Int($nMouse_Y), 10)
    Until $nMouse_X >= $iEnd_X Or $nMouse_Y >= $iEnd_Y

    MouseUp("left")

and the output is:

post-29189-12592456367416_thumb.jpg

the red one should be the direct way... black one is your script

Share this post


Link to post
Share on other sites

Got a PM.

I told him I wouldn't give out the source.

Just so everyone knows.

Editing PM's lol. nice function. just for correctness you told me "do you think i have the src after 3 years"

Just so everyone knows.

regards hxhjx

Share this post


Link to post
Share on other sites

hxhjx,

Well, it works for me. :)

I did not put in any errorchecking and the script "assumes" that the mouse will move right and down - perhaps if you swapped the Y-coordinates?

Anyway, I bow out now.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

hxhjx,

Well, it works for me. :)

I did not put in any errorchecking and the script "assumes" that the mouse will move right and down - perhaps if you swapped the Y-coordinates?

Anyway, I bow out now.

M23

"script "assumes" that the mouse will move right and down" , thats the problem ;) well primary i will take the function supplied by tec. but i will figure out a way to simulate user mouse moves. i will provide the code if i am finished.

regards hxhjx

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

Editing PM's lol. nice function. just for correctness you told me "do you think i have the src after 3 years"

How am I supposed to guess you've read it already? I can change my mind in what to say, so I just edit the PM. Don't try to make it seem like I twist my words around to make you look stupid, because I don't, and you already do so yourself.

Beside that, as far as I am considering you were asking for help with your code in a PM. A very rude thing that can get you banned, easily. If anything, you can consider yourself lucky that I didn't click the report button and decided to reply to you.

Edited by Manadar

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

How am I supposed to guess you've read it already? I can change my mind in what to say, so I just edit the PM. Don't try to make it seem like I twist my words around to make you look stupid, because I don't, and you already do so yourself.

Beside that, as far as I am considering you were asking for help with your code in a PM. A very rude thing that can get you banned, easily. If anything, you can consider yourself lucky that I didn't click the report button and decided to reply to you.

well if it is a problem for you people which are new to this community (not autoit itself) ask for help per pm then press your shiny report button. and how can i ask for help for my code if there is no code ?! lol

about PM editing. i never saw a board before or any other "community"-system where u can edit pm's. and when u edit them... well then it looks like twisting words. but i dont want my post to look offensive. if you had that in mind i need to say sorry about that

i have no programm i just try to put out a usefull (not only for me, also for the community) code for "human" mouse behaviour.

regards hxhjx

EDIT: maybe my miss of english vocabularys made you missunderstanding me. then i am sry too :)

Edited by hxhjx

Share this post


Link to post
Share on other sites

hi,

i am working on a combination of the two scripts above. of course if this is no problem for one of them :). this is a kind of "bump". maybe any other autoit scripter already wrote this and can post it here.

regards hxhjx

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0