Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am playing a rhythm game where you can bind two keys to hit one note (in my case LShift and LControl), however it will only register the note if it is being hit singularly. By that, I mean if I have LShift pressed down, it will hold that note, but if I press LControl while LShift is being pressed down, it will not register a second note press, instead it will continue to hold the first note press. What I am asking for is an AutoHotKey script that will nullify the key press when the other key is being pressed i.e. If LShift is held down, pressing LControl will nullify LShift and press LControl.

share|improve this question

1 Answer 1

Try something like this:

LShift::
    if(GetKeyState("LControl")) {
        Send, {LControl up}
    }
    Send, {LShift down}
return

LShift up::
    if(GetKeyState("LShift")) {
        Send, {LShift up}
    }
return

LControl::
    if(GetKeyState("LShift")) {
        Send, {LShift up}
    }
    Send, {LControl down}
return

LControl up::
    if(GetKeyState("LControl")) {
        Send, {LControl up}
    }
return

I don't know if you necessarily need the up hotkeys, but I think this will make your script more consistent. If you don't need the keys to be held down at all, you could also just remap the respective key to be sent once (resulting in a quasi simultaneous down/up event).

P.S.:
Is the behavior of your game a bug or a feature? In other words: Could it be that it deliberately doesn't accept new keys while the other is being held down? If that's the case, you're principally trying to cheat ;)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.