Assigning Shift Key to Switch

Hello! I'm a bit embarrassed because this seems easy as cake but I could use some assistance.

I'm currently attempting to make a game wherein when the shift key is pressed, it will activate a switch to ON. Once that switch is on, a bridge will appear. I was able to accomplish this, but the trouble now is I also want the bridge to disappear when the shift key is pressed again, and I've been unable to figure out how to do that.

I could somehow easily assign [shift] to turn on a switch, but no repeated messing around with switches and variables could get it to turn back off again. My eventing got really convoluted as I tried different things and eventually became illegible and frustrating. I was wondering if there was an easier method for creating this sort of action.

Essentially:

Press shift, switch/bridge graphic turns on.

Press shift again, switch/bridge graphic turns off.

Any ideas? Thanks in advance.
Basically the loop that checks the key should also check wether the switch is on or not and then change it on key press.


We can't help you more unless you show us what you have done, so please post screenshots of every event page you've made for that so far.
Vlue have a script that allow you to toggle a switch when you press a key. I think it's exactly what you need.

http://www.rpgmakervxace.net/topic/7670-special-keybinds/
Thanks to the both of you! I used the script and it worked perfectly. I was not using any sort of loop, just a bunch of confusing variable-mush that wasn't even hypothetically working. I feel I should probably brush up on loops and their uses anyway, if only to expand my RPGMaker vocab. I'm still pretty new to all this, so thanks again for the help.

Original thread: https://forums.rpgmakerweb.com/threads/assigning-shift-key-to-switch.42049/