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.

CMS Help Request (Adding Icons?)

Hmm, I'm about done on this menu except for two things, I was wondering if anyone could help me with them.
http://img89.imageshack.us/img89/2197/mainmenuwipgg4.png[/img]

I'd love to know how to set text in the help window (@help_window.set_text, I think it is) in that lower left window...

Also, where the character state is ([Normal]), I'd like to have picture icons from the Icons folder, left to right, of their states.

After that, I may consider using cursors over the windowskin choice box... anyone know how to do any of these?

EDIT: Ok, I got the status icons problem solved. All that's left now is setting the text in @help_window.set_text. Anyone?

EDIT2: Can anyone help me with adding an Icon from the Icons folder to PlayTime, Steps, and Gold Windows?
 

khmp

Sponsor

Without any code my answer for how do you set text for a Window_Help object may seem mundane and unhelpful.

Code:
@help_window.set_text(string, align)
# Where string is string of text you want printed on the window. Use quotes around a string ""/''
# Where align is the alignment of the text as its printed. 0 - Left, 1 - Center, 2 - Right

Good luck with it Rubicant! :thumb:
 
Code:
  def update_help
   case @help_window
    when 0
      @help_window.set_text("View or Use an item.")
    when 1
      @help_window.set_text("View or Use Abilities & Spells.")
    when 2
      @help_window.set_text("Change or Remove equipment.")
    when 3
      @help_window.set_text("Change or Remove Petra.")
    when 4
      @help_window.set_text("View Hyperdrive abilities.")
    when 5
      @help_window.set_text("View character statistics.")
    when 6
      @help_window.set_text("Customize various game options.")
    when 7
      @help_window.set_text("Exit the game.")
   end

This is the code I have, now I need to know A) if it's correct, and B) where it goes in Scene_Menu.
 

khmp

Sponsor

"case @help_window" should be a test of something more numeric. You can't put a case statement on a window. Perhaps what you meant was:
Code:
case @command_window.index
I would put the below method call inside the update of Scene_Menu right after the update_command line.
Code:
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # Update windows
    @command_window.update
    @playtime_window.update
    @steps_window.update
    @gold_window.update
    @status_window.update
    # If command window is active: call update_command
    if @command_window.active
      update_command
      update_help if @last_choice != @command_window.index
      return
    end
    # If status window is active: call update_status
    if @status_window.active
      update_status
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Update Help
  #--------------------------------------------------------------------------
  def update_help
    @last_choice = @command_window.index
    case @command_window.index
    when 0
      @help_window.set_text("View or Use an item.")
    when 1
      @help_window.set_text("View or Use Abilities & Spells.")
    when 2
      @help_window.set_text("Change or Remove equipment.")
    when 3
      @help_window.set_text("Change or Remove Petra.")
    when 4
      @help_window.set_text("View Hyperdrive abilities.")
    when 5
      @help_window.set_text("View character statistics.")
    when 6
      @help_window.set_text("Customize various game options.")
    when 7
      @help_window.set_text("Exit the game.")
    end
  end

Good luck with it Rubicant! :thumb:
 
Wait. I should note that I called the Window_Help script in Scene_Menu, with an update and dispose as well, placed where needed.

Code:
    # Make play time window
    @playtime_window = Window_EvPlayTime.new
    @playtime_window.x = 480
    @playtime_window.y = 290
    # Make steps window
    @loc_window = Window_EvLocation.new
    @loc_window.x = 410
    @loc_window.y = 416
    # Make steps window
    @steps_window = Window_EvSteps.new
    @steps_window.x = 480
    @steps_window.y = 314
    # Make gold window
    @gold_window = Window_EvGold.new
    @gold_window.x = 480
    @gold_window.y = 338
    # Make status window
    @status_window = Window_EvMenuStatus.new
    @status_window.x = 0
    @status_window.y = 0
    # Make Help Window
    @help_window = Window_EvHelp.new
    @help_window.x = 0
    @help_window.y = 416

Note the "Ev" before scripts are for duplicates that I made while making the CMS.
 
OK, got it working. I love you.

http://img257.imageshack.us/img257/4294/cmsmainwip2ei4.png[/img]

Now if I could get that gold counter to align correctly, the draw_text code and super settings are exactly the same as PlayTime and Step Count, yet it aligns differently... weird.
 
OK, one last problem and this one's finished.

The icon for PlayTime shows, but once the time changes (i.e. increases by a second) the icon disappears. Does anyone know how to solve that problem. Here's a screenshot and the code.
http://img76.imageshack.us/img76/5782/cmsmainfinalit4.png[/img]

Code:
#==============================================================================
# ** Window_EvPlayTime
#------------------------------------------------------------------------------
#  This window displays play time on the menu screen.
#==============================================================================

class Window_EvPlayTime < Window_EvBase
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 160, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = 0
    self.back_opacity = 0
    self.z = 600
    refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    bitmap = RPG::Cache.icon('menu_time')
    self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, bitmap.width, bitmap.height))
    @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(0, 0, 120, 32, text, 2)
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    super
    if Graphics.frame_count / Graphics.frame_rate != @total_sec
      refresh
    end
  end
end
 

khmp

Sponsor

Code:
self.contents.blt(0, 0, bitmap, Rect.new(0, 0, bitmap.width, bitmap.height))
...
self.contents.draw_text(bitmap.width, 0, width - (32 + bitmap.width), 32, text, 2)

Try to replace your draw_text and blt lines with that. Tell if that works. By the way if the icon doesn't change there absolutely no reason why we can't draw it in initialize this way we are blting it in every refresh.

Bringing the final code to:
Code:
#==============================================================================
# ** Window_EvPlayTime
#------------------------------------------------------------------------------
#  This window displays play time on the menu screen.
#==============================================================================

class Window_EvPlayTime < Window_EvBase
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 160, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = 0
    self.back_opacity = 0
    self.z = 600
    bitmap = RPG::Cache.icon('menu_time')
    @b_width = bitmap.width
    self.contents.blt(0, 0, bitmap, Rect.new(0, 0, bitmap.width, bitmap.height))
    self.contents.font.color = normal_color
    refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    @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.draw_text(@b_width, 0, width - (32 + @b_width), 32, text, 2)
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    super
    if Graphics.frame_count / Graphics.frame_rate != @total_sec
      refresh
    end
  end
end
 

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