(VXAce) Adding a variable with the filename of a bitmap in script.

One day me and my friend were talking about the potential for ideas for my game.
He asked me if it was possible to customize the UI of the battle system to have different images shown depending on what the user inputted.
I said "It might sound easy to implement but I might not have the knowledge to do such a script command."

Basically, a variable can be set to any number but for now set to 0 or 1 like a switch.
There is two bitmaps with the filename "LNX_11mainskin" in the script.
What I want is to add the number at the end of the filename in the script to detect which bitmap will be used in battle on the fly.
For instance if I set my variable to 1, the script will show "LNX_11mainskin1".
Same goes for if I input a 0, "LNX_11mainskin0".

I would really appreciate the help and if you need any screenshots, here is a few...
upload_2019-8-11_13-40-19.png

upload_2019-8-11_13-41-52.png
I haven't touch VXA for long time, so this is just based on memory...
CMIIW, it should be as easy as just name it like this :
Code:
"LNS11b_mainskin" + $game_variables[value].to_s
BUT you can't just do that since it's inside a module (or you can...? dunno, I forgot). You have to tamper with the main body.

ctrl+f and try look for this code there
Code:
LNX11b::MAIN_SKIN.bitmap
Then turn it like this
Code:
LNX11b::MAIN_SKIN.bitmap + $game_variables[value].to_s
Now it should read the game file with number at the end of the file name.

P.S. I might have mistaken the formatting. Also depend on how the script work itself, it might only read it once. So I don't think it will update the value in real time this way. It would be much easier if you posted the entire code... if it's okay.
Based on the post in a certain discord server, the thing you're looking for is
Code:
"Text string #{$game_variables[10]}"
However, it doesn't work for constant, because, well... they're constant

The constants are loaded at the beginning when the game is loaded. Means even when $game_variables is not yet created, thus their value is fixed. If you're looking a dynamically change string name, you need to figure out where the constant is called then insert $game_variables there,

That is the first you need to figure out. Try CTRL+SHIFT+F and type
Code:
MAIN_SKIN[:bitmap]
or just
Code:
MAIN_SKIN
Based on the post in a certain discord server, the thing you're looking for is
Code:
"Text string #{$game_variables[10]}"
However, it doesn't work for constant, because, well... they're constant

The constants are loaded at the beginning when the game is loaded. Means even when $game_variables is not yet created, thus their value is fixed. If you're looking a dynamically change string name, you need to figure out where the constant is called then insert $game_variables there,

That is the first you need to figure out. Try CTRL+SHIFT+F and type
Code:
MAIN_SKIN[:bitmap]
or just
Code:
MAIN_SKIN

Here is the search results.
upload_2019-8-11_21-15-36.png
upload_2019-8-11_21-16-22.png
I haven't touch VXA for long time, so this is just based on memory...
CMIIW, it should be as easy as just name it like this :
Code:
"LNS11b_mainskin" + $game_variables[value].to_s
BUT you can't just do that since it's inside a module (or you can...? dunno, I forgot). You have to tamper with the main body.

ctrl+f and try look for this code there
Code:
LNX11b::MAIN_SKIN.bitmap
Then turn it like this
Code:
LNX11b::MAIN_SKIN.bitmap + $game_variables[value].to_s
Now it should read the game file with number at the end of the file name.

P.S. I might have mistaken the formatting. Also depend on how the script work itself, it might only read it once. So I don't think it will update the value in real time this way. It would be much easier if you posted the entire code... if it's okay.
Here is the entire script.
Code:
#==============================================================================
# ★ RGSS3-Extension
# LNX11b_リフォーム・バトルステータス
#  Spriteでパラメータやゲージを実装した動的なバトルステータスです。
#  画像や設定を変更することでデザインをアレンジすることが可能です。
#
#  * このスクリプトは LNX11a_XPスタイルバトル の機能拡張スクリプトです。
#  LNX11a_XPスタイルバトル より下のセクションに導入してください。
#
#  また、ステータスの各要素の配置設定を行う
#  LNX11bskin_リフォーム・バトルステータス#スキン設定 も必ず導入してください。
#
#  version   : 1.02 (16/01/11)
#  author    : ももまる
#  website   : http://peachround.com/
#  license   : http://creativecommons.org/licenses/by/2.1/jp/
#
#==============================================================================

#==============================================================================
# ■ LNXスクリプト導入情報
#==============================================================================
$lnx_include = {} if $lnx_include == nil
$lnx_include[:lnx11b] = 102 # version
module LNX11b ; end
unless $lnx_include[:lnx11a]
  p "NG:LNX11b_リフォーム・バトルステータス"
  text = "LNX11b: Error! LNX11a より下位のセクションに配置してください。"
  p text
  msgbox text
  exit
end
p "OK:LNX11b_リフォーム・バトルステータス"

#==============================================================================
# ■ Window_BattleStatus
#------------------------------------------------------------------------------
#  バトル画面で、パーティメンバーのステータスを表示するウィンドウです。
#==============================================================================

