RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
[VX] Jet's Records Window Snippet | A little help please :)

0 Members and 1 Guest are viewing this topic.

**
Rep:
Level 83
I dont care doesnt mean I dont understand
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 ?

Code: [Select]
#===============================================================================
# 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 :)

*
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
Rep:
Level 96
&&&&&&&&&&&&&&&&&&&&&&&&&&&
GIAW 14: 2nd Place (Hard Mode)2013 Biggest Drama Whore2013 Zero to HeroParticipant - GIAW 11Secret Santa 2013 ParticipantFor taking arms in the name of your breakfast.
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.
« Last Edit: April 04, 2014, 05:44:01 AM by Lord Stark »
&&&&&&&&&&&&&&&&

**
Rep:
Level 83
I dont care doesnt mean I dont understand
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 ?
« Last Edit: April 04, 2014, 09:20:00 PM by virusasa »