Jump to content

A more natural mouse move [Resolved]


Recommended Posts

Hi all,

Is it possible to move the mouse more like a human does. Basically I would like to be able to move the mouse by giving it a direction, velocity, and duration of movement. Also I do NOT wish to use the mousemove() function to simulate this, as I am trying to avoid coordinates.

Any ideas?

Thanks,

-1

Edited by Negative1

What are we going to do tonight Brain?Same thing we do every night Pinky try to automate the world.

Link to comment
Share on other sites

You could set all the Mousemove options as variables defined by math functions then put in a loop to recalculate each time through the loop.

010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Link to comment
Share on other sites

You could set all the Mousemove options as variables defined by math functions then put in a loop to recalculate each time through the loop.

Thanks, but not really what I'm looking for as I'm trying to avoid using coordinates.

What are we going to do tonight Brain?Same thing we do every night Pinky try to automate the world.

Link to comment
Share on other sites

Thanks, but not really what I'm looking for as I'm trying to avoid using coordinates.

But MouseMove() uses coordinates so you have to use math, just like kaotkbliss said.

Edit: It has been done previously though, search the forum and you may find it.

Edited by AdmiralAlkex
Link to comment
Share on other sites

But MouseMove() uses coordinates so you have to use math, just like kaotkbliss said.

Edit: It has been done previously though, search the forum and you may find it.

I'm trying to avoid using mousemove() as the original post says.

Where do you plan on moving the mouse to if you dont need co-ordinates? If you dont mind me asking.

The code I have written knows the direction the mouse must move in. I have attempted using Mousemove() with coordinates relative to the current mouse position with no success. Thus I wish to avoid using any coordinate driving mouse commands if its possible.

What are we going to do tonight Brain?Same thing we do every night Pinky try to automate the world.

Link to comment
Share on other sites

What you have said earlier is irrelevant, you're going to use MouseMove() whether you like it or not.

You're telling me this entire community of brilliant minds has no way to move the mouse other then MouseMove()?

I'm just looking for a starting point and some idea of how much I would have to go through but to simply say it's not possible seams improbable, right?

What are we going to do tonight Brain?Same thing we do every night Pinky try to automate the world.

Link to comment
Share on other sites

MouseMove() must be used to move the mouse. Coordinates must be used with MouseMove(). You can move the mouse 'up, a little bit', or, 'down and to the left', but you have to use math to convert these statements to numbers that MouseMove understands.

This function, MouseGetPos, and some simple math, along with maybe something like the Random function, could do this..

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Link to comment
Share on other sites

You're telling me this entire community of brilliant minds has no way to move the mouse other then MouseMove()?

I'm just looking for a starting point and some idea of how much I would have to go through but to simply say it's not possible seams improbable, right?

Mouses work on x-y coordinates, so there's no way you're gonna avoid that, so you may as well use MouseMove() wince that a native function.

To make it look more natural you're gonna need some (a lot?) of math, but as that isn't my strong point I can't help you. But people have done this before, and there are examples on the forum. Someone just need to find them.

Link to comment
Share on other sites

Somewhere down the line a call will be made to the Windows API $MOUSEEVENTF_MOVE (mousemove)

Would it be any different if I use _winapi_mouse_event "move" rather than mousemove()?

What are we going to do tonight Brain?Same thing we do every night Pinky try to automate the world.

Link to comment
Share on other sites

Thank you all for your help!

Special thanks to JohnOne for dropping a hint that led me to my answer:

#Include <WinAPI.au3>
#include <Constants.au3>
_WinAPI_Mouse_Event($MOUSEEVENTF_MOVE,100,100)

The above code sends the mouse down and to the right (100)units. The units are relative to the mouses current position and (drum roll) windows mouse speed settings!!!!

-1

What are we going to do tonight Brain?Same thing we do every night Pinky try to automate the world.

Link to comment
Share on other sites

  • 1 year later...

Great, it worked for me too !!

Dead Island game, smooth keyboard and mouse move.

Also, relative mouse move.

Standard MouseGetPos is always 0, 0 !!

Look at me, I'm an idiot and post game automation code even though it's very clearly against the rules and stuff.

Edited by Valik
Removed code, added message.
Link to comment
Share on other sites

How would that be any different than

$pos = MouseGetPos()

MouseMove($pos[0]+100,$pos[1]+100)

*edit*

Just for fun

HotKeySet("{ESC}", "Terminate")
While 1
 Sleep(10)
 $ran = Random(-100,100,1)
 $ran2 = Random(-100,100,1)
 $pos = MouseGetPos()
 MouseMove($pos[0]+$ran,$pos[1]+$ran2)
WEnd
Func Terminate()
    Exit 0
EndFunc
Edited by kaotkbliss

010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Link to comment
Share on other sites

I read this thread because it was reported and i died a little inside. The OP screams they don't want to use coordinates... and then use coordinates. There's a certain bald captain of a starship facepalming right now.

Anyway, this thread is probably about game automation but I don't see evidence the OP is trying to do so. I do, however, see an idiot by the name of queensoft posting code that works with Dead Island. The last time I checked Dead Island was a game (I should know, I own it). I've adjusted the post accordingly. I'm tempted to lock the thread for it's complete stupidity (apparently velocity was all the OP was after but coordinates were the big no no, whatever). I'm not, though.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...