class Window_BattleStatus < Window_Selectable
  #--------------------------------------------------------------------------
  # ● [エイリアス]:オブジェクト初期化
  #--------------------------------------------------------------------------
  alias :lnx11b_initialize :initialize
  def initialize(viewport = nil)
    unless $lnx_include[:lnx11bskin]
      text = "LNX11b:Error! LNX11bskin が導入されていません。"
      p text
      msgbox text
      exit
    end
    @sprite_viewport = viewport
    # 元のメソッドを呼ぶ
    lnx11b_initialize
    @sprite_viewport.z = self.z
  end
  #--------------------------------------------------------------------------
  # ● [オーバーライド]解放
  #--------------------------------------------------------------------------
  def dispose
    dispose_status_sprites
    @sprite_viewport.dispose
    super
  end
  #--------------------------------------------------------------------------
  # ● [オーバーライド]:表示行数の取得
  #--------------------------------------------------------------------------
  def visible_line_number
    return 4
  end
  #--------------------------------------------------------------------------
  # ● [オーバーライド]:行の高さを取得
  #--------------------------------------------------------------------------
  def line_height
    return 24 # ステートアイコン描画領域を確保
  end
  #--------------------------------------------------------------------------
  # ● [オーバーライド]:フレーム更新
  #--------------------------------------------------------------------------
  def update
    super
    update_invisible
    update_status_sprites
  end
  #--------------------------------------------------------------------------
  # ● [再定義]:表示状態更新
  #--------------------------------------------------------------------------
  def update_invisible
    @sprite_viewport.visible = !$game_party.status_invisible
  end
  #--------------------------------------------------------------------------
  # ● [再定義]:リフレッシュ
  #--------------------------------------------------------------------------
  def refresh
    set_xy
    # ステータススプライトの作成
    create_status_sprites
    draw_all_items
  end
  #--------------------------------------------------------------------------
  # ● [追加]:ステータススプライトの作成
  #--------------------------------------------------------------------------
  def create_status_sprites
    return if @sprite != nil
    @sprite = []
    $game_party.battle_members.each_with_index do |actor, i|
      @sprite[i] = Spriteset_BattleStatus.new(actor, self, @sprite_viewport)
    end
  end
  #--------------------------------------------------------------------------
  # ● [追加]:ステータススプライトの解放
  #--------------------------------------------------------------------------
  def dispose_status_sprites
    return unless @sprite
    @sprite.each do |sprite|
      sprite.dispose
    end
    @sprite = nil
  end
  #--------------------------------------------------------------------------
  # ● [追加]:ステータススプライトの更新
  #--------------------------------------------------------------------------
  def update_status_sprites
    return unless @sprite
    @sprite.each {|sprite| sprite.update}
  end
  #--------------------------------------------------------------------------
  # ● [追加]:戦闘終了時の処理
  #--------------------------------------------------------------------------
  def battle_end_process
    return unless @sprite
    @sprite.each{|sprite| sprite.battle_end_process}
  end
  #--------------------------------------------------------------------------
  # ● [再定義]:基本エリアの描画
  #--------------------------------------------------------------------------
  def draw_basic_area(rect, actor)
    # スプライトの更新
    @sprite[actor.index].refresh
  end
  #--------------------------------------------------------------------------
  # ● [再定義]:ゲージエリアの描画
  #--------------------------------------------------------------------------
  def draw_gauge_area(*args)
    # 何もしない
  end
  #--------------------------------------------------------------------------
  # ● [エイリアス]:内容の消去
  #--------------------------------------------------------------------------
  alias :lnx11b_all_clear :all_clear
  def all_clear
    # 元のメソッドを呼ぶ
    lnx11b_all_clear
    # ステータススプライトの解放
    dispose_status_sprites
  end
end

#==============================================================================
# ■ [追加]:Spriteset_BattleStatus
#------------------------------------------------------------------------------
#  スプライトによるバトルステータス。
#==============================================================================

