Centering Cursor Topic is solved

Ask gaming related questions
Bry

Centering Cursor

25 Feb 2018, 02:34

Hey, can someone make me a script that makes my cursor stays center of the screen, basically to stop my cursor to move from the center of the screen. A help would beappreciated.
User avatar
Nwb
Posts: 444
Joined: 29 Nov 2016, 08:56

Re: Centering Cursor  Topic is solved

25 Feb 2018, 02:55

Try this. Press F1 to start/stop. And press esc when you want to exit the script.

edit: Update your script the variable had a syntax error and I forgot coordmode. :P

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#MaxThreadsPerHotkey 2

CoordMode, Mouse, Screen
toggle := 0

F1::
Toggle := !Toggle
While Toggle
{
    Mousemove, (A_ScreenWidth // 2), (A_ScreenHeight // 2)
    Sleep 50
}
return

esc:: ExitApp ; exits the script

	
Last edited by Nwb on 25 Feb 2018, 06:00, edited 3 times in total.
I am your average ahk newbie. Just.. a tat more cute. ;)
Bry

Re: Centering Cursor

25 Feb 2018, 02:58

Nwb wrote:Try this. Press F1 to start/stop. And press esc when you want to exit the script.

Code: Select all

F1::
Toggle = !Toggle
If Toggle
Loop
    {
    If not Toggle
break
    else 
    Mousemove, %A_ScreenWidth/2, %A_ScreenHeight/2
    Sleep 50
    }
return

esc:: ExitApp
Well thank you for the help but, when i tried to Run the script, the script error at line 9 Line Text "%A_ScreenWidth". I'm new to this scripting, any solution ?
User avatar
Nwb
Posts: 444
Joined: 29 Nov 2016, 08:56

Re: Centering Cursor

25 Feb 2018, 05:38

Bry wrote:
Nwb wrote:Try this. Press F1 to start/stop. And press esc when you want to exit the script.

Code: Select all

F1::
Toggle = !Toggle
If Toggle
Loop
    {
    If not Toggle
break
    else 
    Mousemove, %A_ScreenWidth/2, %A_ScreenHeight/2
    Sleep 50
    }
return

esc:: ExitApp
Well thank you for the help but, when i tried to Run the script, the script error at line 9 Line Text "%A_ScreenWidth". I'm new to this scripting, any solution ?
Okay try the new edited script. It should work perfectly now!
Press f1 to start centering your mouse and press f1 again if you want it to stop.
I am your average ahk newbie. Just.. a tat more cute. ;)

Return to “Gaming”

Who is online

Users browsing this forum: No registered users and 16 guests