I wanted a script that you can use the \c[#] tags in item descriptions to change the color, and I found one. The problem is, it only works with 1 \c[#] tag.
So if I write in the description:
"\c[7] Req Lv.5 \c[0] This sword is a fancy one!"
I will get:
"Req Lv.5 \c[0] This sword is a fancy one!" all in gray, when I just wanted "Req Lv.5" in gray.
So if I write in the description:
"\c[7] Req Lv.5 \c[0] This sword is a fancy one!"
I will get:
"Req Lv.5 \c[0] This sword is a fancy one!" all in gray, when I just wanted "Req Lv.5" in gray.
Code:
#---------------------------------------------------------------------------## Control Characters work for object descriptions & names.# Actor, Class, Items, Weapons, Armors, Skills, Enemies# Valid Control Characters: \V[n], \N[n], \C[n]## 12Feb09 - Brew (ref: RRR_supt)#---------------------------------------------------------------------------class Bitmap alias draw_parsed_text draw_text def draw_text(*args) #parse the text if args[0].is_a?(Rect) x = args[0].x y = args[0].y width = args[0].width height = args[0].height str = args[1] align = args[2] != nil ? args[2] : 0 else x = args[0] y = args[1] width = args[2] height = args[3] str = args[4] align = args[5] != nil ? args[5] : 0 end # If waiting for a message to be displayed if str != nil text = str.clone # Control text processing begin last_text = text.clone text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] } end until text == last_text text.gsub!(/\\[Nn]\[([0-9]+)\]/) do $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : "" end # Change "\\C" to "\001" and "\\G" to "\002" text.sub!(/\\[Cc]\[([0-9]+)\]/, "") color = $1.to_i if color >= 0 and color <= 7 and font.color == text_color(0) font.color = text_color(color) end end draw_parsed_text(x, y, width, height, text, align) end #-------------------------------------------------------------------------- # * Get Text Color # n : text color number (0-7) #-------------------------------------------------------------------------- def text_color(n) case n when 0 return Color.new(255, 255, 255, 255) when 1 return Color.new(128, 128, 255, 255) when 2 return Color.new(255, 128, 128, 255) when 3 return Color.new(128, 255, 128, 255) when 4 return Color.new(128, 255, 255, 255) when 5 return Color.new(255, 128, 255, 255) when 6 return Color.new(255, 255, 128, 255) when 7 return Color.new(192, 192, 192, 255) else return Color.new(255, 255, 255, 255) end endend