SetTimer, testFunction, 10 something = 1 return testFunction: if (something == 1) { send {e down} } return

Ignore certain physical keypresses while function is holding a key to make sure the hold is uninterupted by the other keys

Best Answer Exaskryz , 02 October 2015 - 12:20 AM

Try this:
SetTimer, testFunction, 10 something = 1 return F1::something:=!something ; changes the value between 1 and 0 testFunction: if (something=1) { send {e down} } else ; something != 1 { send {e up} } return #If something=1 w::return a::return s::return d::return
#If directive

wooot so thats how that #if works, i was already using it for #if winactive but never realized that it could be applied to hotkeys too and not error out on duplicate hotkey when i remap the same hotkeys outside of it later in the script. thats cool, now i assume if i want to use it for your example but iam already inside an #if winactive(...) zone, it cannot be nested but instead will overrule the previous winactive so i guess i need to redeclare #if winactive(...) right after your snippet to keep the code specific to my application.
either way, while messing around with your suggestion it led me to realize that the problem was partially somewhere else, in the game setting itself, so now after all i got both cleaner code and learnt something new, thanks!<3
(i really need to sit down with the whole ahk manual page by page one day and just mess around, so much untapped power)

For your question on combining conditions, you'd do something like this: #If (something=1) && WinActive("My Program")
.
And you're right, there is a lot that AHK can do.