class Spriteset_BattleStatus
  include LNX11
  include LNX11b
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize(battler, status_window, viewport = nil)
    @battler = battler
    @viewport = viewport
    @status_window = status_window
    # 基準座標
    @x = $game_party.members_screen_x[battler.index] + STATUS_OFFSET[:x]
    @x -= STATUS_WIDTH / 2
    @y = @status_window.y + STATUS_OFFSET[:y]
    # メインスキン
    @main_skin_sprite = create_skin(MAIN_SKIN)
    # ステート
    @state_skin_sprite = create_skin(STATE_SKIN)
    @state_icon = create_state_icon(STATE_ICON)
    # 名前
    @name_sprite = create_name(NAME)
    # 数字
    num = @battler.hp ; max = @battler.mhp
    @hp_number_sprite = create_number(num, max, @battler, HP_NUMBER_FORMAT)
    num = @battler.mp ; max = @battler.mmp
    @mp_number_sprite = create_number(num, max, @battler, MP_NUMBER_FORMAT)
    if $data_system.opt_display_tp
      num = @battler.tp ; max = @battler.max_tp
      @tp_number_sprite = create_number(num, max, @battler, TP_NUMBER_FORMAT)
    end
    # 数字(最大値)
    num = @battler.mhp
    @mhp_number_sprite = create_number(num, num, @battler, MAXHP_NUMBER_FORMAT)
    num = @battler.mmp
    @mmp_number_sprite = create_number(num, num, @battler, MAXMP_NUMBER_FORMAT)
    if $data_system.opt_display_tp
      num = @battler.max_tp
      @mtp_number_sprite = create_number(num, num, @battler, MAXTP_NUMBER_FORMAT)
    end
    # ゲージ
    @hp_gauge_sprite = create_gauge(@battler.hp_rate, HP_GAUGE_FORMAT)
    @mp_gauge_sprite = create_gauge(@battler.mp_rate, MP_GAUGE_FORMAT)
    if $data_system.opt_display_tp
      @tp_gauge_sprite = create_gauge(@battler.tp_rate, TP_GAUGE_FORMAT)
    end
    # ゲージと数字スプライトの同期
    if HP_GAUGE_FORMAT[:number_link] && @hp_number_sprite
      @hp_gauge_sprite.number = @hp_number_sprite if @hp_gauge_sprite
    end
    if MP_GAUGE_FORMAT[:number_link] && @mp_number_sprite
      @mp_gauge_sprite.number = @mp_number_sprite if @mp_gauge_sprite
    end
    if TP_GAUGE_FORMAT[:number_link] && @tp_number_sprite
      @tp_gauge_sprite.number = @tp_number_sprite if @tp_gauge_sprite
    end
    # 更新するスプライトの配列
    @sprites = [@main_skin_sprite, @state_skin_sprite, @state_icon,
      @name_sprite, @hp_number_sprite, @mp_number_sprite, @tp_number_sprite,
      @mhp_number_sprite, @mmp_number_sprite, @mtp_number_sprite,
      @hp_gauge_sprite, @mp_gauge_sprite, @tp_gauge_sprite]
    @sprites.delete(nil)
    @base_ys = @sprites.map{|sprite| sprite.y}
  end
  #--------------------------------------------------------------------------
  # ● 解放
  #--------------------------------------------------------------------------
  def dispose
    @sprites.each {|sprite| sprite.dispose }
  end
  #--------------------------------------------------------------------------
  # ● 戦闘終了時の処理
  #--------------------------------------------------------------------------
  def battle_end_process
    @hp_number_sprite.battle_end_process
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  def update
    @sprites.each_with_index do |sprite, index|
      sprite.update
      base_y = @base_ys[index]
      sprite.y = base_y + (@battler == $game_temp.acting_battler ? -10 : 0)
    end
  end
  #--------------------------------------------------------------------------
  # ● スプライトの位置設定
  #--------------------------------------------------------------------------
  def move(sprite, format)
    # 表示基準 X 座標
    x = format[:x_fixed] ? @x : @x - @status_window.min_offset
    sprite.move(x + format[:x], @y + format[:y], format[:z])
  end
  #--------------------------------------------------------------------------
  # ● スキンの作成
  #--------------------------------------------------------------------------
  def create_skin(format)
    return nil unless format[:enabled]
    sprite = Sprite_Skin.new(format, @viewport)
    move(sprite, format)
    return sprite
  end
  #--------------------------------------------------------------------------
  # ● 名前の作成
  #--------------------------------------------------------------------------
  def create_name(format)
    return nil unless format[:enabled]
    sprite = Sprite_BattlerName.new(@battler, format, @viewport)
    move(sprite, format)
    return sprite
  end
  #--------------------------------------------------------------------------
  # ● 数字の作成
  #--------------------------------------------------------------------------
  def create_number(num, max, battler, format)
    return nil unless format[:enabled]
    sprite = if format[:meter]
      Sprite_Meter.new(num, max, battler, format, @viewport)
    else
      Sprite_Number.new(num, max, battler, format, @viewport)
    end
    move(sprite, format)
    return sprite
  end
  #--------------------------------------------------------------------------
  # ● ゲージの作成
  #--------------------------------------------------------------------------
  def create_gauge(rate, format)
    return nil unless format[:enabled]
    case format[:type]
    when 0 # 横ゲージ
      sprite = Sprite_HorzGauge.new(rate, format, @viewport)
    when 1 # セルゲージ
      sprite = Sprite_CellGauge.new(rate, format, @viewport)
    end
    move(sprite, format)
    return sprite
  end
  #--------------------------------------------------------------------------
  # ● ステートアイコンの作成
  #--------------------------------------------------------------------------
  def create_state_icon(format)
    return nil unless format[:enabled]
    sprite = Sprite_StateIcon.new(@battler, @status_window, format, @viewport)
    move(sprite, format)
    return sprite
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  def refresh
    # ゲージ
    @hp_gauge_sprite.set(@battler.hp_rate) if @hp_gauge_sprite
    @mp_gauge_sprite.set(@battler.mp_rate) if @mp_gauge_sprite
    @tp_gauge_sprite.set(@battler.tp_rate) if @tp_gauge_sprite
    # 数字
    @hp_number_sprite.set(@battler.hp, @battler.mhp) if @hp_number_sprite
    @mp_number_sprite.set(@battler.mp, @battler.mmp) if @mp_number_sprite
    @tp_number_sprite.set(@battler.tp, @battler.max_tp) if @tp_number_sprite
    # 数字(最大値)
    @mhp_number_sprite.set(@battler.mhp, @battler.mhp) if @mhp_number_sprite
    @mmp_number_sprite.set(@battler.mmp, @battler.mmp) if @mmp_number_sprite
    mtp = @battler.max_tp
    @mtp_number_sprite.set(mtp, mtp) if @mtp_number_sprite
    # ステート
    @state_icon.refresh if @state_icon
    @state_skin_sprite.visible = @state_icon.visible if @state_skin_sprite
    # 名前
    if @name_sprite
      @name_sprite.refresh
      if @state_icon && NAME[:auto_hide]
        @name_sprite.visible = !@state_icon.visible
      end
    end
  end
end

module LNX11
  # X 座標の自動調整を行う
  STATUS_AUTOADJUST = true
end

#==============================================================================
# ■ [追加]:Sprite_BattleStatus
#------------------------------------------------------------------------------
#  バトルステータスのスプライト群のスーパークラス。
#==============================================================================

class Sprite_BattleStatus < Sprite
  #--------------------------------------------------------------------------
  # ● 移動
  #--------------------------------------------------------------------------
  def move(x, y, z)
    self.x = x
    self.y = y
    self.z = z
  end
end

#==============================================================================
# ■ [追加]:Sprite_Skin
#------------------------------------------------------------------------------
#  バトルステータス:スキンのスプライト。
#==============================================================================

class Sprite_Skin < Sprite_BattleStatus
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize(format, viewport = nil)
    super(viewport)
    self.bitmap = Cache.system(format[:bitmap])
  end
end

#==============================================================================
# ■ [追加]:Sprite_BattlerName
#------------------------------------------------------------------------------
#  バトルステータス:名前を表示するスプライト。
#==============================================================================

class Sprite_BattlerName < Sprite_BattleStatus
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize(battler, format, viewport = nil)
    super(viewport)
    @battler = battler
    @format = format
    @name = ""
    refresh
  end
  #--------------------------------------------------------------------------
  # ● ビットマップの解放
  #--------------------------------------------------------------------------
  def bitmap_dispose
    self.bitmap.dispose if self.bitmap && !self.bitmap.disposed?
    self.bitmap = nil
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  def refresh
    return if @name == @battler.name
    @name = @battler.name
    bitmap_dispose
    if @format[:bitmap_name]
      self.bitmap = Cache.system("name_#{@name}")
    else
      self.bitmap = Bitmap.new(@format[:width], @format[:height])
      self.bitmap.font.name = @format[:name]
      self.bitmap.font.size = @format[:size]
      self.bitmap.font.bold = @format[:bold]
      self.bitmap.font.italic = @format[:italic]
      self.bitmap.font.color = @format[:color][0]
      self.bitmap.font.out_color = @format[:color][1]
      self.bitmap.draw_text(self.bitmap.rect, @name, @format[:align])
    end
  end
end

#==============================================================================
# ■ [追加]:Sprite_HorzGauge
#------------------------------------------------------------------------------
#  バトルステータス:横方向のゲージ。
#==============================================================================

