Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #===============================================================================
- # * [ACE] PC Timer Display - YF System Options Addon
- #===============================================================================
- # * Made by: Sixth (www.rpgmakervxace.net, www.forums.rpgmakerweb.com)
- # * Version: 1.1
- # * Updated: 21/10/2016
- # * Requires: Sixth's PC Timer Display
- # Yanfly's System Options
- #-------------------------------------------------------------------------------
- # * < Change Log >
- #-------------------------------------------------------------------------------
- # * Version 1.0 (05/02/2015)
- # - Initial release.
- # * Version 1.1 (21/10/2016)
- # - Reworked some code, fixed some descriptions.
- #-------------------------------------------------------------------------------
- # * < Description >
- #-------------------------------------------------------------------------------
- # * This script adds some extra options to Yanfly's System Options script.
- # These options are, obviously, related to the timer display.
- # Available options:
- # - Timer Format change (12-hours, 24-hours).
- # - Enable/disable the timer on the map.
- # - Enable/disable the timer in the menu.
- # - Timer window position settings.
- # - Timer window windowskin settings.
- # - Timer window background image settings.
- # - Timer window color settings.
- #-------------------------------------------------------------------------------
- # * < Instructions >
- #-------------------------------------------------------------------------------
- # * For adding the switch settings for the clock format and for the
- # enable/disable options, you must do the following:
- #
- # In the 'CUSTOM_SWITCHES' hash in Yanfly's script, add these lines:
- #
- # # -------------------------------------------------------------------------
- # :switch_1 => [Sixth_RTime_HUD::Enable_Switch_Map, "Time Display (Map)",
- # "OFF", "ON",
- # "Turns the time display ON/OFF on the map."
- # ],
- # # -------------------------------------------------------------------------
- # :switch_2 => [Sixth_RTime_HUD::Enable_Switch_Menu, "Time Display (Menu)",
- # "OFF", "ON",
- # "Turns the time display ON/OFF in the menu."
- # ],
- # # -------------------------------------------------------------------------
- # :switch_3 => [Sixth_RTime_HUD::Format_Switch, "Time Display Format",
- # "12-hours", "24-hours",
- # "Sets the format of the time displayed."
- # ],
- # # -------------------------------------------------------------------------
- #
- # Adjust the settings of them however you want, but make sure to leave the
- # switch setting alone (meaning the Sixth_RTime_HUD::XX part). This way you
- # only need to change the switch settings in my script and it will be
- # automatically changed in Yanfly's script as well.
- #
- # After this, you can add :switch_1, :switch_2 and :switch_3 to the 'COMMANDS'
- # array in Yanfly's script.
- # This will make the player be able to set the time format and to
- # enable/disable the timer display in the game options menu anytime.
- #
- # * For the rest of the options, you can simply add the following symbols to
- # the 'COMMANDS' array in Yanfly's script:
- #
- # :timer_pos # <-- For adding position options for the timer to the menu.
- # :timer_skin # <-- For adding windowskin options for the timer to the menu.
- # :timer_back # <-- For adding background options for the timer to the menu.
- # :timer_color # <-- For adding text color options for the timer to the menu.
- #
- # Before you add any of these, you must configure the settings below to avoid
- # any crashes! If you get a NoMethod error, it is most probably because of an
- # incorrect setup, so double-check every settings before reporting any issue!
- #
- # To avoid weird changes happening with the timer display upon entering the
- # system options menu, for each of these 4 settings the first option available
- # should have the same settings like in the Timer Display script!
- #-------------------------------------------------------------------------------
- # * < Installation >
- #-------------------------------------------------------------------------------
- # * Place this script below Yanfly's System Options script and below
- # my PC Timer Display script but above Main!
- #-------------------------------------------------------------------------------
- # * < 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["SixthPCTimerYFOptions"] = true
- #===============================================================================
- # Settings:
- #===============================================================================
- module Sixth_RTime_HUD
- #-----------------------------------------------------------------------------
- # Arrow Settings:
- #-----------------------------------------------------------------------------
- # You can setup the icons used for displaying the arrows here as well as their
- # positions.
- # These icons will serve as the indicators which will show whether the player
- # can scroll more in a direction or not.
- # If there are no more options to the left, the left icon will disappear, and
- # if there are no more options to the right, the right icon will disappear.
- # In any other cases, both of the icons will be displayed.
- #-----------------------------------------------------------------------------
- Arrow_Setup = { # <-- No touchy-touchy!
- :left => {
- :icon_id => 543,
- :x_pos => 318,
- },
- :right => {
- :icon_id => 542,
- :x_pos => 582,
- },
- } # <-- No touchy-touchy!
- #-----------------------------------------------------------------------------
- # Color Preview Settings:
- #-----------------------------------------------------------------------------
- # If you set this to true, the text color for the color change option for the
- # timer window will be colored with the same color like the setup, effectively
- # making this as a color preview function.
- # If you disable it, the color will remain normal and won't change ever.
- #-----------------------------------------------------------------------------
- Color_Change = true
- #-----------------------------------------------------------------------------
- # Vocab Settings:
- #-----------------------------------------------------------------------------
- # These are various texts used for the position settings in the options menu.
- # :name = Text used for the name of the setting.
- # :description = Text used in the help window.
- # You can use message codes in the description texts!
- #-----------------------------------------------------------------------------
- Options_Vocab = { # <-- No touchy-touchy!
- :position => {
- :name => "Timer Position",
- :description => "Sets the position of the timer display on the map.",
- },
- :windowskin => {
- :name => "Timer Window",
- :description => "Sets the windowskin of the timer display on the map.",
- },
- :background => {
- :name => "Timer Background",
- :description => "Sets the background of the timer display on the map.",
- },
- :color => {
- :name => "Timer Color",
- :description => "Sets the color of the text for the timer display.",
- },
- } # <-- No touchy-touchy!
- #-----------------------------------------------------------------------------
- # Position Options:
- #-----------------------------------------------------------------------------
- # Setup the positions of the timer window for the position options here.
- # These settings will be paired with the settings below (Position_Names).
- # So, if the player selects the first option on the list, the position of the
- # timer window will be the first position setup in this settings.
- # You can add as many setups as you want!
- #-----------------------------------------------------------------------------
- Position_Setup = { # <-- No touchy-touchy!
- 0 => [0,0],
- 1 => [[-Window_Setup_Map[:size][0]],0],
- 2 => [0,[-Window_Setup_Map[:size][1]]],
- 3 => [[-Window_Setup_Map[:size][0]],[-Window_Setup_Map[:size][1]]],
- 4 => [:center,0],
- 5 => [:center,[-Window_Setup_Map[:size][1]]],
- } # <-- No touchy-touchy!
- #-----------------------------------------------------------------------------
- # Position Name Options:
- #-----------------------------------------------------------------------------
- # The display names for each position setup option.
- # Must have the same amount of names set up like the amount of positions
- # set up in the above settings.
- #-----------------------------------------------------------------------------
- Position_Names = { # <-- No touchy-touchy!
- 0 => "Top Left",
- 1 => "Top Right",
- 2 => "Bottom Left",
- 3 => "Bottom Right",
- 4 => "Top Center",
- 5 => "Bottom Center",
- } # <-- No touchy-touchy!
- #-----------------------------------------------------------------------------
- # Color Options:
- #-----------------------------------------------------------------------------
- # Setup the color options of the text for the timer window here.
- # This operates the same way like the position option setup above.
- # Two ways to setup the colors:
- # 1. Use an integer number and the color will be drawn directly from your
- # windowskin used for the timer window! The number you enter this way means
- # the ID of the color from the windowskin's color palette.
- # 2. Use an array of 4 numbers and the color will be defined using an RGBA code.
- # This means your windowskin won't affect this color at all.
- # Valid values for the numbers in the array range from 0 to 255!
- # Format: [Red,Green,Blue,Alpha]
- # Alpha is the opacity value, 0 means fully transparent!
- # You can add as many color options as you want!
- #-----------------------------------------------------------------------------
- Color_Setup = { # <-- No touchy-touchy!
- 0 => 17,
- 1 => 1,
- 2 => 3,
- 3 => 0,
- 4 => [200,100,255,255],
- 5 => [255,200,100,255],
- 6 => [100,255,200,255],
- } # <-- No touchy-touchy!
- #-----------------------------------------------------------------------------
- # Color Name Options:
- #-----------------------------------------------------------------------------
- # The name of each color options.
- # Must have the same amount of color names setup here like the amount of
- # color setup in the above settings!
- #-----------------------------------------------------------------------------
- Color_Names = { # <-- No touchy-touchy!
- 0 => "Yellow",
- 1 => "Blue",
- 2 => "Green",
- 3 => "White",
- 4 => "Purple",
- 5 => "Orange",
- 6 => "Emerald",
- } # <-- No touchy-touchy!
- #-----------------------------------------------------------------------------
- # Windowskin Options:
- #-----------------------------------------------------------------------------
- # This controls the windowskin options for the timer window.
- # Add as many as you want following the same format.
- # The name of the file will be displayed for each option!
- # Any windowskin used must be in /Graphics/System/ folder!
- #-----------------------------------------------------------------------------
- Windowskin_Setup = { # <-- No touchy-touchy!
- 0 => "Window",
- 1 => "MySkin1",
- 2 => "MySkin2",
- 3 => "MySkin3",
- } # <-- No touchy-touchy!
- #-----------------------------------------------------------------------------
- # Background Options:
- #-----------------------------------------------------------------------------
- # This controls the background options for the timer window.
- # Add as many as you want following the same format.
- # The name of the file will be displayed for each option!
- # Any background used must be in /Graphics/Picture/ folder!
- #-----------------------------------------------------------------------------
- Background_Setup = { # <-- No touchy-touchy!
- 0 => "timerbackv1",
- 1 => "timerbackv2",
- 2 => "timerbackv3",
- 3 => "timerbackv4",
- } # <-- No touchy-touchy!
- end # <-- No touchy-touchy!
- #===============================================================================
- # End of Settings! Editing anything below may lead to... You know what, right?
- #===============================================================================
- class Window_SystemOptions < Window_Command
- alias add_new_commands0018 process_custom_switch
- def process_custom_switch(sym)
- case sym
- when :timer_pos
- add_command(Sixth_RTime_HUD::Options_Vocab[:position][:name], sym)
- @help_descriptions[sym] = Sixth_RTime_HUD::Options_Vocab[:position][:description]
- when :timer_skin
- add_command(Sixth_RTime_HUD::Options_Vocab[:windowskin][:name], sym)
- @help_descriptions[sym] = Sixth_RTime_HUD::Options_Vocab[:windowskin][:description]
- when :timer_back
- add_command(Sixth_RTime_HUD::Options_Vocab[:background][:name], sym)
- @help_descriptions[sym] = Sixth_RTime_HUD::Options_Vocab[:background][:description]
- when :timer_color
- add_command(Sixth_RTime_HUD::Options_Vocab[:color][:name], sym)
- @help_descriptions[sym] = Sixth_RTime_HUD::Options_Vocab[:color][:description]
- else
- add_new_commands0018(sym)
- end
- end
- alias sixth_rtime_opt2223 draw_item
- def draw_item(index)
- rect = item_rect(index)
- contents.clear_rect(rect)
- sixth_rtime_opt2223(index)
- case @list[index][:symbol]
- when :timer_pos; draw_timer_opt(rect,index,:pos)
- when :timer_skin; draw_timer_opt(rect,index,:skin)
- when :timer_back; draw_timer_opt(rect,index,:back)
- when :timer_color; draw_timer_opt(rect,index,:color)
- end
- end
- def draw_timer_opt(rect,index,type)
- case type
- when :pos
- cur_pos = Sixth_RTime_HUD::Position_Setup.index($game_system.rtime_pos)
- max = Sixth_RTime_HUD::Position_Setup.length-1
- txt = Sixth_RTime_HUD::Position_Names[cur_pos]
- when :skin
- cur_pos = Sixth_RTime_HUD::Windowskin_Setup.index($game_system.rtime_skin)
- max = Sixth_RTime_HUD::Windowskin_Setup.length-1
- txt = Sixth_RTime_HUD::Windowskin_Setup[cur_pos]
- when :back
- cur_pos = Sixth_RTime_HUD::Background_Setup.index($game_system.rtime_back)
- max = Sixth_RTime_HUD::Background_Setup.length-1
- txt = Sixth_RTime_HUD::Background_Setup[cur_pos]
- when :color
- cur_pos = Sixth_RTime_HUD::Color_Setup.index($game_system.rtime_color)
- max = Sixth_RTime_HUD::Color_Setup.length-1
- txt = Sixth_RTime_HUD::Color_Names[cur_pos]
- end
- name = @list[index][:name]
- dx = contents.width/2
- draw_text(0, rect.y, dx, line_height, name, 1)
- lic = Sixth_RTime_HUD::Arrow_Setup[:left][:icon_id]
- ric = Sixth_RTime_HUD::Arrow_Setup[:right][:icon_id]
- lip = Sixth_RTime_HUD::Arrow_Setup[:left][:x_pos]
- rip = Sixth_RTime_HUD::Arrow_Setup[:right][:x_pos]
- if cur_pos == 0
- draw_icon(ric,rip,rect.y)
- elsif cur_pos >= max
- draw_icon(lic,lip,rect.y)
- else
- draw_icon(ric,rip,rect.y)
- draw_icon(lic,lip,rect.y)
- end
- if Sixth_RTime_HUD::Color_Change == true && type == :color
- change_color(get_color_sixth(Sixth_RTime_HUD::Color_Setup[cur_pos]))
- end
- draw_text(dx, rect.y, dx, line_height, txt, 1)
- end
- alias sixth_rtime_opt1224 cursor_change
- def cursor_change(direction)
- sixth_rtime_opt1224(direction)
- case current_symbol
- when :timer_pos; change_timer_pos(direction,:pos)
- when :timer_skin; change_timer_pos(direction,:skin)
- when :timer_back; change_timer_pos(direction,:back)
- when :timer_color; change_timer_pos(direction,:color)
- end
- end
- def change_timer_pos(direction,type)
- case type
- when :pos
- cur_pos = Sixth_RTime_HUD::Position_Setup.index($game_system.rtime_pos)
- maxx = Sixth_RTime_HUD::Position_Setup.length-1
- when :skin
- cur_pos = Sixth_RTime_HUD::Windowskin_Setup.index($game_system.rtime_skin)
- maxx = Sixth_RTime_HUD::Windowskin_Setup.length-1
- when :back
- cur_pos = Sixth_RTime_HUD::Background_Setup.index($game_system.rtime_back)
- maxx = Sixth_RTime_HUD::Background_Setup.length-1
- when :color
- cur_pos = Sixth_RTime_HUD::Color_Setup.index($game_system.rtime_color)
- maxx = Sixth_RTime_HUD::Color_Setup.length-1
- end
- value = direction == :left ? cur_pos-1 : cur_pos+1
- value = [[value,0].max,maxx].min
- Sound.play_cursor if value != cur_pos
- case type
- when :pos
- $game_system.rtime_pos = Sixth_RTime_HUD::Position_Setup[value]
- when :skin
- $game_system.rtime_skin = Sixth_RTime_HUD::Windowskin_Setup[value]
- when :back
- $game_system.rtime_back = Sixth_RTime_HUD::Background_Setup[value]
- when :color
- $game_system.rtime_color = Sixth_RTime_HUD::Color_Setup[value]
- end
- draw_item(index)
- end
- end
- #==============================================================================
- # !!END OF SCRIPT - OHH, NOES!!
- #==============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement