Ruby Code/Script That is called when the player presses the action button.

All i need is the code/script that is called when the player presses the action button.

I know it exists but I've read through like 90% of every script in RPGMaker VX Ace and i can not for the life of me find it.

If you guys know what It is I would be super happy.

I'm utilizing it with a script that allows separate key binds. I've done this to add in a dashing mechanic, and all I'm doing with this is to allow 'E' to be the action button without actually needing to switch up the keybinds in game. I don't want another way to do this, this is the only thing I'm looking for. I know it's simple, and I can do it myself and I will continue to do so.

But if any of y'all offhand know what the code is already I'd save a bunch of time.

Thanks.

$game_player.check_action_event <-- This one sort of works, however it only checks if the event is an action button event, therefore it doesn't work more than once and is not what I'm looking for. However there is bound to be something like that that can work.

Thanks!
All i need is the code/script that is called when the player presses the action button.
In fact, you can define it on your own. This is an example how to handle input C (a.k.a Action Button)
Code:
class Scene_Map
  alias update_alias update
  def update
    update_alias
    if Input.trigger?(:C) # <-- Checks if C button is triggered
      msgbox "Hello World"
    end
  end
end
Put it as a new script, and the message box will be shown up everytime you press an action button.
It doesn't work this way - and if this is what was discussed in your other topic, you shouldn't go this way.

If this is what was discussed in the other topic, then you want to know this part of the engine to trigger some other event or function.
If that is the case then you should trigger that other function directly and NOT through the keyboard functions. There are a lot of reasons for this, but it's too late to explain them (I'll be off to bed shortly).

I can only give you a tip that I have given dozens of people in similiar situations:
Describe to us WHAT you want to do (ingame terms) instead of HOW you want to do something unknown.
You're asking us for details without giving us the big picture, and the topic you're asking for is something that can have a lot of unintended consequences if you don't know exactly what you're doing.
So it's usually better to give us the info of the result you want instead of how you believe it might be done, because then we can tell you how it should be done (which is often some completely different steps).
In fact, you can define it on your own. This is an example how to handle input C (a.k.a Action Button)
Code:
class Scene_Map
  alias update_alias update
  def update
    update_alias
    if Input.trigger?(:C) # <-- Checks if C button is triggered
      msgbox "Hello World"
    end
  end
end
Put it as a new script, and the message box will be shown up everytime you press an action button.
Thanks so much!

This helps a little bit. It's not really the code that runs when you press it, it's more like if you press it x y and z happens.

EDIT: I don't need to define it on my own, I just need to take the code that it calls for, and map it to a different button.

But thanks 🙂
It doesn't work this way - and if this is what was discussed in your other topic, you shouldn't go this way.

If this is what was discussed in the other topic, then you want to know this part of the engine to trigger some other event or function.
If that is the case then you should trigger that other function directly and NOT through the keyboard functions. There are a lot of reasons for this, but it's too late to explain them (I'll be off to bed shortly).

I can only give you a tip that I have given dozens of people in similiar situations:
Describe to us WHAT you want to do (ingame terms) instead of HOW you want to do something unknown.
You're asking us for details without giving us the big picture, and the topic you're asking for is something that can have a lot of unintended consequences if you don't know exactly what you're doing.
So it's usually better to give us the info of the result you want instead of how you believe it might be done, because then we can tell you how it should be done (which is often some completely different steps).
All that I am doing, is re-mapping my Action but key from Z, Space, and Enter, to E VIA a script.
So all i needed was the code.
All that I am doing, is re-mapping my Action but key from Z, Space, and Enter, to E VIA a script.
So all i needed was the code.
Can be done, but will have a disadvantage.
The usual keyboard mapping goes through the F1-configuration for good reasons (every player can reconfigure the keyboard to button map in the config option of F1 for VX Ace).
The reason is that different countries have different keyboard layouts.

I always hated the old games that configured ZX for the shooting buttons in keyboard-controlled action games - because on a German keyboard, the lower row is YXCV and the top row QWERTZ. So it was almost impossible to play those games as easy as someone with an american layout.

If you override the keyboard functions, then you make it impossible for international players to configure the buttons to their layout.
And beside - I think you and @TheoAllen misunderstood each other - because the function he gave you checks for the action button trigger, but it does not change that trigger from the keys configured in the engine.
Can be done, but will have a disadvantage.
The usual keyboard mapping goes through the F1-configuration for good reasons (every player can reconfigure the keyboard to button map in the config option of F1 for VX Ace).
The reason is that different countries have different keyboard layouts.

I always hated the old games that configured ZX for the shooting buttons in keyboard-controlled action games - because on a German keyboard, the lower row is YXCV and the top row QWERTZ. So it was almost impossible to play those games as easy as someone with an american layout.

If you override the keyboard functions, then you make it impossible for international players to configure the buttons to their layout.
And beside - I think you and @TheoAllen misunderstood each other - because the function he gave you checks for the action button trigger, but it does not change that trigger from the keys configured in the engine.

I've no idea if we understood each other or not. And If the game would let me add in more keys to be used I wouldn't have this problem. Because every single key that can be mapped I'm already using. The Action button (default: C: ) is what im using for attacking (z) then A is block S is spell D is item Q is to pick your items and space is to dodge. W is to change leader. (I'm using the XAS combat system btw) which leaves me with zero keybinds left. Not to mention I can't even choose E as an option. So with this keybind script, it makes it much easier to have different buttons for my action button and my attacking button.

I have the script in place, and I used it already to test my dodging capability. (no idea how to change your movement speed though bcuz the custom move event doesn't work for some reason but that's another problem)

So I just need the script command that is run when I press the action button so that I can map that to 'E' in the script and then continue on with my project. You'll still be able to press Enter as your action button but it's just not so far out of the way.
I will be busy at the moment, but I will give you a tip if you want to edit the entire code
press CTRL + SHIFT + F while opening the script editor, then type
Code:
Input.trigger?(:C)

Learn from there.
I will be busy at the moment, but I will give you a tip if you want to edit the entire code
press CTRL + SHIFT + F while opening the script editor, then type
Code:
Input.trigger?(:C)

Learn from there.
thanks will try my best

Original thread: https://forums.rpgmakerweb.com/threads/ruby-code-script-that-is-called-when-the-player-presses-the-action-button.104700/