Keyboard button equals use of skill, help?

In my game one of my character has a skill called Trivia that can be used outside of battle. It just is the characters talking among themselves.

When the skill is used, it sets the trivia variable value to =1. through a common event.

In the map there's a parallell event that checks if "trivia=1". If it is, text is done, and Trivia is set to "trivia=0" once more.

Is it possible to set a keyboard key to use this skill? Kinda like in Golden Sun, you could use spells often used to the R1 L1 back buttons on the gameboy advance.
Sure there is.

The way to do it without scripts is to make that event instead run consistently (give it no condition, or if it's a Common Event, a condition that an "always on" switch is ON) and Wait a few frames at the end of it so it doesn't lag.  Inside a Conditional Branch in that event, check if the (whatever) button is being pressed, and if so, run the Trivia.

If you're willing to use scripts, there are a few ways to do it.  The easiest way would be to use Hime's Custom Page Conditions and add that exact same condition I described above about the button being pressed as the Page's condition.  The page would include the Trivia event.

Or, if you don't want to use a full premade script, you can modify the Update behavior to directly check whether the button's being held down.  I haven't tried out this code but I think it would be something like:

class Scene_Map < Scene_Base  #--------------------------------------------------------------------------  # * Frame Update  #--------------------------------------------------------------------------  alias :update_with_extras :update def update $game_switches[70] = true if Input.press?🙂Y)    update_with_extras endendThis will set the Trivia switch (I arbitrarily chose Switch 70) to true if the player is pressing the Y symbol (which by default is the 'S' button; see the "Keyboard" page of the F1 settings in-game to understand this better).  Remember to turn it back off after the Trivia event runs.

Original thread: https://forums.rpgmakerweb.com/threads/keyboard-button-equals-use-of-skill-help.37299/