class Sprite_HorzGauge < Sprite_BattleStatus
  NUMBERS    = [0,1,2,3,4,5,6,7,8,9]
  COLOR_SIZE = 4
  # 0:通常 1:ピンチ 2:最大 3:サブゲージ
  #--------------------------------------------------------------------------
  # ● [追加]:公開インスタンス変数
  #--------------------------------------------------------------------------
  attr_accessor :number   # 同期する数字スプライト
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize(rate, format, viewport)
    super(viewport)
    self.bitmap = Cache.system(format[:bitmap])
    @speed = format[:speed]
    @s_speed = format[:s_speed]
    @crisis = format[:crisis]
    @sub_gauge = Sprite.new(viewport)
    @sub_gauge.bitmap = self.bitmap
    @number = nil
    color_set_rect(3, @sub_gauge)
    set(rate, true)
  end
  #--------------------------------------------------------------------------
  # ● 解放
  #--------------------------------------------------------------------------
  def dispose
    @sub_gauge.dispose
    super
  end
  #--------------------------------------------------------------------------
  # ● 移動
  #--------------------------------------------------------------------------
  def move(x, y, z)
    super(x, y, z)
    @sub_gauge.x = x
    @sub_gauge.y = y
    @sub_gauge.z = z - 1
  end
  #--------------------------------------------------------------------------
  # ● ゲージ最大か?
  #--------------------------------------------------------------------------
  def max?
    @gauge_width / max_gauge_widht >= 1.0
  end
  #--------------------------------------------------------------------------
  # ● ゲージが少ない?
  #--------------------------------------------------------------------------
  def crisis?
    @gauge_width / max_gauge_widht < @crisis
  end
  #--------------------------------------------------------------------------
  # ● 最大ゲージ幅の取得
  #--------------------------------------------------------------------------
  def max_gauge_widht
    self.bitmap.width.to_f
  end
  #--------------------------------------------------------------------------
  # ● ゲージ色変更(Rect)
  #--------------------------------------------------------------------------
  def color_set_rect(color, sprite)
    sprite.src_rect.height = self.bitmap.height / COLOR_SIZE
    sprite.src_rect.y = color * self.bitmap.height / COLOR_SIZE
  end
  #--------------------------------------------------------------------------
  # ● ゲージ色変更
  #--------------------------------------------------------------------------
  def gauge_color_set
    color_set_rect(max? ? 2 : crisis? ? 1 : 0, self)
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  def update
    # メインゲージ幅の更新
    if @real_gauge_width != @gauge_width
      if @number
        # 数字スプライトと同期
        rate = @number.real_rate
        width = ([max_gauge_widht * rate, rate != 0 ? 1 : 0].max).to_i
        @real_gauge_width = width
      else
        @real_gauge_width = sma(@gauge_width, @real_gauge_width, @speed)
      end
      # ゲージ色変更
      gauge_color_set
    end
    # サブゲージ幅の更新
    if @sub_gauge_width > @gauge_width
      @sub_gauge_width = [@sub_gauge_width - @s_speed, @gauge_width].max
    elsif @sub_gauge_width != @gauge_width
      @sub_gauge_width = @real_gauge_width
    end
    # スプライトの更新
    update_sprite
  end
  #--------------------------------------------------------------------------
  # ● スプライトの更新
  #--------------------------------------------------------------------------
  def update_sprite
    self.src_rect.width = @real_gauge_width
    @sub_gauge.x = self.x + @real_gauge_width
    @sub_gauge.src_rect.x = @real_gauge_width
    @sub_gauge.src_rect.width = @sub_gauge_width - @real_gauge_width
  end
  #--------------------------------------------------------------------------
  # ● ゲージレートの設定
  #--------------------------------------------------------------------------
  def set(rate, apply = false)
    @gauge_rate = rate
    @gauge_width = ([max_gauge_widht * rate, rate != 0 ? 1 : 0].max).to_i
    # すぐに適用
    if apply
      @real_gauge_width = @gauge_width
      @sub_gauge_width = @gauge_width
      # ゲージ色変更
      gauge_color_set
      # スプライトの更新
      update_sprite
    end
  end
  #--------------------------------------------------------------------------
  # ● 移動平均
  #--------------------------------------------------------------------------
  def sma(a, b, p)
    # a = 目標位置 b = 現在地
    return a if a == b || (a - b).abs < 0.3 || p == 1
    result = ((a + b * (p.to_f - 1)) / p.to_f)
    return (a - result).abs <= 1.0 ? (b < a ? b + 0.3 : b - 0.3) : result
  end
end

#==============================================================================
# ■ [追加]:Sprite_CellGauge
#------------------------------------------------------------------------------
#  バトルステータス:値に応じたセルを参照して表示する擬似ゲージ。
#==============================================================================

class Sprite_CellGauge < Sprite_BattleStatus
  #--------------------------------------------------------------------------
  # ● [追加]:公開インスタンス変数
  #--------------------------------------------------------------------------
  attr_accessor :number   # 同期する数字スプライト
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize(rate, format, viewport)
    super(viewport)
    self.bitmap = Cache.system(format[:bitmap])
    @speed = format[:speed]
    @pattern = format[:pattern]
    @pattern_direction = format[:direction]
    @cell_width = format[:width]
    @cell_height = format[:height]
    # パターン
    @horz_size = self.bitmap.width / @cell_width
    @vtcl_size = self.bitmap.height / @cell_height
    @number = nil
    set(rate, true)
  end
  #--------------------------------------------------------------------------
  # ● パターン数の取得
  #--------------------------------------------------------------------------
  def pattern
    @pattern == :auto ? @horz_size * @vtcl_size - 1 : @pattern - 1
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  def update
    # メインゲージ幅の更新
    if @real_rate.truncate != @rate.truncate
      if number
        # 数字スプライトと同期
        @real_rate = @number.real_rate * 100
      else
        @real_rate = sma(@rate, @real_rate, @speed)
      end
      # スプライトの更新
      update_sprite
    end
  end
  #--------------------------------------------------------------------------
  # ● スプライトの更新
  #--------------------------------------------------------------------------
  def update_sprite
    pt = (pattern * @real_rate / 100).truncate
    if @pattern_direction == 0
      # 横方向にパターンが並んでいる
      cx = pt % @horz_size * @cell_width
      cy = pt / @horz_size * @cell_height
    else
      # 縦方向にパターンが並んでいる
      cx = pt / @vtcl_size * @cell_width
      cy = pt % @vtcl_size * @cell_height
    end
    self.src_rect.set(cx, cy, @cell_width, @cell_height)
  end
  #--------------------------------------------------------------------------
  # ● ゲージレートの設定
  #--------------------------------------------------------------------------
  def set(rate, apply = false)
    @rate = rate * 100
    # すぐに適用
    if apply
      @real_rate = @rate
      # スプライトの更新
      update_sprite
    end
  end
  #--------------------------------------------------------------------------
  # ● 移動平均
  #--------------------------------------------------------------------------
  def sma(a, b, p)
    # a = 目標位置 b = 現在地
    return a if a == b || (a - b).abs < 0.3 || p == 1
    result = ((a + b * (p.to_f - 1)) / p.to_f)
    return (a - result).abs <= 1.0 ? (b < a ? b + 0.3 : b - 0.3) : result
  end
