RMRK is retiring.
Server is paid up for the rest of 2026, but the forum may go after that. See here for more information. Please archive or save anything you would like to keep before 2027.
Main Menu
  • Welcome to The RPG Maker Resource Kit.

[VX] Jet's Records Window Snippet | A little help please :)

Started by virusasa, April 02, 2014, 06:04:57 PM

0 Members and 1 Guest are viewing this topic.

virusasa

I'm using this code and Im really happy with it. What I wonder is if I can put icons next to the Stat Names. Is there an easy way to do that ?

#===============================================================================
# Records Window Snippet
# By Jet10985 (Jet)
# Help by: Piejamas, BigEd781, Mithran
#===============================================================================
# This snippet will allow you to show some variables in a window at the
# bottom-left corner of the screen in a window.
# This script has: 6 customization options.
#===============================================================================


module Records
 
  STATS = {
 
  10 => "Food:", # Variable id => Stat name

 
  }

#-------------------------------------------------------------------------------
 
  ALLOW_TRIGGER = true # Let the player hide the window by pressing a button?
 
  HIDE_WINDOW_BUTTON = Input::CTRL # If true, what button?
 
  SWITCH_TO_SHOW = 10 # This is the switch that needs to be on to show the window
 
  OPACITY = 255 # This is how transperant the window is. 0 is transperant.
 
  TEXT_COLOR = Color.new(95,158,160)
   
end

#===============================================================================
# DON'T EDIT FURTHER UNLESS YOU KNOW WHAT TO DO.
#===============================================================================
class Window_Records < Window_Base
 
  include Records
 
  def initialize(x, y, width, height)
    super(x, y, width, height)
    self.opacity = OPACITY
    self.visible = false
    @keys = STATS.keys
    @values = STATS.values
    init_cache
    refresh
  end
 
  def refresh
    self.contents.clear
    self.contents.font.color = TEXT_COLOR
    for i in 0...@keys.size
      self.contents.draw_text(0, i * 24, 222, WLH, @values[i-(@keys.size - 1)] + " " + $game_variables[@keys[i-(@keys.size - 1)]].to_s)
    end
  end
 
  def init_cache
    @cache ||= {}
    @keys.each { |v| @cache[v] = $game_variables[v] }   
  end

  def update           
    if need_refresh?
      refresh
    end
  end
 
  def need_refresh?
    return false unless self.visible
    @cache.each do |k,v|
      return true if $game_variables[k] != v
    end
    return false
  end
end

class Scene_Map
                       
  include Records
                       
  alias jet5830_start start unless $@
  def start
    jet5830_start
    @var_window = Window_Records.new(0, 416 - ((STATS.keys.size * 24) + 32), 160, (STATS.keys.size * 24) + 32)
    @first_switch = false
  end
                       
  alias jet5839_update update unless $@
  def update
    jet5839_update
    @var_window.update
    variable_update
  end
                         
  alias jet5299_terminate terminate unless $@
  def terminate
    @var_window.dispose
    jet5299_terminate
  end
                         
  def variable_update
    if $game_switches[SWITCH_TO_SHOW] && !@first_switch
      @first_switch = true
      @var_window.visible = true unless @var_window.visible = true
    elsif !$game_switches[SWITCH_TO_SHOW]
      @first_switch = false
      @var_window.visible = false unless @var_window.visible = false
    end
    if Input.trigger?(HIDE_WINDOW_BUTTON) && ALLOW_TRIGGER && $game_switches[SWITCH_TO_SHOW]
      @var_window.visible = !@var_window.visible
    end
  end
end

unless $engine_scripts.nil?
  JetEngine.active("Records Window", 1.1)
end


Thanks in advance :)

&&&&&&&&&&&&&

I'll see what I can do. I should have something by tomorrow.

EDIT: Sorry, I don't think this script is going to do what you want.
&&&&&&&&&&&&&&&&

virusasa

Thanks for the effort :)

[EDIT] I tried to do it myself but couldn't figure out how I could write the variables next to each other, instead of line by line. Can anyone help me with that ?