I am a rookie to AHK but am loving it nonetheless.
Currently I'm trying to block the WASD keys during gaming unless I have pressed x within the last 500MS. Currently I am using the quote below
The above works but it is clunky, cumbersome and in general not responsive enough for gaming. I have a feeling there is a much simpler way to do this but after spending the last day pouring through AHK forum posts and tutorials I am stumped. Any assistance that could be provided would be wonderful.#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.
#Persistent
w::
{
if (A_TickCount - tc <500)
{
sendinput {w down}
sleep 40
sendinput {w up}
}
KeyWait, X , D
tc:=A_TickCount
return
}
a::
{
if (A_TickCount - tc <500)
{
sendinput {a down}
sleep 40
sendinput {a up}
}
KeyWait, X , D
tc:=A_TickCount
return
}
s::
{
if (A_TickCount - tc <500)
{
sendinput {s down}
sleep 40
sendinput {s up}
}
KeyWait, X , D
tc:=A_TickCount
return
}
d::
{
if (A_TickCount - tc <500)
{
sendinput {d down}
sleep 40
sendinput {d up}
}
KeyWait, X , D
tc:=A_TickCount
return
}
Thanks!
James