Adding commands to the default menu

I would like to add a "level up" command to the default menu, I'm using RPGmaker VX Ace. I've got it to the point where an additional blank space has been added to the menu, and when the player presses enter on it, it opens up what I want. It's really just lacking text, and for the life of me I can't find where the text for the command menu is actually being drawn. My hunch is it has to do with the vocab for commands being linked to the database. I'm hoping there is a way of creating and displaying a custom command without editing the database to add it. If not, I'd certainly love some tips for how to edit the database that goes beyond what you can do in the RPGmaker editor. Can someone help?

I'm looking to do this the right way, though I suppose if I can't, all I really need to do is add some code to draw text in the window_menuCommand script.

What I've done:
-Added a handler for 'levelup' to the menu command window created in the scene_menu script
-That handler calls my custom level up scene, this is working
-I have edited the Vocab script, adding "def self.levelup; command(23); end", emulating what's been done for the other commands there in a flailing attempt to get things to work.
My hunch is it has to do with the vocab for commands being linked to the database. I'm hoping there is a way of creating and displaying a custom command without editing the database to add it.
Your hunch is correct.

When you check the Vocab module in the script editor, you might see this bit of code:
Ruby:
  # Commands
  def self.command(command_id)
    $data_system.terms.commands[command_id]
  end
The global variable "$data_system" contains database information.

All your database information is saved inside the .rvdata2 files in your game's "Data" folder and these global variables labeled $data_xxxx read those respective files (see DataManager's "load_normal_database") loading their contents into the working memory so the game can use them.

Obviously, the database does not have any entry in the "Terms" tab called "level up", there's only 22 command terms in the Terms tab. So as you can imagine, there's no point using "def self.levelup; command(23); end" in order to try and pull the non-existent string. There is no 23rd command in the Terms tab. That's why you're getting no text.

Instead, you'll need to do either one of two things.

You can either add an extra variable to the Vocab module containing the string and reference it in your Window_MenuCommand:
Ruby:
module Vocab
    MenuLevelUp = "Level Up"
end

class Window_MenuCommand < Window_Command
    def add_original_commands
        add_command(Vocab::MenuLevelUp, :levelup, true)
    end
end
Or you can just not reference the Vocab module at all and type the string into the "add_command()" method directly:
Ruby:
class Window_MenuCommand < Window_Command
    def add_original_commands
        add_command("Level Up", :levelup, true)
    end
end
Your hunch is correct.

When you check the Vocab module in the script editor, you might see this bit of code:
Ruby:
  # Commands
  def self.command(command_id)
    $data_system.terms.commands[command_id]
  end
The global variable "$data_system" contains database information.

All your database information is saved inside the .rvdata2 files in your game's "Data" folder and these global variables labeled $data_xxxx read those respective files (see DataManager's "load_normal_database") loading their contents into the working memory so the game can use them.

Obviously, the database does not have any entry in the "Terms" tab called "level up", there's only 22 command terms in the Terms tab. So as you can imagine, there's no point using "def self.levelup; command(23); end" in order to try and pull the non-existent string. There is no 23rd command in the Terms tab. That's why you're getting no text.

Instead, you'll need to do either one of two things.

You can either add an extra variable to the Vocab module containing the string and reference it in your Window_MenuCommand:
Ruby:
module Vocab
    MenuLevelUp = "Level Up"
end

class Window_MenuCommand < Window_Command
    def add_original_commands
        add_command(Vocab::MenuLevelUp, :levelup, true)
    end
end
Or you can just not reference the Vocab module at all and type the string into the "add_command()" method directly:
Ruby:
class Window_MenuCommand < Window_Command
    def add_original_commands
        add_command("Level Up", :levelup, true)
    end
end
Thanks a lot for the help. I guess I didn't realize that you could replace the Vocab: argument of the add_command method with a string, but it makes sense in hindsight. I think adding the string there will be the simplest way.

Original thread: https://forums.rpgmakerweb.com/threads/adding-commands-to-the-default-menu.134992/