Page 1 of 1

Hard-coded toggle keys

Posted: 27 Sep 2018, 09:23
by Evil-e
I have lots FPS PC games in which I use crouch to hide behind cover. Unfortunately, many of them program this action as "toggled", so a second key press is necessary to stand up again.

I am looking for a way for AHK to convert this key to "momentary". I press "A" to crouch, but when I let go of this key, my character stands up. I have tried variations of the following script and does not work:

NOTE: I assigned "n" as crouch key in games menu, to hopefully avoid some code issues
--------------------------------------------------------------------

a::
Send {n down}
a up::
Send {n up}
return

--------------------------------------------------------------------

This script and all variations I tired not only fail to crouch at all, but send my character in a perpetual state of attack... lol

Can anyone help me to resolve this issue?

Thanks for reading, Eric :)

Re: Hard-coded toggle keys

Posted: 27 Sep 2018, 09:55
by swagfag

Code: Select all

a::
a Up::
	Send n
return

Re: Hard-coded toggle keys

Posted: 27 Sep 2018, 10:23
by Evil-e
Thank you, :)

But, now my character fails to crouch, throws all the grenades and wields a knife like Norman Bates unwilling to wait his turn for a shower... :lol:

I tried your code, then this one and a few variables, but always the same results:
--------------------------------------------------------------
a::
Send n
a Up::
send {n up}
--------------------------------------------------------------

Since "attack" and "throw grenade" are not related to crouch in any way, there is some type of issue with the coding of this games controls. I will give your code a try on a different game and see if I still need that pillow ;)

Thanks, Eric