Selecting a command with Window_Command.

I found some of this code over at http://forums.rpgmakerweb.com/index.php?/topic/30860-setting-command-allocations-to-actor/ .

Now my idea is that opening a chest or any ingame entity should bring up a command menu.

Code found at this forum

class Window_MilenaCommands < Window_Command #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize super(0, 0) end #-------------------------------------------------------------------------- # * Get Window Width #-------------------------------------------------------------------------- def window_width return 160 end #-------------------------------------------------------------------------- # * Get Number of Lines to Show #-------------------------------------------------------------------------- def visible_line_number item_max end #-------------------------------------------------------------------------- # * Create Command List #-------------------------------------------------------------------------- def make_command_list add_main_commands end #-------------------------------------------------------------------------- # * Add Main Commands to List #-------------------------------------------------------------------------- def add_main_commands add_command("Potion", 😛otion) add_command("MP Heal", :mpheal) add_command("Antidote", :antidote) add_command("Dispel", :dispel) endendclass Scene_Milena < Scene_MenuBase #-------------------------------------------------------------------------- # * Start Processing #-------------------------------------------------------------------------- def start super create_command_window end #-------------------------------------------------------------------------- # * Create Command Window #-------------------------------------------------------------------------- def create_command_window @command_window = Window_MilenaCommands.new @command_window.set_handler🙂potion, method🙂command_potion)) @command_window.set_handler🙂mpheal, method🙂command_mpheal)) @command_window.set_handler🙂antidote, method🙂command_antidote)) @command_window.set_handler🙂dispel, method🙂command_dispel)) @command_window.set_handler🙂cancel, method🙂return_scene)) end def command_potion;end def command_mpheal;end def command_antidote;end def command_dispel;endendMy code:

The chest

MyFunction::StartWindowTest()MyFunction

def self.StartWindowTest() @command_windowA = Scene_Milena.new @command_windowA.startendWhen I open the chest the window pops up in the left corner. But I can't select or close the window. What is the missing link? What have I forgot to call or add?
Found this on youtube:




Not sure why it uses different classes but it solves my problem.

Original thread: https://forums.rpgmakerweb.com/threads/selecting-a-command-with-window_command.34720/