Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #===============================================================================
- # * [ACE] Image Grid Menu - Main Menu Command Addon
- #===============================================================================
- # * Made by: Sixth (www.rpgmakervxace.net, www.forums.rpgmakerweb.com)
- # * Version: 1.0
- # * Updated: 04/03/2016
- # * Requires: Sixth's Image Grid Menu
- #-------------------------------------------------------------------------------
- # * < Change Log >
- #-------------------------------------------------------------------------------
- # * Version 1.0 (04/03/2016)
- # - Initial release.
- #-------------------------------------------------------------------------------
- # * < Description >
- #-------------------------------------------------------------------------------
- # * This addon will let you add your new image grid menus to your main menu
- # commands, so the player can easily open these menus from the main menu.
- #-------------------------------------------------------------------------------
- # * < Installation >
- #-------------------------------------------------------------------------------
- # * Place this script below my Image Grid Menu script!
- # * This must be below all grid menu module settings (if you use more)!
- #-------------------------------------------------------------------------------
- # * < Compatibility Info >
- #-------------------------------------------------------------------------------
- # * No known incompatibilities.
- #-------------------------------------------------------------------------------
- # * < Known Issues >
- #-------------------------------------------------------------------------------
- # * No known issues.
- #-------------------------------------------------------------------------------
- # * < Terms of Use >
- #-------------------------------------------------------------------------------
- # * Free to use for whatever purposes you want.
- # * Credit me (Sixth) in your game, pretty please! :P
- # * Posting modified versions of this script is allowed as long as you notice me
- # about it with a link to it!
- #===============================================================================
- $imported = {} if $imported.nil?
- $imported["SixthImgGridMenuButtons"] = true
- #===============================================================================
- # Settings:
- #===============================================================================
- module GridMenuCommands
- #-----------------------------------------------------------------------------
- # Command Settings:
- #-----------------------------------------------------------------------------
- # This is where you can set up your new main menu buttons for your grid menus.
- # Surprisingly, this is a short little settings area. o.o
- # You can add as many main menu buttons as you want here, and all of them can
- # call a different grid menu!
- #
- # Format:
- #
- # "Command Name" => {
- # :index => number, :module => Module_Name,
- # :enable => enable_setting, :show => show_setting,
- # },
- #
- # Details:
- #
- # "Command Name" => { *settings inside* },
- # The "Command Name" will be the text displayed for your command button in the
- # main menu. Make sure that there are no duplicates in the settings!
- #
- # :index => number,
- # This determines where exactly the button will appear on the main command
- # list. 0 means the 1st command, 1 means the 2nd command, and so on.
- #
- # :enable => enable_setting,
- # This uses the same format and options like the :enable setting in the
- # Image Grid Menu script. You got the same options, so you can set it to:
- # 1. An integer number. That number will be the ID of the switch will have to
- # be turned ON in order for the command to be enabled.
- # 2. A symbol. The symbol will be the name of the method called. The result
- # of the method will decide if the command is enabled or not.
- # 3. A string. The string will be a valid ruby code which will be evaluated.
- # the result will decide if the command is enabled or not.
- # 4. An array. The array's first element will be the name of the method called
- # and the second element will be another array containing the method's
- # arguments. The arguments are evaluated in this module, so they will all
- # be static arguments! The result of the method will decide if the command
- # will be enabled or not.
- # 5. A boolean value. This means either true or false. If you set it to true,
- # the command will always be enabled, and if you set it to false, it will
- # always be disabled. Not much point in the latter, but it's there. :P
- # The methods and codes in option 2, 3 and 4 will be evaluated in the
- # Window_MenuCommand class!
- #
- # :show => show_setting,
- # This is the same as the above :enable setting, but this will decide if the
- # command will show up on the list or not.
- # Got the same layout and options as the :enable setting.
- #
- # :module => Module_Name,
- # This is the name of the module which contains your image grid menu settings.
- # This will decide which grid menu will be called, which means that you can
- # add a main menu button for all of your grid menus if you want.
- # Only use valid module names which contain grid menu settings!
- # The default grid menu uses the module named SGridMenu.
- #-----------------------------------------------------------------------------
- MainCmds = {
- "Stage Selection" => {
- :index => 5, :enable => true, :show => true, :module => SGridMenu,
- },
- # Add more main menu command settings here for your grid menus!
- }
- end
- #===============================================================================
- # End of settings! Editing anything below may lead to... you know it, right? o.o
- #===============================================================================
- class Window_MenuCommand < Window_Command
- alias add_grid_menu_buttons8262 make_command_list
- def make_command_list
- add_grid_menu_buttons8262
- insert_grid_buttons
- end
- def insert_grid_buttons
- GridMenuCommands::MainCmds.each do |key,dt|
- next unless check_cmd(dt,:show)
- ccmd = {
- :name => key,
- :symbol => :grid,
- :enabled => check_cmd(dt,:enable),
- :ext => dt[:module]
- }
- ix = dt[:index]
- @list.insert(ix,ccmd)
- end
- end
- def check_cmd(dt,type)
- case dt[type]
- when Integer
- return $game_switches[dt[type]]
- when Symbol
- return method(dt[type]).call
- when Array
- return method(dt[type][0]).call(*dt[type][1])
- when String
- return eval(dt[type])
- else
- return dt[type]
- end
- end
- end
- class Scene_Menu < Scene_MenuBase
- alias add_grid_menu_calls9764 create_command_window
- def create_command_window
- add_grid_menu_calls9764
- @command_window.set_handler(:grid, method(:call_grid_menu))
- end
- def call_grid_menu
- SceneManager.call(Grid_Menu)
- SceneManager.scene.prepare(@command_window.current_ext)
- end
- end
- #==============================================================================
- # !!END OF SCRIPT - OHH, NOES!!
- #==============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement