I have this particular question about simplifying scripts. Take this script as an example:
class Window_TitleCommand < Window_Command #-------------------------------------------------------------------------- # * Create Command List #-------------------------------------------------------------------------- def make_command_list add_command(Vocab::new_game, :new_game) add_command(Vocab::continue, :continue, continue_enabled) add_command("Book", :book) add_command(Vocab::shutdown, :shutdown) endendclass Scene_Title < Scene_Base #-------------------------------------------------------------------------- # * Create Command Window #-------------------------------------------------------------------------- def create_command_window @command_window = Window_TitleCommand.new @command_window.set_handler🙂new_game, method🙂command_new_game)) @command_window.set_handler🙂continue, method🙂command_continue)) @command_window.set_handler🙂book, method🙂command_book)) @command_window.set_handler🙂shutdown, method🙂command_shutdown)) end def command_book SceneManager.call(Scene_GameBook) end endAs you can see we can call it a poor scripter's way of making a title screen command of his / her own. I want to ask, say I want the one who will use the script to add more commands, how can I simplify the script so I don't have to out the handler in the scene, the command and the method that would execute the command everytime?
I want it to be simplified into something I can configure the command, the key symbol and the method that would execute it.
Thanks!
class Window_TitleCommand < Window_Command #-------------------------------------------------------------------------- # * Create Command List #-------------------------------------------------------------------------- def make_command_list add_command(Vocab::new_game, :new_game) add_command(Vocab::continue, :continue, continue_enabled) add_command("Book", :book) add_command(Vocab::shutdown, :shutdown) endendclass Scene_Title < Scene_Base #-------------------------------------------------------------------------- # * Create Command Window #-------------------------------------------------------------------------- def create_command_window @command_window = Window_TitleCommand.new @command_window.set_handler🙂new_game, method🙂command_new_game)) @command_window.set_handler🙂continue, method🙂command_continue)) @command_window.set_handler🙂book, method🙂command_book)) @command_window.set_handler🙂shutdown, method🙂command_shutdown)) end def command_book SceneManager.call(Scene_GameBook) end endAs you can see we can call it a poor scripter's way of making a title screen command of his / her own. I want to ask, say I want the one who will use the script to add more commands, how can I simplify the script so I don't have to out the handler in the scene, the command and the method that would execute the command everytime?
I want it to be simplified into something I can configure the command, the key symbol and the method that would execute it.
Thanks!