Advertisement
Zetu

Z01 v1.04

Jan 6th, 2012
6,997
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.                             #======================#
  2.                             #  Z-Systems by: Zetu  #
  3. #===========================#======================#===========================#
  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   | Scene or
  21.       # Item Name  | Enable this command   |Selection?| Command
  22.       [Vocab::item,  "main_commands_enabled", false,   Scene_Item],
  23.       [Vocab::skill, "main_commands_enabled", true,    Scene_Skill],
  24.       [Vocab::equip, "main_commands_enabled", true,    Scene_Equip],
  25.       [Vocab::status,"main_commands_enabled", true,    Scene_Status],
  26.       [Vocab::formation, "formation_enabled", false,   :command_formation],
  27.       [Vocab::save,           "save_enabled", false,   Scene_Save],
  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.     for command in Z01::menucommandlist
  47.       symbol = eval(":s#{i}")
  48.       add_command(tryconvert(command[0]), symbol, tryconvert(command[1]),
  49.         command[3])
  50.       i += 1
  51.     end
  52.   end
  53.  
  54. end
  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.       end
  68.       i += 1
  69.     end
  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.     else
  77.       return method(:command_custom)
  78.     end
  79.   end
  80.  
  81.   def on_personal_ok
  82.     getmethod(@command_window.current_ext).call
  83.   end
  84.  
  85.   def command_custom
  86.     print " - "
  87.     print @command_window.current_ext
  88.     print " -\n"
  89.     SceneManager.call(@command_window.current_ext)
  90.   end
  91.  
  92. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement