Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================
- # Simple Gold Window
- # Author: Nicke
- # Created: 06/06/2011
- # Edited: 06/06/2011
- # Version: 1.0
- #==============================================================================
- # Instructions
- # -----------------------------------------------------------------------------
- # To install this script, open up your script editor and copy/paste this script
- # to an open slot below ▼ Materials but above ▼ Main. Remember to save.
- #==============================================================================
- $imported = {} if $imported == nil
- $imported["NICKE-GoldWindow"] = true
- module NICKE
- module GOLD_WINDOW
- #--------------------------------------------------------------------------#
- # * Settings
- #--------------------------------------------------------------------------#
- GOLD_FONT = ["Rockwell"] # Font name.
- GOLD_SIZE = 16 # Font size.
- GOLD_COLOR = Color.new(255,215,100) # Font color.
- X_GOLD_WINDOW = 0#505 # X position of Gold window.
- Y_GOLD_WINDOW = 0#372 # Y position of Gold window.
- OPACITY = 0 # Opacity for Gold window.
- ICON_INDEX = 147 # Gold icon ID to be displayed.
- VISIBLE_SWITCH = 7 # Switch ID to turn on/off the gold window.
- SHOW_VOCAB = false # Show system term for gold.
- end
- end
- #Don't edit below!
- #==============================================================================#
- # ** Window_Base
- #------------------------------------------------------------------------------
- # Method for drawing the gold.
- #==============================================================================#
- class Window_Base < Window
- def draw_gold(value, x, y, width)
- cx = contents.text_size(Vocab::gold).width
- self.contents.font.name = NICKE::GOLD_WINDOW::GOLD_FONT
- self.contents.font.size = NICKE::GOLD_WINDOW::GOLD_SIZE
- self.contents.font.color = NICKE::GOLD_WINDOW::GOLD_COLOR
- self.contents.draw_text(x - 25, y, width-cx-2, WLH, value, 2)
- if NICKE::GOLD_WINDOW::SHOW_VOCAB != false
- self.contents.draw_text(x - 20, y, width-cx-2, WLH, Vocab::gold, 2)
- end
- end
- end
- #==============================================================================
- # ** Simple_Gold_Window
- #------------------------------------------------------------------------------
- # This window displays the amount of gold and draw an icon.
- #==============================================================================
- class Simple_Gold_Window < Window_Base
- #--------------------------------------------------------------------------
- # * Object Initialization
- # x : window X coordinate
- # y : window Y coordinate
- #--------------------------------------------------------------------------
- def initialize(x, y)
- super(x, y, 150, WLH + 32)
- @last_gold = -1 # // Used for updating, set it to some crazy value that can never be right
- refresh
- end
- #--------------------------------------------------------------------------#
- # * Refresh
- #--------------------------------------------------------------------------#
- def refresh
- self.contents.clear
- draw_gold($game_party.gold, 4, 0, 120)
- draw_icon(NICKE::GOLD_WINDOW::ICON_INDEX, 94, 0)
- end
- #--------------------------------------------------------------------------#
- # * Update
- #--------------------------------------------------------------------------#
- def update()
- super() # // Now here is where you can make use of the super method :3
- if @last_gold != $game_party.gold # // If gold has changed, refresh.
- refresh ; @last_gold = $game_party.gold
- end
- end
- end
- #==============================================================================
- # ** Scene_Map
- #------------------------------------------------------------------------------
- # Show gold window on the map.
- #==============================================================================
- class Scene_Map < Scene_Base
- alias nicke_gold_window_start start unless $@
- def start(*args) # // Start never has any parameters anyway ;(*args) example
- create_gold_window()
- @gold_window.visible = $game_switches[NICKE::GOLD_WINDOW::VISIBLE_SWITCH]
- nicke_gold_window_start(*args)
- end
- alias nicke_gold_window_terminate terminate unless $@
- def terminate() # // I just like adding the () after method_names :3 helps with identifying them
- nicke_gold_window_terminate()
- dispose_gold_window() # // command_window? its usppose to be the gold @___@
- end
- def create_gold_window()
- @gold_window = Simple_Gold_Window.new(NICKE::GOLD_WINDOW::X_GOLD_WINDOW, NICKE::GOLD_WINDOW::Y_GOLD_WINDOW)
- @gold_window.opacity = NICKE::GOLD_WINDOW::OPACITY
- @gold_window.z = 200 # // Cause I had a lot of stuff that covered it up @__@
- end
- def dispose_gold_window()
- @gold_window.dispose unless @gold_window.nil?() # // If the window isn't nil, dispose it :3
- @gold_window = nil # // even after disposing, the variable isn't always set back to nil, this ensures it
- end
- alias nicke_gold_window_update update unless $@
- def update()
- nicke_gold_window_update()
- @gold_window.update()
- # // Avoid unncessary refreshs
- # // Since the switch can never be nil here, just assign its value to the window.visible
- @gold_window.visible = $game_switches[NICKE::GOLD_WINDOW::VISIBLE_SWITCH]
- end
- end # END OF FILE
- #=*==========================================================================*=#
- # ** END OF FILE
- #=*==========================================================================*=#
Advertisement
Add Comment
Please, Sign In to add comment