The RPG Maker Resource Kit

RMRK RPG Maker Creation => RPG Maker General => General Scripting => Topic started by: Bob for us on December 28, 2005, 04:46:38 PM

Title: A gold showing wit coma
Post by: Bob for us on December 28, 2005, 04:46:38 PM
I have looked at dis so called rgss, and found it very easy.
So I made a quick scripty fo a gold showing wit coma.

Replace the window_gold scripty wit dis-

Code: [Select]
#==============================================================================
# ** Window_Gold
#------------------------------------------------------------------------------
#  This window displays amount of gold.
#==============================================================================

class Window_Gold < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 160, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    comma
    self.contents.clear
    cx = contents.text_size($data_system.words.gold).width
    self.contents.font.color = normal_color
    self.contents.draw_text(4, 0, 120-cx-2, 32, @gold, 2)
    self.contents.font.color = system_color
    self.contents.draw_text(124-cx, 0, cx, 32, $data_system.words.gold, 2)
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def comma
    g = $game_party.gold.to_s
    a = g.split(//)
    case $game_party.gold
    when 0..9999
      @gold = $game_party.gold.to_s
    when 10000..99999
      @gold = "#{a[0]}#{a[1]},#{a[2]}#{a[3]}#{a[4]}"
    when 100000..999999
      @gold = "#{a[0]}#{a[1]}#{a[2]},#{a[3]}#{a[4]}#{a[5]}"
    when 1000000..9999999
      @gold = "#{a[0]},#{a[1]}#{a[2]}#{a[3]},#{a[4]}#{a[5]}#{a[6]}"
    end
  end
end


If error u git, add these two lines underneath self.contents = Bitmap.new(width - 32, height - 32)

Code: [Select]
self.contents.font.name = 'Times New Roman'
self.contents.font.size = 22


Oh btw, I noticed me and this so called Tsunokiette hav vary simelar ip's...

How could that be possible? :wink:
Title: A gold showing wit coma
Post by: zxm on December 28, 2005, 05:54:47 PM
Oh my paladin! Holy crap paladin! You're Tsunokiette or his brother! Well I'm using this, Bob, because its for us.