pretty much a total newbie to AHK - I know basic programming and had a look at the documentation, and although a bit obtuse, I think I can manage.
However, my first project is a basic WASD key script for a game that uses only the arrow-keys for movement. Should be simple enough, but I've run into some issues and not sure if I've solved them the best way.
I am doing a simple map of WASD to the arrow keys. First I started with a simple Send, {Down} but apparently it didn't take, there seemed to be movement but it seemed to be slow, like only one keypress. I tested in another application (notepad) and pressing S did send downarrow commands while being held down. If I changed to Send,{Up down} it just held the key down (makes sense though).
So what finally worked was this:
Code: Select all
#IfWinActive The Operational Art of War
w::
Send,{Up down}
KeyWait, w
Send,{Up up}
Return
a::
Send,{Left down}
KeyWait, a
Send,{Left up}
Return
s::
Send,{Down down}
KeyWait, s
Send,{Down up}
Return
d::
Send,{Right down}
KeyWait, d
Send,{Right up}
Return
#IfWinActive
I think (a theory) is that the game has some sort of keyboard code that interferes with AHK in some way.
Generally it's a bit weird, for instance after I remapped 'A' I thought I needed to remap the original A to Ctrl+A and then send A. But for some reason I didn't need to, Ctrl+A did what A originally did, some sort of 'fallback', I dunno.