I just want to know how to be able to mimic the effect pressing the escape key has by default through a script call.
What command is being executed when "Esc" is pressed?
RPG Maker MV SupportThe exact command it executes depends on the scene you're in.
To simulate that button being pressed, you can set
To simulate that button being pressed, you can set
Input._currentState["escape"] = trueI'm having a strange issue particularly with the plugin Arisu_VisualInventory. Basically I'm mapping these common events to a controller and am just trying to basically mimic an escape button that does everything escape does in game. Previously I had it set to only use the first line of script shown and it worked well until I needed to escape from this one specific item menu. As things are now with this added bit of script when I press it at anytime the menu rapidly flickers on and off and if i press it in said item menu it still does nothing.
That's going to make it so the escape button is always being read as being pressed because nothing is setting it back to false.
Okay. You will often get better results by more thoroughly describing your whole situation like this in the first place, rather than trying to jump to what you think the solution is 😉
Paste the below into a text editor, save as a *.js file, and include as a plugin. Change one of the words in quotes to be 'escape'.
However, I'm pretty sure "escape" almost always just calls "cancel" (except on the map where it calls "menu").
Edit - that appears to be correct:
Are you saying that in this plugin's menu, pressing the Escape button does something different from the gamepad's "cancel" button? If yes, we can look at the code for it if you provide a link to the plugin.
I'm pretty sure there are plugins that allow you to configure the gamepad buttons pretty easily, but you can also just make your own.
Paste the below into a text editor, save as a *.js file, and include as a plugin. Change one of the words in quotes to be 'escape'.
Code:
Input.gamepadMapper = {
0: 'ok', // A
1: 'cancel', // B
2: 'shift', // X
3: 'menu', // Y
4: 'pageup', // LB
5: 'pagedown', // RB
12: 'up', // D-pad up
13: 'down', // D-pad down
14: 'left', // D-pad left
15: 'right', // D-pad right
};
However, I'm pretty sure "escape" almost always just calls "cancel" (except on the map where it calls "menu").
Edit - that appears to be correct:
Are you saying that in this plugin's menu, pressing the Escape button does something different from the gamepad's "cancel" button? If yes, we can look at the code for it if you provide a link to the plugin.
Unless you have some plugin that specifically causes them to be, events aren't run while you're in a menu scene. There's no game interpreter there.
As @AquaEcho points out, that's turning it on and you don't show anyplace where you turn it off, so it's considering the Escape button to be continuously held down.
I'm assuming that somehow the key is mapped differently when I have the item menu open from this specific plugin http://www.yanfly.moe/wiki/Visual_Item_Inventory_(Arisu). I haven't been able to find a line of script or anything to shut it down. Otherwise what I had going was working, trying to map the controls as you stated dosen't seem to change anything.
If I remove my custom command entirely it also actually seems to work as I need (including closing that pesky plugin item menu) except for the fact that it ALSO calls the menu. So say I have a key set to open the menu, and I press B to close it, it does close, but it also opens another one you have to close for a 2nd time. It does the same when trying to cancel from a choice or item selection menu which is problematic for me.
Presumably the OP is using Eli Button Common Events because I recommended it in a different thread. It does have different handling for canceling out of menus
hakuenstudio.itch.io
Hakuen Studio Button Common Events for RPG Maker MZ by Hakuen Studio
Bind keyboard keys to common events!
hakuenstudio.itch.io
Have you ever had an issue with this plugin being super wonky though? Sometimes I boot up the game and all the gamepad mappings work like a dream, other times certain things are being activated by the wrong buttons, even two things at a time. But then I'll open the plugin to check the parameters, it all looks fine, close it and open the game and it works fine again... until it doesn't. Is there another plugin that accomplishes this?
I haven't had those issues, but if you have multiple plugins assigning things to the same buttons things can get wonky. There is also Mano Input Config, but it's in Japanese.
If you want a button to work in the menu you need to set it to parallel in the plugin settings
docs.google.com
If you want a button to work in the menu you need to set it to parallel in the plugin settings
Button Common Events
MV Help File Introduction This plugin lets you bind common events to any keyboard button AND gamepad button via plugin parameters or plugin commands! Features Bind common events to keyboard keys or gamepad buttons. Remove common events from these keys/buttons. Optionally restore the keys to thei...
Yeah I got the parallel thing figured out. The thing that's really strange to me is I have no other plugins that should be effecting controls. Is it possible it is the default controller mapping butting heads with my mapped common events? Considering my character moves and whatnot without any assigning there clearly are default controls, is there a way to edit/remove these?
I edited my post above to show all the default controller bindings taken from Eli's help file. If you want to overwrite them you could just use the button common events plugin.
Yeah they are set to overwrite the default controls... I'm really at a loss here with what's going on with that plugin. Sometimes it works and sometimes it doesn't. After fiddling with this problem all day its seemingly the best solution so far if only it was consistent.
Just doublechecking- You are testing from a new game and not from a save file, right?
Yes a new game every time. Upon further testing I have at least found that it does seem to consistently function as intended when playing an actual deployed copy of the game, it just seems to get screwy after a playtest or two, but if i open the plugin again, close it, and re-playtest, it works fine. Super strange but working on deployment is what counts so I thank you for your assistance.
Original thread: https://forums.rpgmakerweb.com/threads/what-command-is-being-executed-when-esc-is-pressed.168155/