Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- =begin
- A snippet to make a menu command button that shows an image when selected.
- Made by: Sixth
- =end
- module MenuPic
- Pic = {
- :folder => "Graphics/Pictures/", # Folder where the image is.
- :img => "gameback2", # Name of the image.
- :pos => [0,0], # Position of the image.
- :z => 500, # Z level of the image.
- }
- Command = {
- :index => 5, # Position of the command button.
- :name => "Parameters", # Name of the command button.
- :show => 0, # Show switch ID. 0 = always enabled.
- :enable => 0, # Enable switch ID. 0 = always enabled.
- }
- end
- # End of settings!
- module Cache
- def self.custom_imgs(filename,folder)
- load_bitmap(folder,filename)
- end
- end
- class Window_MenuCommand < Window_Command
- alias add_pic_cmd1112 make_command_list
- def make_command_list
- add_pic_cmd1112
- return unless check_bool(MenuPic::Command[:show])
- cmd_data = {
- :name => MenuPic::Command[:name],
- :symbol=> :show_pic,
- :enabled => check_bool(MenuPic::Command[:enable]),
- :ext => MenuPic::Pic,
- }
- @list.insert(MenuPic::Command[:index],cmd_data)
- end
- def check_bool(data)
- case data
- when Integer
- return data == 0 || $game_switches[data]
- else
- return data
- end
- end
- end
- class Scene_Menu < Scene_MenuBase
- alias add_pic_funct5588 create_command_window
- def create_command_window
- add_pic_funct5588
- @command_window.set_handler(:show_pic, method(:trigger_show_pic))
- end
- def trigger_show_pic
- data = @command_window.current_ext
- pic = Sprite.new
- pic.bitmap = Cache.custom_imgs(data[:img],data[:folder])
- pic.x = data[:pos][0]
- pic.y = data[:pos][1]
- pic.z = data[:z]
- until Input.trigger?(:C) || Input.trigger?(:B)
- update
- end
- Sound.play_ok
- pic.bitmap.dispose
- pic.dispose
- @command_window.activate
- end
- end
- # End of script!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement