help with keyboard keys

Hello everyone, I'm geburah and I'm new to the forum. Among other things it is a beautiful forum.
I have a problem with RPG Maker MV. I can't figure out how to assign custom keys to make the character perform certain actions. In particular I need to trigger a common event by pressing a key on the keyboard (turning off / on an oil lamp).
I managed to create a common event to turn it on but I think I need to create another common event to control it with a key of my choice.
I hope I'm not off topic. Thanks for your help.
Moved to: MV Support

What key are you wanting to use? That will determine whether you can do it purely with events or a plugin is required.

Please show us a screenshot of the common event you've already got set up.

What happens when the lamp is on? Are you using some lighting plugin? Which one?
Yanfly's Button Common Events seems to do what you are looking for.
The YEP plugin wouldn't work for me so I found an alternative:
First, use this Script Call to make your game support non.default keys:

Code:
for (var k = 65; k <= 90; k++) {

    if (!Input.keyMapper[k]) {

        Input.keyMapper[k] = String.fromCharCode(k).toLowerCase();

    }

}

Then use a Condicional Branch - Script Input.isTriggered('your_key') to check if the key was Triggered.
Input.isPressed is also valid.
thanks for the quick answer. I created a common event entitled "light on / off" which is activated as soon as the protagonist picks up an oil lamp. And it works perfectly. I use Terrax lighting system as a script. now I need to allow the player to turn the lamp on or off via any button he likes.

I think I have to create another common event to say "to turn the lamp off and on press the Q key" (for example).

Immagine.jpg
Yanfly's Button Common Events seems to do what you are looking for.

thank you very much it was just what I was looking for
:XP1:

Original thread: https://forums.rpgmakerweb.com/threads/help-with-keyboard-keys.137276/