How to autofire F in Autohotkey

autohotkeypsychonauts

The Dowsing Rod requires you to spam the use (F) key while looking for deep arrowheads. Spamming keys sucks. You wouldn't really need it if sound was enough clue to go on (the PS2 version made your controller rumble when in position), but it turns out it's not.

AutoHotKey should be able to make it much easier on my fingers. Something such as this should suffice:

$f::
While GetKeyState("f","P")
 Send f
return

It works in all places but Psychonauts. I've tried the SendPlay, the SendInput, the SendMode Play, the SetKeyDelay workarounds suggested here to no avail.

How can I make searching with the dowsing rods less tedious?

Best Answer

I tried a different approach with the "automatic shooting" function that JoyToKey offers, but the problem seems to be in Psychonauts itself. While it does register keys remapped through JoyToKey, it does not accept repeated inputs without registering a release of the button you pressed.

This led me to the idea to send raw input events, which works. In this AHK example I just assigned the hotkey CTRL-r to make Raz jump 20 times.

^r::
Loop 20
{
    Send {Space down}
    Sleep 10
    Send {Space up}
    Sleep 1000
}
return

Should work with any other key as well.