Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Made by: Sixth
- module AddCommsS
- # Settings for the command button on the skill menu
- #
- # :name = the text displayed for the button
- # :enable = The enable condition of the button
- # :show = The show condition of the button
- #
- # The :enable and :show settings can be:
- # - true/false = true sets it to be always enabled, false will never be enabled
- # - integer number = This would tie a switch for the button. If that switch
- # is ON, the command is enabled, otherwise it is disanled.
- # - :symbol = This would call the method named like the symbol.
- # The method needs to be defined in the Window_SkillCommand class,
- # and it must return true or false.
- # - "string" = The string will be evaluated as a ruby code.
- # The code must return true or false.
- SkillAdd = {
- :name => "Tools", :enable => true, :show => true,
- }
- # Setting for the new button on the options scene.
- #
- # The :name, :enable and :show settings are the same as above.
- #
- # :help1 = Text shown above the button
- # :help2 = Text shown in the help window on the top of the screen
- # :img = The image shown when the command is selected
- # :pos = The X and Y position for the image shown
- # :z = The Z value for the image shown
- # :opa = The opacity value for the image shown
- SettingAdd = {
- :name => "Controls", :enable => true, :show => true,
- :help1 => "Check the controls",
- :help2 => "Hit the confirm button to check the controls!",
- :img => "controls", :pos => [0,0], :z => 2000, :opa => 255,
- }
- end
- # End of settings! o.o
- class Window_SkillCommand < Window_Command
- alias add_common_evs8863 make_command_list
- def make_command_list
- add_commevs if SceneManager.scene_is?(Scene_Skill)
- add_common_evs8863 if check_cmd(AddCommsS::SkillAdd,:show)
- end
- def add_commevs
- return unless @actor
- dt = AddCommsS::SkillAdd
- add_command(dt[:name],:tools,check_cmd(dt,:enable))
- end
- def check_cmd(dt,type)
- case dt[type]
- when Integer
- return $game_switches[dt[type]]
- when Symbol
- return method(dt[type]).call
- when String
- return eval(dt[type])
- else
- return dt[type]
- end
- end
- end
- class Scene_Skill < Scene_ItemBase
- alias add_cmnev_method8864 create_command_window
- def create_command_window
- add_cmnev_method8864
- @command_window.set_handler(:tools, method(:call_tool_scene))
- end
- def call_tool_scene
- SceneManager.call(Scene_QuickTool)
- end
- end
- class Scene_Options < Scene_MenuBase
- alias add_cmnev8864 create_message_se_window
- def create_message_se_window
- add_cmnev8864
- create_controls_win if check_cmd(AddCommsS::SettingAdd,:show)
- end
- def create_controls_win
- @controlwin = Window_CmnEv.new(48+24 * @current_index)
- @controlwin.set_handler(:ok, method(:show_img))
- @back_window.add_text(24 * (@current_index - 1),AddCommsS::SettingAdd[:help1])
- @current_index += 2
- @size += 1
- @window_index.push(:control_img)
- end
- def show_img
- @controlwin.deactivate
- img = Sprite.new
- img.bitmap = Cache.picture(AddCommsS::SettingAdd[:img])
- img.x = AddCommsS::SettingAdd[:pos][0]
- img.y = AddCommsS::SettingAdd[:pos][1]
- img.z = AddCommsS::SettingAdd[:z]
- img.opacity = AddCommsS::SettingAdd[:opa]
- until Input.trigger?(:C)
- Input.update
- Graphics.update
- end
- Sound.play_ok
- img.bitmap.dispose
- img.dispose
- @controlwin.activate
- end
- alias add_contrimg8864 activate_window
- def activate_window(index)
- add_contrimg8864(index)
- case @window_index[index]
- when :control_img
- @controlwin.select(0)
- @controlwin.activate
- @help_window.set_text(AddCommsS::SettingAdd[:help2])
- end
- end
- alias add_contrimg4464 deactivate_window
- def deactivate_window(index)
- add_contrimg4464(index)
- case @window_index[index]
- when :control_img
- @controlwin.select(-1)
- @controlwin.deactivate
- 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 String
- return eval(dt[type])
- else
- return dt[type]
- end
- end
- end
- class Window_CmnEv < Window_Command
- def initialize(y)
- super(24,y)
- self.opacity = 0
- select(-1)
- deactivate
- end
- def make_command_list
- name = AddCommsS::SettingAdd[:name]
- add_command(name,:ok,check_cmd(AddCommsS::SettingAdd,:enable))
- end
- def check_cmd(dt,type)
- case dt[type]
- when Integer
- return $game_switches[dt[type]]
- when Symbol
- return method(dt[type]).call
- when String
- return eval(dt[type])
- else
- return dt[type]
- end
- end
- end
- # End of script! o.o
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement