Advertisement
Zetu

Z01 Menu System v1.02

Dec 5th, 2011
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #==============================================
  2. # Neo Menu System :: By Zetu (RMVXAce)
  3. # v1.02
  4. #==============================================
  5. =begin
  6.  
  7. This script allows the user to customize the items in the menu.
  8.  
  9. =end
  10. module Z01
  11.   MENUCOMMANDLIST = [
  12.     #"Vocab", :symbol, "Boolean", script call, if require char selection, method to call
  13.     # For any column that the code trys to convert, if value is a string and
  14.     # represents a code, it will try to return that value.  Otherwise, it's the literal
  15.     # value that is returned.
  16.     # (Convert)                   (Convert) When to         Require
  17.     # Item Name          :symbol  Enable this menu command  Selection? Method Call
  18.     ["Vocab::item",      :item,    "main_commands_enabled", false,     :command_item],
  19.     ["Vocab::skill",     :skill,   "main_commands_enabled", true,      :command_skill],
  20.     ["Vocab::equip",     :equip,   "main_commands_enabled", true,      :command_equip],
  21.     ["Vocab::status",    :status,  "main_commands_enabled", true,      :command_status],
  22.     ["Vocab::formation", :formation,   "formation_enabled", false,     :command_formation],
  23.     ["Vocab::save",      :save,             "save_enabled", false,     :command_formation],
  24.     ["Vocab::game_end",  :game_end,                   true, false,     :command_game_end]
  25.     #["'Sample of Literal'", :symbol, "boolean", requires char selection?, event call symbol]
  26.   ]
  27.  
  28. end
  29.  
  30. class Window_MenuCommand < Window_Command
  31.  
  32.   def make_command_list
  33.     for command in Z01::MENUCOMMANDLIST
  34.       add_command(tryconvert(command[0]), command[1], tryconvert(command[2]))
  35.     end
  36.   end
  37.  
  38.   def tryconvert(value)
  39.     begin
  40.       return eval(value)
  41.     rescue
  42.       return value
  43.     end
  44.   end
  45.  
  46. end
  47.  
  48. class Scene_Menu < Scene_MenuBase
  49.  
  50.   def create_command_window
  51.     @command_window = Window_MenuCommand.new
  52.     for command in Z01::MENUCOMMANDLIST
  53.       if !command[3]
  54.         @command_window.set_handler(command[1], method(command[4]))
  55.       else
  56.         @command_window.set_handler(command[1], method(:command_personal))
  57.       end
  58.     end
  59.     @command_window.set_handler(:cancel, method(:return_scene))
  60.   end
  61.  
  62.   def on_personal_ok
  63.     method(Z01[@command_window.index][4]).call
  64.   end
  65.  
  66.   def command_skill
  67.     SceneManager.call(Scene_Skill)
  68.   end
  69.  
  70.   def command_equip
  71.     SceneManager.call(Scene_Equip)
  72.   end
  73.  
  74.   def command_status
  75.     SceneManager.call(Scene_Status)
  76.   end
  77.  
  78. end
  79.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement