Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Help with putting icon into menu

Hi i've got this script written by AcedentProne which shows the time and money in the same window and instead of writing "Time" and "$data_system.words.gold" i want it to show icons instead
i put this into the script
Code:
self.contents.blt(124-cx2+1, 4, cx2, 32, RPG::Cache.icon(Window_GameStats::Gold_Symbol))
and from that i get the error "can't convert Fixnum into Bitmap"
well i know why it's there i just don't know how to fix it':|
Please Help.

Code:
#=======================================#
# â– Window_GameStats #
# written by AcedentProne #
#------------------------------------------------------------------------------#

class Window_GameStats < Window_Base
  Gold_Symbol = "G"
  Clock_Symbol = "Clock"
def initialize
super(0, 0, 160, 60)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end

def refresh
self.contents.clear
#Drawing gold into separate commas by Dubealex
case $game_party.gold
when 0..9999
gold = $game_party.gold
when 10000..99999
gold = $game_party.gold.to_s
array = gold.split(//)
gold = array[0].to_s+array[1].to_s+","+array[2].to_s+array[3].to_s+array[4].to_s
when 100000..999999
gold = $game_party.gold.to_s
array = gold.split(//)
gold = array[0].to_s+array[1].to_s+array[2].to_s+","+array[3].to_s+array[4].to_s+array[5].to_s
when 1000000..9999999
gold = $game_party.gold.to_s
array = gold.split(//)
gold = array[0].to_s+","+array[1].to_s+array[2].to_s+array[3].to_s+","+array[4].to_s+array[5].to_s+array[6].to_s
end
#Draw Gold
self.contents.font.color = system_color
gold_word = $data_system.words.gold.to_s
cx = contents.text_size(gold_word).width
cx2=contents.text_size(gold.to_s).width
self.contents.font.color = normal_color
self.contents.draw_text(4, 4, 120-cx-2, 32, gold_word, 2)
self.contents.blt(124-cx2+1, 4, cx2, 32, RPG::Cache.icon(Window_GameStats::Gold_Symbol))
# Draw "Time"
@total_sec = Graphics.frame_count / Graphics.frame_rate
hour = @total_sec / 60 / 60
min = @total_sec / 60 % 60
sec = @total_sec % 60
text = sprintf("%02d:%02d:%02d", hour, min, sec)
self.contents.font.color = normal_color
self.contents.draw_text(4, -10, 120, 32, text, 2)
self.contents.font.color = system_color
self.contents.blt(4, -10, 120, 32, RPG::Cache.icon(Window_GameStats::Clock_Symbol))
end
#--------------------------------------------------------------------------
# Update of The count
#--------------------------------------------------------------------------
def update
super
if Graphics.frame_count / Graphics.frame_rate != @total_sec
refresh
end
end
end
 
dont know if this will work, but try changing the 'blt' to Bitmap.

if that doesnt work, try opening the RMXP help file.

the syntaxes for bitmap are in
Help->Contents->RGSS Reference Manual->Game Library->Bitmap

sorry if this isnt enough information, I'm still learning myself.
 
You have thr wrong arguments for Bitmap#blt. The method goes like this:
Code:
blt(x, y, bitmap_src, src_rect)
bitmap_src is an instance of a Bitmap object, src_rect is an instance of the Rect object which holds which section of the bitmap to display (usually 0, 0, bitmap_src.width, bitmap_src.height)
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top