Save-Point
Command Color XP - Printable Version

+- Save-Point (https://www.save-point.org)
+-- Forum: Material Development (https://www.save-point.org/forum-8.html)
+--- Forum: Scripts Database (https://www.save-point.org/forum-39.html)
+---- Forum: RPGMaker XP (RGSS) Engine (https://www.save-point.org/forum-116.html)
+---- Thread: Command Color XP (/thread-11590.html)



Command Color XP - kyonides - 06-16-2025

Command Color XP

by Kyonides

Did you ever want to change your command window's currently selected command a little bit? Thinking
Now you can do it! Shocked
This scriptlet lets you alter its color! Painter

Just configure the SELECT_COLOR constant accordingly and that's it! Two Thumbs Up! 

Code:
# * Command Color XP * #
#   Scripter : Kyonides
#   v0.5.0 - 2025-06-15

# The SELECT_COLOR Constant lets you configure your custom color following
# the usual (R,G,B) or (R,G,B,A) color format.

class Window_Command
  SELECT_COLOR = Color.new(255, 255, 0)
  DISABLED_ALPHA = 100
  alias :kyon_cmd_clr_win_comm_init :initialize
  alias :kyon_cmd_clr_win_comm_set_index :index=
  alias :kyon_cmd_clr_win_comm_dis_item :disable_item
  alias :kyon_cmd_clr_win_comm_up :update
  def initialize(width, commands)
    @disabled = []
    @last_pos = -1
    kyon_cmd_clr_win_comm_init(width, commands)
  end

  def index=(new_index)
    return if @index == new_index
    if @index >= 0
      last_color = @disabled.include?(@index)? disabled_color : normal_color
      draw_item(@index, last_color)
      @last_pos = @index
    end
    kyon_cmd_clr_win_comm_set_index(new_index)
    update_command_color
  end

  def disable_item(index)
    @disabled << index
    @disabled = @disabled.sort.uniq
    kyon_cmd_clr_win_comm_dis_item(index)
  end

  def update_command
    return if @last_pos == @index
    if @last_pos >= 0
      last_color = @disabled.include?(@last_pos)? disabled_color : normal_color
      draw_item(@last_pos, last_color)
    end
    update_command_color
    @last_pos = @index
  end

  def update_command_color
    new_color = SELECT_COLOR.dup
    new_color.alpha = @disabled.include?(@index)? DISABLED_ALPHA : 255
    draw_item(@index, new_color)
  end

  def update
    kyon_cmd_clr_win_comm_up
    update_command
  end
end

Terms & Use

Free as in Beer beer.
Crediting me as the author is optional. Winking
That's it! Tongue sticking out