Mouse move won't back to original psition

Ask gaming related questions (AHK v1.1 and older)
Zedroid
Posts: 3
Joined: 21 Oct 2018, 19:46

Mouse move won't back to original psition

21 Oct 2018, 19:55

So I've been trying to get this script work but it didn't

and after a few minutes is not going back to the original position(before the Script start)
can someone pls help me?

Here's the code

Code: Select all

toggle:=0

F8::
If toggle:=!toggle
SetTimer, Routine, 1000
else
SetTimer, Routine, Off
return

Routine:
Sleep,3000
Send, {XButton2}
MouseMove, 500, 0, 0, R
Sleep,26000
Send, {XButton2}
MouseMove, -500, 0, 0, R
return
Rohwedder
Posts: 7630
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Mouse move won't back to original psition

22 Oct 2018, 01:55

Hallo,
try:

Code: Select all

toggle:=0

F8::
If toggle:=!toggle
SetTimer, Routine, 1000
else
SetTimer, Routine, Off
return

Routine:
CoordMode, Mouse ,Screen
Sleep,3000
Send, {XButton2}
MouseGetPos, OldX, OldY
MouseMove, 500, 0, 0, R
Sleep,6000
Send, {XButton2}
MouseMove, %OldX%, %OldY%, 0
return
Zedroid
Posts: 3
Joined: 21 Oct 2018, 19:46

Re: Mouse move won't back to original psition

22 Oct 2018, 04:59

Rohwedder wrote:
22 Oct 2018, 01:55
Hallo,
try:

Code: Select all

toggle:=0

F8::
If toggle:=!toggle
SetTimer, Routine, 1000
else
SetTimer, Routine, Off
return

Routine:
CoordMode, Mouse ,Screen
Sleep,3000
Send, {XButton2}
MouseGetPos, OldX, OldY
MouseMove, 500, 0, 0, R
Sleep,6000
Send, {XButton2}
MouseMove, %OldX%, %OldY%, 0
return
Nope it didn't work
the mouse just only moved to the right
I'm Playing Gmod btw
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Mouse move won't back to original psition

22 Oct 2018, 05:09

What constitutes the "original position" in this scenario? The position when you first launched the script, or the position when you triggered the subroutine with F8. If it's the former, it can't be made to work with an fps game.
Zedroid
Posts: 3
Joined: 21 Oct 2018, 19:46

Re: Mouse move won't back to original psition

22 Oct 2018, 05:27

swagfag wrote:
22 Oct 2018, 05:09
What constitutes the "original position" in this scenario? The position when you first launched the script, or the position when you triggered the subroutine with F8. If it's the former, it can't be made to work with an fps game.
when I press the F8
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Mouse move won't back to original psition

22 Oct 2018, 11:38

in that case, unless u happen to manually move ur mouse cursor in-between these two commands

Code: Select all

MouseMove, 500, 0, 0, R
MouseMove, -500, 0, 0, R
should already return u to ur original position.

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 156 guests