Press a button on keyboard with event

Hi guys. I've a question.


Is it possible to press a button on keyboard with an event? Example: when an event start, it have a call script or something that, with code, press a button for you? for example ESC.


Thank you very much for your help!
Do you mean something like this?


http://yanfly.moe/2016/01/23/yep-061-button-common-events/
no, just the opposite! the player presses any button, but it is the game itself that sends the command to press the button. Do you understand? ESC in code, that you can insert in a call script and the call script push esc for you. ("esc" for example...)
I can't even think of a reason you'd need to do that. Let alone how you would even start coding something like that. Sorry but I don't think I'll be much help here, good luck though!
you're thinking from the wrong way. you should never have an event simulate a key press - instead you should skip the keyboard and go directly to the function you want to trigger.


The only reason someone can even ask this is because they want to trigger something that is usually triggered by the player with a button. But in that case, the button does nothing other than sending a command to a part of a script, event or plugin. Instead of triggering the button for it to send the command, you should send the command directly.


Believe me, messing with the input buffer is not something you want to do, not unless you're extremely good at programming and know exactly what you're doing on the javascript level.
I can't even think of a reason you'd need to do that. Let alone how you would even start coding something like that. Sorry but I don't think I'll be much help here, good luck though!



If you use Yanfly's plugin, battle start with the command of battle ready activated. And i love this think. BUT if the command battle is activated, the Character is selectet. And when you are performing an action, the character do a step forward AND if he's wounded, the sprite is not shown on their knees, but standing, as if it is in force.


SO... in a scripted battle that the enemy deal a big damage and the character talk, when the turn go to the player, become SELECTED and it remain in a standing position. 


If the system press ESC, the character will not be selected and will remain on his knees.


This is the problem xD WTF!


P.S. In Yanfly Battle Core that thing is here:


Battle Windows


There’s various options to adjust the window settings found in the battle system to make navigating the battle system more intuitive. Such options include starting the turns with the Actor Command Window instead of the Party Command Window (the Fight/Escape Window). The Party Command Window is still accessible but only by pressing cancel on the first actor’s window.
I'd look into finding a script call to prevent that rather than having something press a button for you. Maybe dig into the plugin's code and find out what does what. Yanfly scripts always have a ton of note tags explaining every little function.
The Party Command Window is still accessible but only by pressing cancel on the first actor’s window.



Instead of having the event press a key, have it give the cancel command directly.


As said above, someone has to dig around the code to find that command (I suspect it's not the same as the regular calls), but this is a lot less work and less error-prone than trying to manipulate the keyboard input buffer.
Ok, so i need to ask directly to yanfly what command can i use? Surely he know this command...
Yanfly answer this:  That's a setting that's bound altogether. You can't simply disable it or change it midway through the game.


So, i can't disable that thing with a plugin call. I need the code of rpg maker 🙁  Somebody know how can i do this?
Guys please, i need help, help me with this 🙁
Nobody can help me...

Original thread: https://forums.rpgmakerweb.com/threads/press-a-button-on-keyboard-with-event.67645/