Disable some keyboard keys for the whole game

Hello!

I have a small problem, I downloaded a plugin that allow the player to fast forward the text when a button of the keyboard is held down and I've set the key for this to be CTRL.

The problem is that this also makes the text skip when the player holds ALT or ALTGR and it's troublesome since, if let's say the player wants to do an Alt+tab to go check his internet, it will skip some text.

At first, I thought the problem might come from the plugin but after changing for another I had the same issue so I'm guessing that putting "control" as the chosen key for that action mean using those three keys.

And That's why I'd like to know if there is a way to disable the ALT and ALTGR key for the whole game since they won't be used in it and would allow the player to alt+tab without any problems.

Thank you very much!
you can use a plugin that disallow you fast forward using this plugin.
read it carefully because it's also for move routes 🙂
you can use a plugin that disallow you fast forward using this plugin.
read it carefully because it's also for move routes 🙂

I'm sorry if I didn't express myself correctly, I didn't mean that I don't want the player to be able to fast forward, I'm fine with the player skipping text at any given time.

I just don't want it to happen when the ALT key is pressed and fast forward only when the CTRL key is pressed (because it's how other games do it and I don't feel like breaking the convention and choose another key is the best idea.) but when I set "control" as the chosen key in any plugin it include CTRL, ALT and ALTGR, which is why I want to disable both ALT and ALTGR from my game.
mostly in rpg MV so far I know, that the OK button pressed (Z, Esc, Enter and Space).
I'm not sure on the ALT part though, but there is also a keyconfig to replace the button.
The reason this happens is because both keys alt and ctrl are mapped to the same game command "control". You have a few options for changing this, either use a pre-made plugin for changing how the keyboard is mapped, map it yourself or run a script to remove the alt key from the keymapper. I won't explain finding a plugin but if you wanted to map the keys yourself you can use a text editor and save the following as a js file and add it to your game like a plugin.

Code:
Input.keyMapper = {
    9: 'tab',       // tab
    13: 'ok',       // enter
    16: 'shift',    // shift
    17: 'control',  // control
    18: 'control',  // alt
    27: 'escape',   // escape
    32: 'ok',       // space
    33: 'pageup',   // pageup
    34: 'pagedown', // pagedown
    37: 'left',     // left arrow
    38: 'up',       // up arrow
    39: 'right',    // right arrow
    40: 'down',     // down arrow
    45: 'escape',   // insert
    81: 'pageup',   // Q
    87: 'pagedown', // W
    88: 'escape',   // X
    90: 'ok',       // Z
    96: 'escape',   // numpad 0
    98: 'down',     // numpad 2
    100: 'left',    // numpad 4
    102: 'right',   // numpad 6
    104: 'up',      // numpad 8
    120: 'debug'    // F9
};

This is the engines default keymapper, if you remove the line numbered 18, this will remove the use of alt (and alt gr) from your game completely. If you just want to run a script command at the start of your game (this is probably more work, if I'm honest), you can just run this:

Code:
delete Input.keyMapper[18]

If you want to customise the keymapper further, the numbers on the left relate to the keys on your keyboard. enter = 13, alt = 18 and so on. The values in the parenthesis are what action the keys are mapped to, eg 13 => enter => ok. You can use this site to find out the number values for mapping new keys to actions in the engine: https://keycode.info/
if you want to use it for something else, you can try using YEP_ButtonCommonEvents attached common event to it.
like if you want to use it for later for a puspose, but a conditional that checks if the switch is ON, if it ise, do stuff.
else it does nothing, if you dont want to use it for anything, rule it out with with 2 slashes //

but if you know javascript, you can make a plugin that alias that command and make a plugincommand or scriptcall
out of that, so you can enable, disable the control buttons.
Oh, it worked, perfect!
Thanks to both of you for taking the time of explaining me all those possibilities, that was a great help!

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/disable-some-keyboard-keys-for-the-whole-game.115220/