Moving the Mouse Down for a Few Seconds

Ask gaming related questions
pimpinjuice
Posts: 2
Joined: 26 Jan 2016, 14:24

Moving the Mouse Down for a Few Seconds

26 Jan 2016, 14:30

Hey guys,

Working on a script that can move the mouse down for three or four seconds. The script will be used inside a game, and the goal is to get the camera looking directly downward.

Important note: The game is locking the cursor to the middle of the screen (I presume), and I have seen people post scripts with DllCall + "mouse_event", and I've seen people post scripts with MouseMove. Just looking to have enough control to: ensure it happens long enough to have the camera looking directly downward.

Thanks for your help in advance!
User avatar
evilC
Posts: 4783
Joined: 27 Feb 2014, 12:30

Re: Moving the Mouse Down for a Few Seconds

26 Jan 2016, 14:47

MouseMove is fundamentally to do with cursor position on the screen (even with the R option) - therefore, if you use MouseMove to move the mouse down 10 pixels, and the mouse cursor is already at the bottom of the screen, it does nothing.
Furthermore, many games are utterly unconcerned by the position of the desktop cursor - instead they read raw "delta" information, which is the actual signals coming from the mouse. These will typically be small and frequent (ie if you move 10 units in 100ms, it would report something like 10 moves of 1 unit, once every 10ms).

So I would recommend mouse_event, its very simple to use and much more useful in these situations. You may well have to call it multiple times in a loop (eg 100 small moves of 1 instead of 1 move of 100) but that's real simple.
pimpinjuice
Posts: 2
Joined: 26 Jan 2016, 14:24

Re: Moving the Mouse Down for a Few Seconds

26 Jan 2016, 14:51

Thanks for the quick response. Would I have to Sleep within my loop between each small movement?
I presume within the loop, I would just call the code below with x=0 and y=1 or y=-1 (depending on which one works to move the camera downward)
DllCall("mouse_event", uint, 1, int, x, int, y, uint, 0, int, 0)

Return to “Gaming”

Who is online

Users browsing this forum: TheProdigyC2 and 15 guests