end

#==============================================================================
# ■ [追加]:Sprite_Number
#------------------------------------------------------------------------------
#  バトルステータス:数字を表示するスプライト。
#==============================================================================

class Sprite_Number < Sprite_BattleStatus
  COLOR_SIZE = 3
  # 0:通常
  # 1:1/4(ピンチ)
  # 2:死亡
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize(num, max, battler, format, viewport = nil)
    super(viewport)
    @src_bitmap = Cache.system(format[:bitmap])
    @type = format[:type]
    @speed = format[:speed]
    @align  = format[:align]
    @spacing = format[:spacing]
    @crisis = format[:crisis]
    @dead = format[:dead]
    digit = format[:digit]
    # バトラー関連付け
    @battler = battler
    # 数字幅
    @num_width = @src_bitmap.width / 10
    # 数字高さ
    @num_height = @src_bitmap.height / COLOR_SIZE
    bw = @num_width * digit + @spacing * (digit - 1)
    self.bitmap = Bitmap.new(bw, @num_height)
    # 文字揃えによる基準座標の変更
    case @align
    when 0 ; self.ox = 0
    when 1 ; self.ox = self.width / 2
    when 2 ; self.ox = self.width
    end
    # 初期値適用
    set(num, max, true)
  end
  #--------------------------------------------------------------------------
  # ● 解放
  #--------------------------------------------------------------------------
  def dispose
    self.bitmap.dispose
    super
  end
  #--------------------------------------------------------------------------
  # ● 強制停止(HPのみ)
  #--------------------------------------------------------------------------
  def battle_end_process
    return if @type != :hp
    if @real_num > @num
      @num = @real_num
      @battler.send("#{@type.id2name}=".to_sym, @num)
    end
  end
  #--------------------------------------------------------------------------
  # ● レートの取得
  #--------------------------------------------------------------------------
  def rate
    @num / @max.to_f
  end
  #--------------------------------------------------------------------------
  # ● 表示レートの取得
  #--------------------------------------------------------------------------
  def real_rate
    @real_num / @max.to_f
  end
  #--------------------------------------------------------------------------
  # ● 数値が少ない?
  #--------------------------------------------------------------------------
  def crisis?
    rate < @crisis
  end
  #--------------------------------------------------------------------------
  # ● 数値が 0 か?
  #--------------------------------------------------------------------------
  def dead?
    rate <= @dead
  end
  #--------------------------------------------------------------------------
  # ● 数字色取得
  #--------------------------------------------------------------------------
  def number_color
    dead? ? 2 : crisis? ? 1 : 0
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  def update
    # 数値の更新
    if @real_num != @num
      ac = [1, ((@real_num - @num).abs / @speed).truncate].max
      if @real_num > @num
        @real_num = [@real_num - ac, @num].max
      else
        @real_num = [@real_num + ac, @num].min
      end
      @battler.send("real_#{@type.id2name}=".to_sym, @real_num)
      # ビットマップの更新
      update_bitmap
    end
  end
  #--------------------------------------------------------------------------
  # ● 数値の設定
  #--------------------------------------------------------------------------
  def set(num, max, apply = false)
    @num = num
    @max = max
    # すぐに適用
    if apply
      @real_num = @num
      @battler.send("real_#{@type.id2name}=".to_sym, @real_num)
      # ビットマップの更新
      update_bitmap
    end
  end
  #--------------------------------------------------------------------------
  # ● ビットマップの更新
  #--------------------------------------------------------------------------
  def update_bitmap
    self.bitmap.clear
    # 数値を文字列の配列にする
    numbers = (@real_num.to_i.abs.to_s).split(//)
    # 数字の色
    sy = @num_height * number_color
    # ダメージ値の幅
    nw = @num_width * numbers.size + @spacing * (numbers.size - 1)
    # 描画 X 座標
    case @align
    when 0 ; bx = 0                            # 左揃え
    when 1 ; bx = (self.bitmap.width - nw) / 2 # 中央揃え
    when 2 ; bx = self.bitmap.width - nw       # 右揃え
    end
    # 数字を描画
    rect = Rect.new(0, sy, @num_width, @num_height)
    numbers.size.times do |n|
      rect.x = numbers[n].to_i * @num_width
      self.bitmap.blt(bx + @num_width * n + @spacing * n, 0, @src_bitmap, rect)
    end
  end
end

#==============================================================================
# ■ [追加]:Sprite_StateIcon
#------------------------------------------------------------------------------
#  バトルステータス:ステートアイコンをスクロール表示するスプライト。
#==============================================================================

class Sprite_StateIcon < Sprite_BattleStatus
  #--------------------------------------------------------------------------
  # ● [追加]:公開インスタンス変数
  #--------------------------------------------------------------------------
  attr_reader :min_offset   # ステータス描画 X 座標の位置修正
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize(battler, bufwindow, format, viewport = nil)
    super(viewport)
    @battler = battler
    @bufwindow = bufwindow
    @size = format[:size]
    @background_color = format[:background_color]
    @scroll_interval = format[:scroll_interval]
    @icons = [-128]
    self.visible = false
    # リフレッシュ
    refresh
  end
  #--------------------------------------------------------------------------
  # ● 解放
  #--------------------------------------------------------------------------
  def dispose
    bitmap_dispose
    super
  end
  #--------------------------------------------------------------------------
  # ● ビットマップの解放
  #--------------------------------------------------------------------------
  def bitmap_dispose
    self.visible = false
    self.bitmap.dispose if self.bitmap && !self.bitmap.disposed?
    self.bitmap = nil
  end
  #--------------------------------------------------------------------------
  # ● ステートアイコン配列の取得
  #--------------------------------------------------------------------------
  def icons
    @battler.state_icons + @battler.buff_icons
  end
  #--------------------------------------------------------------------------
  # ● ステートアイコン数の取得
  #--------------------------------------------------------------------------
  def icons_size
    @bufwindow.states(@battler, @bufwindow.contents_width)
  end
  #--------------------------------------------------------------------------
  # ● スクロールのリセット
  #--------------------------------------------------------------------------
  def reset_scroll
    self.src_rect.x = 0
  end
  #--------------------------------------------------------------------------
  # ● スクロールを進める
  #--------------------------------------------------------------------------
  def update_scroll
    self.src_rect.x += self.src_rect.width
    reset_scroll if self.src_rect.x >= self.bitmap.width
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  def update
    update_scroll if self.bitmap && Graphics.frame_count % @scroll_interval == 0
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  def refresh
    i = icons
    return if @icons == i
    @icons = i
    i_size = icons_size
    # ビットマップの作成
    bitmap_dispose if self.bitmap && !self.bitmap.disposed?
    return if i_size == 0
    self.visible = true
    self.bitmap = Bitmap.new(i_size * 24, 24)
    self.src_rect.set(0, 0, @size * 24, 24)
    # バッファウィンドウにアイコンの描画
    @bufwindow.contents.clear
    @bufwindow.draw_actor_icons(@battler, 0, 0, @bufwindow.contents_width)
    # 描画したアイコンをビットマップに転送
    self.bitmap.fill_rect(self.bitmap.rect, @background_color)
    self.bitmap.blt(0, 0, @bufwindow.contents, self.bitmap.rect)
    @bufwindow.contents.clear
    reset_scroll
  end
end
Code:
#==============================================================================
# ★ RGSS3-Extension
# LNX11bskin_リフォーム・バトルステータス#スキン設定
#  ☆「スタンダード」プリセット
#
#  このスクリプトは LNX11b_リフォーム・バトルステータス の設定スクリプトです。
#  LNX11b の動作に必須ですので、必ず導入してください。
#  スキンファイルは Graphics/System にインポートしてください。
#   
#  version   : 1.00 (12/02/28)
#  author    : ももまる
#  website   : http://peachround.com/
#  license   : http://creativecommons.org/licenses/by/2.1/jp/
#
#==============================================================================

module LNX11
  #--------------------------------------------------------------------------
  # ● 基本設定
  #--------------------------------------------------------------------------
  # ステータス全体の座標調整  :x = X座標 / :y = Y座標 :y => 7}
  STATUS_OFFSET = {:x => 52, :y => -1}
  
  # アクター1人あたりのステータス幅
  STATUS_WIDTH  = 64
end
module LNX11b
  #--------------------------------------------------------------------------
  # ● メインスキン
  #--------------------------------------------------------------------------
  MAIN_SKIN = {
  :enabled => true,                # 表示するか? true = 表示 / false = 非表示
  :bitmap  => "Lnx11b_mainskin",   # スキンのファイル名
  :x_fixed => true,   # X 座標を自動調整しない   true = 有効 / false = 無効
  :x =>  -80, :y => 18, :z =>  0,    # XYZ 座標
  }
  #--------------------------------------------------------------------------
  # ● ステートスキン
  #--------------------------------------------------------------------------
  STATE_SKIN = {
  :enabled => true,                # 表示するか? true = 表示 / false = 非表示
  :bitmap  => "Lnx11b_stateskin",  # スキンのファイル名
  :x_fixed => true,      # X 座標を自動調整しない true = 有効 / false = 無効
  :x => -64, :y => -86, :z => 1,   # XYZ 座標
  }
  #--------------------------------------------------------------------------
  # ● ステートアイコン
  #--------------------------------------------------------------------------
  STATE_ICON = {
  # ○ 基本
  :enabled => true,    # 表示するか?           true = 表示 / false = 非表示
  :x_fixed => true,    # X 座標を自動調整しない true = 有効 / false = 無効
  :x => -32, :y => -81, :z => 2,    # XYZ 座標
  # ○ 機能
  :size             => 1,          # 一度に表示するアイコン数
  :scroll_interval  => 10,         # スクロール速度(フレーム)
  :background_color => Color.new(0, 0, 0, 0),  # ステートアイコンの背景色
  }
  #--------------------------------------------------------------------------
  # ● 名前 
  #--------------------------------------------------------------------------
  NAME = {
  # ○ 基本
  :enabled => true,   # 表示するか?           true = 表示 / false = 非表示
  :x_fixed => true,   # X 座標を自動調整しない true = 有効 / false = 無効
  :x => -72, :y => 23, :z => 2,     # XYZ 座標
  # ○ 機能
  :bitmap_name => false, # 名前表示に画像を使用する true = 有効 / false = 無効
  
    # bitmap_name => false :  名前表示に画像を使用しない場合
    :width  => 104, :height => 25, # 名前のサイズ :width = 幅 / :height = 高さ
    :name   => ["HelvetiPixel"], # フォント名
    :size   => 32,            # フォントサイズ 27.9
    :bold   => false,         # 太字    true = 有効 / false = 無効
    :italic => false,         # 斜体    true = 有効 / false = 無効
    :align  => 1,             # 文字揃え 0 = 左揃え / 1 = 中央揃え / 2 = 右揃え
    # 描画色([文字色, 縁取り色])
    :color  => [Color.new(255, 255, 255), Color.new(0, 0, 0, 0)],
    
  # ステートが表示されている時、自動的に隠す true = 有効 / false = 無効
  :auto_hide   => false
  }
  #--------------------------------------------------------------------------
  # ● HP ゲージ
  #--------------------------------------------------------------------------
  HP_GAUGE_FORMAT = {
  # ○ 基本
  :enabled => true,              # 表示するか?   true = 表示 / false = 非表示
  :bitmap  => "Lnx11b_hpgauge",  # ゲージのファイル名
  :x_fixed => true,     # X 座標を自動調整しない true = 有効 / false = 無効
  :x => -34, :y => 46, :z => 2,    # XYZ 座標
  # ○ 機能
  :number_link => true,  # ゲージ量を表示されている表示と一致させる
  :speed      => 5.0,   # ゲージ変化スピード 1.0以上(一致させない場合)
  :type        => 0,     # ゲージタイプ 0 = 横ゲージ / 1 = セルゲージ
  
    # type => 0 : 横ゲージの設定
    :crisis    => 0,  # ピンチ状態とみなすパーセンテージ
    :s_speed   => 0.1,   # サブゲージ変化スピード(pixel per frame)
    
    # type => 1 : セルゲージの設定
    :width => 67, :height => 22, # セルのサイズ :width = 幅 / :height = 高さ
    :pattern   => :auto, # パターン数 :auto を指定するとパターン数を自動判定
    :direction => 1,     # パターンの方向 0 = 横 / 1 = 縦
  }
  #--------------------------------------------------------------------------
  # ● MP ゲージ
  #--------------------------------------------------------------------------
  MP_GAUGE_FORMAT = {
  # ○ 基本
  :enabled => true,             # 表示するか?     true = 表示 / false = 非表示
  :bitmap  => "Lnx11b_mpgauge", # ゲージのファイル名
  :x_fixed => true,      # X 座標を自動調整しない true = 有効 / false = 無効
  :x => -72, :y => 70, :z => 2,   # XYZ 座標
  # ○ 機能
  :number_link => true,   # ゲージ量を表示されている表示と一致させる
  :speed      => 2.0,    # ゲージ変化スピード 1.0以上(一致させない場合)  
  :type        => 0,      # ゲージタイプ 0 = 横ゲージ / 1 = セルゲージ
  
    # type => 0 : 横ゲージの設定
    :crisis    => 0.25,   # ピンチ状態とみなすパーセンテージ
    :s_speed   => 0.2,    # サブゲージ変化スピード(pixel per frame)  
    
    # type => 1 : セルゲージの設定
    :width     => 36, :height => 36, # セルのサイズ :width = 幅 / :height = 高さ
    :pattern   => :auto,  # パターン数 :auto を指定するとパターン数を自動判定
    :direction => 1,      # パターンの方向 0 = 横 / 1 = 縦
  }
  #--------------------------------------------------------------------------
  # ● TP ゲージ
  #--------------------------------------------------------------------------
  TP_GAUGE_FORMAT = {
  # ○ 基本
  :enabled => false,             # 表示するか?   true = 表示 / false = 非表示
  :bitmap  => "Lnx11b_tpcircle", # ゲージのファイル名
  :x_fixed => false,     # X 座標を自動調整しない true = 有効 / false = 無効
  :x => 16, :y => 0, :z => 3,    # XYZ 座標
  # ○ 機能
  :number_link => true,  # ゲージ量を表示されている表示と一致させる
  :speed      => 2.0,   # ゲージ変化スピード 1.0以上(一致させない場合)  
  :type        => 1,     # ゲージタイプ 0 = 横ゲージ / 1 = セルゲージ
  
    # type => 0 : 横ゲージの設定
    :crisis    => 0.25,  # ピンチ状態とみなすパーセンテージ
    :s_speed   => 0.2,   # サブゲージ変化スピード(pixel per frame)
    
    # type => 1 : セルゲージの設定
    :width     => 36, :height => 36, # セルのサイズ :width = 幅 / :height = 高さ
    :pattern   => :auto, # パターン数 :auto を指定するとパターン数を自動判定
    :direction => 1,     # パターンの方向 0 = 横 / 1 = 縦
  }
  #--------------------------------------------------------------------------
  # ● HP 数字
  #--------------------------------------------------------------------------
  HP_NUMBER_FORMAT = {
  # ○ 基本
  :type    => :hp,                  # 数値種別
  :meter   => true,                 # メーター表示
  :guard_brake => true,             # 防御中減速
  :brake_ratio => 30,                # 減速率
  :enabled => true,                 # 表示するか? true = 表示 / false = 非表示
  :bitmap  => "Param_reel",         # 数字のファイル名
  :x_fixed => true,   # X 座標を自動調整しない    true = 有効 / false = 無効
  :x => 32, :y => 48, :z => 4,      # XYZ 座標
  # ○ 機能
  :digit   => 4,       # 桁数
  :spacing => -2,      # 字間
  :align   => 2,       # 文字揃え 0 = 左揃え / 1 = 中央揃え / 2 = 右揃え
  :speed   => 15,      # 数字の変化スピード 1 以上
  :crisis  => 0.25,    # ピンチ状態とみなすパーセンテージ
  :dead    => 0.0,     # 死亡状態とみなすパーセンテージ
  }
  #--------------------------------------------------------------------------
  # ● MP 数字
  #--------------------------------------------------------------------------
  MP_NUMBER_FORMAT = {
  # ○ 基本
  :type    => :mp,                  # 数値種別
  :meter   => true,                 # メーター表示
  :guard_brake => false,            # 防御中減速
  :brake_ratio => 1,                # 減速率
  :enabled => true,                 # 表示するか? true = 表示 / false = 非表示
  :bitmap  => "Param_reel",         # 数字のファイル名
  :x_fixed => true,   # X 座標を自動調整しない    true = 有効 / false = 無効
  :x => -6, :y => 72, :z => 4,      # XYZ 座標
  # ○ 機能
  :digit   => 4,       # 桁数
  :spacing => -2,      # 字間
  :align   => 2,       # 文字揃え 0 = 左揃え / 1 = 中央揃え / 2 = 右揃え
  :speed   => 3,      # 数字の変化スピード 1 以上
  :crisis  => 0.25,    # ピンチ状態とみなすパーセンテージ
  :dead    => -1.0,    # 死亡状態とみなすパーセンテージ
  }
  #--------------------------------------------------------------------------
  # ● TP 数字
  #--------------------------------------------------------------------------
  TP_NUMBER_FORMAT = {
  # ○ 基本
  :type    => :tp,                  # 数値種別
  :meter   => false,                # メーター表示
  :guard_brake => false,            # 防御中減速
  :brake_ratio => 1,                # 減速率
  :enabled => false,                # 表示するか? true = 表示 / false = 非表示
  :bitmap  => "Lnx11b_smallnumber", # 数字のファイル名
  :x_fixed => false,   # X 座標を自動調整しない    true = 有効 / false = 無効
  :x => 34, :y => 14, :z => 5,      # XYZ 座標
  # ○ 機能
  :digit   => 3,       # 桁数
  :spacing => -2,      # 字間
  :align   => 1,       # 文字揃え 0 = 左揃え / 1 = 中央揃え / 2 = 右揃え
  :speed   => 12,      # 数字の変化スピード 1 以上
  :crisis  => -1.0,    # ピンチ状態とみなすパーセンテージ
  :dead    => -1.0,    # 死亡状態とみなすパーセンテージ
  }
  #--------------------------------------------------------------------------
  # ● 最大 HP 数字
  #--------------------------------------------------------------------------
  MAXHP_NUMBER_FORMAT = {
  # ○ 基本
  :type    => :hp,                  # 数値種別
  :enabled => false,                # 表示するか? true = 表示 / false = 非表示
  :bitmap  => "Lnx11b_smallnumber", # 数字のファイル名
  :x_fixed => false,   # X 座標を自動調整しない    true = 有効 / false = 無効
  :x => 64, :y => 39, :z => 6,      # XYZ 座標
  # ○ 機能
  :digit   => 4,       # 桁数
  :spacing => -2,      # 字間
  :align   => 0,       # 文字揃え 0 = 左揃え / 1 = 中央揃え / 2 = 右揃え
  :speed   => 12,      # 数字の変化スピード 1 以上
  :crisis  => 0.25,    # ピンチ状態とみなすパーセンテージ
  :dead    => 0.0,     # 死亡状態とみなすパーセンテージ
  }  
  #--------------------------------------------------------------------------
  # ● 最大 MP 数字
  #--------------------------------------------------------------------------
  MAXMP_NUMBER_FORMAT = {
  # ○ 基本
  :type    => :mp,                  # 数値種別
  :enabled => false,                # 表示するか? true = 表示 / false = 非表示
  :bitmap  => "Lnx11b_smallnumber", # 数字のファイル名
  :x_fixed => false,   # X 座標を自動調整しない    true = 有効 / false = 無効
  :x => 64, :y => 61, :z => 6,      # XYZ 座標
  # ○ 機能
  :digit   => 4,       # 桁数
  :spacing => -2,      # 字間
  :align   => 0,       # 文字揃え 0 = 左揃え / 1 = 中央揃え / 2 = 右揃え
  :speed   => 12,      # 数字の変化スピード 1 以上
  :crisis  => 0.25,    # ピンチ状態とみなすパーセンテージ
  :dead    => -1.0,    # 死亡状態とみなすパーセンテージ
  }  
  #--------------------------------------------------------------------------
  # ● 最大 TP 数字
  #--------------------------------------------------------------------------
  MAXTP_NUMBER_FORMAT = {
  # ○ 基本
  :type    => :t,                  # 数値種別
  :enabled => false,                # 表示するか? true = 表示 / false = 非表示
  :bitmap  => "Lnx11b_smallnumber", # 数字のファイル名
  :x_fixed => false,   # X 座標を自動調整しない    true = 有効 / false = 無効
  :x => 34, :y => 26, :z => 6,      # XYZ 座標
  # ○ 機能
  :digit   => 3,       # 桁数
  :spacing => -2,      # 字間
  :align   => 1,       # 文字揃え 0 = 左揃え / 1 = 中央揃え / 2 = 右揃え
  :speed   => 12,      # 数字の変化スピード 1 以上
  :crisis  => -1.0,    # ピンチ状態とみなすパーセンテージ
  :dead    => -1.0,    # 死亡状態とみなすパーセンテージ
  }
  #
  # 設定ここまで お疲れ様でした。
  #
end
#==============================================================================
# ■ LNXスクリプト導入情報
#==============================================================================
$lnx_include = {} if $lnx_include == nil
$lnx_include[:lnx11bskin] = 100 # version
p "OK:LNX11bskin_リフォーム・バトルステータス#スキン設定"
.... the MAIN_SKIN has been transformed into a parameter function.
And furthermore, compiled with the rest of the sprites.
It's well organized.

Since you wanted the filename to keep updated in real time, other than to modify the script, I can only think of a non-recommended ugly solution which I'm not even sure it's gonna work... (I'll just contact you directly for this)

Perhaps @TheoAllen have better opinion on this matter?
Quick Update.
I do not want the script to be realtime.
I want it to be changed outside of battles and in a options menu.
Meaning if the player choose this number in the variable the script would read that and use it the next time it goes into a battle.
Code:
class Spriteset_BattleStatus
  def create_skin(format)
    return nil unless format[:enabled]
    format.clone
    format[:bitmap] += $game_variables[99].to_s
    sprite = Sprite_Skin.new(format, @viewport)
    move(sprite, format)
    return sprite
  end
end
Try this. Obviously, change the variable id 99 to something else
Code:
class Spriteset_BattleStatus
  def create_skin(format)
    return nil unless format[:enabled]
    format.clone
    format[:bitmap] += $game_variables[99].to_s
    sprite = Sprite_Skin.new(format, @viewport)
    move(sprite, format)
    return sprite
  end
end
Try this. Obviously, change the variable id 99 to something else
Where should I place this? The places I put it in don't seem to be doing anything.
Put it as a new script
Ah, thank you!

Original thread: https://forums.rpgmakerweb.com/threads/vxace-adding-a-variable-with-the-filename-of-a-bitmap-in-script.112047/