VXAce Turn count for Neon Black's Scrolling states

I was wondering if anyone could modify Neon Black's script so that it also shows how many turns of the state are left. Roninator2 did something similar for a different scrolling states script (here). I have a script that displays state icons on enemies, and that one has turn counts, so it would be great if the actors had the counts, too. Thanks in advance! 😍
Hello,

The pastebin link to Neon Black's script is broken and it's not in the saved scripts repository, but I found it with wayback machine.

I tried to write an addon, you can set a few parameters in the module:
Ruby:
#==============================================================================
# CP Scrolling States addon: Turns count
#------------------------------------------------------------------------------
# Author: Timtrack
# date: 14/01/2026
# Requires: CP Scrolling States v1.1 by Neon Black
#==============================================================================

$imported ||= {}
$imported["TIM-CP-SCROLLING-STATES-Turns-addon"] =  true

#==============================================================================
# Description: add turn count on states and buffs/debuffs if used with Scrolling
# States script
#==============================================================================
# Term of use: free for commercial and free games
#==============================================================================

module TIM
  module CP_ScrollStates_Turns
    FONT_SIZE = 22 #set nil to use the default font size, 22 is the vanilla size
    COLOR = 0 #id of color of windowskin, default is 0
    X_ALIGNMENT = 0 #0 for left, 1 for center, 2 for right
    Y_ALIGNMENT = 0 #0 for up, 1 for center, 2 for down
  end # CP_ScrollStates_Turns
end #TIM

#==============================================================================
# DON'T EDIT THINGS BELOW HERE (unless you know what you are doing ^^)
#==============================================================================

#==============================================================================
# Game_BattlerBase
#==============================================================================
class Game_BattlerBase
  #---------------------------------------------------------------------------
  # new method: state_icons_turns
  #---------------------------------------------------------------------------
  def state_icons_turns
    states.select{|s| s.icon_index > 0}.collect do |s|
      s.auto_removal_timing != 0 ? @state_turns[s.id] : nil
    end
  end
 
  #---------------------------------------------------------------------------
  # new method: buff_icons_turns
  #---------------------------------------------------------------------------
  def buff_icons_turns
    res = []
    @buffs.each_with_index do |lv, i|
      res.push(@buff_turns[i]) if buff_icon_index(lv, i) > 0
    end
    res
  end
end #Game_BattlerBase

#==============================================================================
# Scroll_States
#==============================================================================
class Scroll_States  ## This class holds the state icons for windows.
  attr_reader :icon_timers
 
  #---------------------------------------------------------------------------
  # alias method: initialize -> prototype now uses actor instead of icons!
  #---------------------------------------------------------------------------
  alias tim_timers_nb_scroll_states_init initialize
  def initialize(x, y, width, actor, level = 0)
    icons = actor.state_icons + actor.buff_icons
    @timers = actor.state_icons_turns + actor.buff_icons_turns
    @icon_timers = []
    tim_timers_nb_scroll_states_init(x, y, width, icons, level)
  end
 
  #---------------------------------------------------------------------------
  # alias method: update_icons -> do basically the same process as aliased
  # method but for timers of each icon
  #---------------------------------------------------------------------------
  alias tim_timers_nb_update_icons update_icons
  def update_icons(level)
    tim_timers_nb_update_icons(level)
    return @icon_timers = [nil] if @states.empty?
    total = @width / 24
    return @icon_timers = @timers if total >= @states.size # No refresh needed.
    start = (level / CP::SCROLL_STATES::TRANS) % @states.size
    double = @timers + @timers
    top = [double.size, start + total].min
    @icon_timers = []
    for i in start...top  ## Create the shown timers in order.
      @icon_timers.push(double[i])
    end
  end
end #Scroll_States

#==============================================================================
# Window_Base
#==============================================================================
class Window_Base
  #---------------------------------------------------------------------------
  # alias method: draw_icons_area
  #---------------------------------------------------------------------------
  alias tim_timers_nb_draw_icons_area draw_icons_area
  def draw_icons_area(area)
    tim_timers_nb_draw_icons_area(area)
    draw_icon_area_turns(area)
  end
 
  #---------------------------------------------------------------------------
  # new method: draw_icon_area_turns
  #---------------------------------------------------------------------------
  def draw_icon_area_turns(area)
    color = TIM::CP_ScrollStates_Turns::COLOR
    change_color(text_color(color)) if color
    fs = TIM::CP_ScrollStates_Turns::FONT_SIZE
    contents.font.size = fs if fs
    align = TIM::CP_ScrollStates_Turns::X_ALIGNMENT
    y_align = TIM::CP_ScrollStates_Turns::Y_ALIGNMENT
    area.icon_timers.each_with_index do |n, i|
      next unless n #nil case
      text = n.to_s
      h = text_size(text).height
      dy = (24 - h)/2 * y_align
      dy = 0 if dy < 0 #can't draw text out of icon
      draw_text(area.x + 24 * i, area.y + dy, 24, h, text, align)
    end
    reset_font_settings
  end

  #---------------------------------------------------------------------------
  # overwrite method: draw_actor_icons
  #---------------------------------------------------------------------------
  def draw_actor_icons(actor, x, y, width = 96)  ## Overwrite this method.
    icons = (actor.state_icons + actor.buff_icons)
    key = [x, y, width]
    clear_icon_area(key)
    temp = Scroll_States.new(x, y, width, actor) #changed line
    @icon_areas[key] = temp
    rect = Rect.new(x, y, width, 24)
    @icon_areas[key].bitmap.blt(0, 0, contents, rect)
    draw_icons_area(@icon_areas[key])  ## Draw the newest set.
  end
end #Window_Base
I'm sorry you had to look for the script in such a complicated way - I forgot to check if the link to the script works when I was linking the forum page :LZSsad:

I added your script and tried a battle and it works great 👍 Thank you so much!

Original thread: https://forums.rpgmakerweb.com/threads/turn-count-for-neon-blacks-scrolling-states.181938/