Simple hold key code. A better solution?
Posted: 16 Mar 2018, 15:36
This is a basic working code, which I use to circumvent (and unify) bad controls for racing games as they all have at least keyboard support. Joy18 acts as a modifier that makes joy22 either do a single action (f), or a continuous hold (a) as long as joy22 is pressed. Ideally it should stop without the modifier. But it works good enough.
Anyway, I have only basic understanding of AHK, or any sort of programming for that matter, so i was wondering if there is a more elegant or resource efficient solution to this?
Anyway, I have only basic understanding of AHK, or any sort of programming for that matter, so i was wondering if there is a more elegant or resource efficient solution to this?
Code: Select all
$5joy22::
{
if GetKeyState("5joy18","p")
{
while GetKeyState("5joy22","p")
send {a down}
sleep 50
send {a up}
}
else
{
send {f down}
sleep 50
send {f up}
}
}
return