Temporaly disable ESC input

Hello,
i got this plugin from another thread from @Aerosys to temporarly disable key inputs.
Unfortunately the plugin is for all buttons, is it possible that only the escape button is include ?

Here is the code from @Aerosys.


Code:

Input.isEnabled = true;

var alias1 = Input.update;
var alias2 = Input.isPressed;
var alias3 = Input.isTriggered;
var alias4 = Input.isRepeated;
var alias5 = Input.isLongPressed;

Input.update = function() {
if (this.isEnabled) alias1.call(this);
}

Input.isPressed = function(arg) {
return this.isEnabled && alias2.call(this, arg);
}

Input.isTriggered = function(arg) {
return this.isEnabled && alias3.call(this, arg);
}

Input.isRepeated = function(arg) {
return this.isEnabled && alias4.call(this, arg);
}

Input.isLongPressed = function(arg) {
return this.isEnabled && alias5.call(this, arg);
}


To enable/disable Input, use a Script Call
Input.isEnabled = true;
or
Input.isEnabled = false;
It's usually helpful to provide some more context about what you want to do. If you just want to stop the player from accessing the menu, you don't need any code for that.

There's an event command to Change Menu Access.

If there's something else the Escape key does in your project, you've added it and you should be able to toggle that from whatever plugin you used.
You just need to extend this plugin. Example:

Code:
var alias1 = Input.update;
var alias2 = Input.isPressed;
var alias3 = Input.isTriggered;
var alias4 = Input.isRepeated;
var alias5 = Input.isLongPressed;

Input.isPressed = function(keyName) {
  return
    (keyName != 'escape' || !Input.blockEscape) &&
    (keyName != 'left' || !Input.blockLeft) &&
    // repeat for other keys
    alias2.call(this, keyName)
}

// repeat for isTriggered, isRepeated, isLongPressed...

Now, you can write Input.blockEscape = true to block escape key.
Hey,
sorry for the delay. I have a custom Menu and YEP Message Core, when you press the escape button when you are in texboxes, the menu is superimposed over it. I would like to deactivate the esc button for the time in texbox and then activate it again.

The Code is not working (i have probably made a mistake), all buttons are deactivated and that already in the main menu.

Is the code correct or have I misunderstood something ?

var alias1 = Input.update;
var alias2 = Input.isPressed;
var alias3 = Input.isTriggered;
var alias4 = Input.isRepeated;
var alias5 = Input.isLongPressed;

Input.update = function() {
if (this.isEnabled) alias1.call(this);
}
Input.isPressed = function(keyName) {
return
(keyName != 'escape' || !Input.blockEscape) &&
(keyName != 'left' || !Input.blockLeft) &&
alias2.call(this, keyName)
}

Input.isTriggered = function(keyName) {
return
(keyName != 'escape' || !Input.blockEscape) &&
(keyName != 'left' || !Input.blockLeft) &&
alias3.call(this, keyName)
}

Input.isRepeated = function(keyName) {
return
(keyName != 'escape' || !Input.blockEscape) &&
(keyName != 'left' || !Input.blockLeft) &&
alias4.call(this, keyName)
}

Input.isLongPressed = function(keyName) {
return
(keyName != 'escape' || !Input.blockEscape) &&
(keyName != 'left' || !Input.blockLeft) &&
alias5.call(this, keyName)
}
I have a custom Menu
I think the problem must be here. Yanfly's Message Core does not do anything to allow you to access the menu while a text box is showing.

How did you create this custom menu? Because whatever it is is bypassing the way that RPG Maker's inputs work.
the menu consists of 7 images (2 for the menu, 5 from buttons). The menu is located on the ESC button, the standard menu access has been deactivated. With a normal text box everything works, but when I work with the YEP Message Core (for example: MessageRows 7, MessageWidth 700) the menu appears in the text box when the ESC key is pressed.

EDIT: the menu is also superimposed in a normal text box.
It's a week and a half later, and I'll say it again: you're not giving the information that other people could use to help you.

It doesn't matter how many images your menu displays. It doesn't matter which plugin commands you're using.

Just saying "the menu is located on the ESC button" doesn't mean anything - how are you doing that?
Without knowing it, you have given me a very simple solution 🙂. The whole thing runs via a common event that works via a switch. I just have to deactivate the switch during the texbox and activate it again afterwards.

Sometimes you don't come up with the simplest solutions, thanks for the help.

Original thread: https://forums.rpgmakerweb.com/threads/temporaly-disable-esc-input.171197/