SHOW:
|
|
- or go back to the newest paste.
| 1 | #======================# | |
| 2 | # Z-Systems by: Zetu # | |
| 3 | #===========================#======================#===========================# | |
| 4 | - | # * * * Z01 Neo Menu System v1.03 * * * # |
| 4 | + | # * * * Z01 Neo Menu System v1.04 * * * # |
| 5 | #=#==========================================================================#=# | |
| 6 | # Insert ALL menu commands, each menu item array will contain... # | |
| 7 | # [0] Name of Command (String) # | |
| 8 | # [1] If command is enabled (Boolean or String) # | |
| 9 | # [2] Requires Selection (Boolean) # | |
| 10 | # [3] Command to Run # | |
| 11 | # [4] (Only if [3]==:command_custom) Scene to go to # | |
| 12 | #--------------------------------------------------------------------------# | |
| 13 | # Tip on finding the code within a script: # | |
| 14 | # Use Ctrl+F '$scene ='. This should be able to locate the call method # | |
| 15 | # used in most every script. # | |
| 16 | #==========================================================================# | |
| 17 | module Z01 | |
| 18 | def self.menucommandlist | |
| 19 | return [ | |
| 20 | - | # (Convert) | (Convert) When to |Require | |(If custom) |
| 20 | + | # (Convert) | (Convert) When to |Require | Scene or |
| 21 | - | # Item Name | Enable this command |Selection?|Method Call| Scene |
| 21 | + | # Item Name | Enable this command |Selection?| Command |
| 22 | - | [Vocab::item, "main_commands_enabled", false, :command_item], |
| 22 | + | [Vocab::item, "main_commands_enabled", false, Scene_Item], |
| 23 | - | [Vocab::skill, "main_commands_enabled", true, :command_skill], |
| 23 | + | [Vocab::skill, "main_commands_enabled", true, Scene_Skill], |
| 24 | - | [Vocab::equip, "main_commands_enabled", true, :command_equip], |
| 24 | + | [Vocab::equip, "main_commands_enabled", true, Scene_Equip], |
| 25 | - | [Vocab::status,"main_commands_enabled", true, :command_status], |
| 25 | + | [Vocab::status,"main_commands_enabled", true, Scene_Status], |
| 26 | - | [Vocab::formation, "formation_enabled", false, :command_formation], |
| 26 | + | [Vocab::formation, "formation_enabled", false, :command_formation], |
| 27 | - | [Vocab::save, "save_enabled", false, :command_formation], |
| 27 | + | [Vocab::save, "save_enabled", false, Scene_Save], |
| 28 | - | [Vocab::game_end, true, false, :command_game_end], |
| 28 | + | [Vocab::game_end, true, false, Scene_End], |
| 29 | ||
| 30 | ||
| 31 | # Example of Custom Menu Item! | |
| 32 | # ["Quest Log", true, false, :command_custom, Scene_QuestLog] | |
| 33 | ] | |
| 34 | end | |
| 35 | #========#======================#====#================================#========# | |
| 36 | #--------# #----# DO NOT EDIT PAST THIS POINT!!! #--------# | |
| 37 | #--------# End of Customization #----# Editing will cause death by #--------# | |
| 38 | #--------# #----# brain asplosions. #--------# | |
| 39 | #========#======================#====#================================#========# | |
| 40 | end | |
| 41 | ||
| 42 | class Window_MenuCommand < Window_Command | |
| 43 | ||
| 44 | def make_command_list | |
| 45 | i = 0 | |
| 46 | - | add_command(tryconvert(command[0]), command[3], tryconvert(command[1]), |
| 46 | + | |
| 47 | - | command[4]) |
| 47 | + | symbol = eval(":s#{i}")
|
| 48 | add_command(tryconvert(command[0]), symbol, tryconvert(command[1]), | |
| 49 | command[3]) | |
| 50 | i += 1 | |
| 51 | - | def tryconvert(value) |
| 51 | + | |
| 52 | - | begin |
| 52 | + | |
| 53 | - | return eval(value) |
| 53 | + | |
| 54 | - | rescue |
| 54 | + | |
| 55 | - | return value |
| 55 | + | |
| 56 | class Scene_Menu < Scene_MenuBase | |
| 57 | ||
| 58 | def create_command_window | |
| 59 | @command_window = Window_MenuCommand.new | |
| 60 | i = 0 | |
| 61 | for command in Z01::menucommandlist | |
| 62 | symbol = eval(":s#{i}")
| |
| 63 | if !command[2] | |
| 64 | @command_window.set_handler(symbol, getmethod(command[3])) | |
| 65 | else | |
| 66 | @command_window.set_handler(symbol, method(:command_personal)) | |
| 67 | - | @command_window.set_handler(command[3], method(command[3])) |
| 67 | + | |
| 68 | i += 1 | |
| 69 | - | @command_window.set_handler(command[3], method(:command_personal)) |
| 69 | + | |
| 70 | @command_window.set_handler(:cancel, method(:return_scene)) | |
| 71 | end | |
| 72 | ||
| 73 | def getmethod(item) | |
| 74 | if item.is_a?(Symbol) | |
| 75 | return method(item) | |
| 76 | - | method(Z01[@command_window.index][3]).call |
| 76 | + | else |
| 77 | return method(:command_custom) | |
| 78 | end | |
| 79 | - | def command_skill |
| 79 | + | |
| 80 | - | SceneManager.call(Scene_Skill) |
| 80 | + | |
| 81 | def on_personal_ok | |
| 82 | getmethod(@command_window.current_ext).call | |
| 83 | - | def command_equip |
| 83 | + | |
| 84 | - | SceneManager.call(Scene_Equip) |
| 84 | + | |
| 85 | def command_custom | |
| 86 | print " - " | |
| 87 | - | def command_status |
| 87 | + | print @command_window.current_ext |
| 88 | - | SceneManager.call(Scene_Status) |
| 88 | + | print " -\n" |
| 89 | SceneManager.call(@command_window.current_ext) | |
| 90 | end | |
| 91 | ||
| 92 | end |