I'm trying to turn on Scroll Lock key and turn it off when Right click Button is released or after Z key be pressed and released.
In the game, I need to press and hold right click button to aim and press Z to zoom in / press it again to zoom out or release right click button to zoom out and stop aiming.
So, basically when I'm not aiming or I'm not zooming in, I'd like to turn off Scroll Lock key. And when I am aiming I'd like to wait zoom in to turn Scroll Lock key on.
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.
#If WinActive("Rise of the Tomb Raider") && ( RButtonState = D )
~z::SetScrollLockState,On
#If WinActive("Rise of the Tomb Raider") && GetKeyState("ScrollLock", "T") && ( RButtonState = D )
KeyWait, RButton
~z::SetScrollLockState,Off
I've also tried the following:
Code: Select all
#If WinActive("Rise of the Tomb Raider") && GetKeyState("ScrollLock", "T") && ( RButtonState = D )
KeyWait, RButton
KeyWait, z
SetScrollLockState,Off