Control Characters Everywhere - Version: 1.0
By: Brewmeister
Introduction
Extends the use of Control Characters (\v[n], \N[n], \C[n]) to descriptions, names, pretty much anything in the database...
Developed for RMXP, but should work in RMVX as well.
Screenshots

Demo
N/A
Script
Instructions
Paste Above Main
FAQ
Can I add colors?
Sure, to add "Bright Red" for example... after line 70 insert:
Can I have more than one color in a name or description?
No. Not with this script. This script sets the color before drawing the string.
Unlike the message script, that draws the characters one at a time.
Compatibility
Incompatible with Ccoa's UMS. (\name[#] won't convert the control characters correctly.)
Extends the Bitmap.draw_text method & supports both draw_text(x, y, width, height, str[, align]) and draw_text(rect, str[, align]) formats
Author's Notes
In response to several requests to display item names in different colors.
Terms and Conditions
Please link to this thread instead of posting the script elsewhere. (even though I've posted it elsewhere) :scruff:
Feel free use for any legal purpose you can think of. Feel free to edit, modify, bend, spindle mutilate.
If you make edits or additions, please post them here so I can either include them, or link to them as enhancements.
By: Brewmeister
Introduction
Extends the use of Control Characters (\v[n], \N[n], \C[n]) to descriptions, names, pretty much anything in the database...
Developed for RMXP, but should work in RMVX as well.
Screenshots
Database
Show

In Game
Show


Demo
N/A
Script
- #---------------------------------------------------------------------------
- #
- # 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
- if str.is_a?(String)
- text = str.clone
- else
- text = str.to_s
- end
- # 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]+)\]/, "")
- if $1 != nil
- color = $1.to_i
- 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
- end
- end
Expand to see the code.
Instructions
Paste Above Main
FAQ
Can I add colors?
Sure, to add "Bright Red" for example... after line 70 insert:
when 8
return Color.new(255, 0, 0, 255)
Can I have more than one color in a name or description?
No. Not with this script. This script sets the color before drawing the string.
Unlike the message script, that draws the characters one at a time.
Compatibility
Incompatible with Ccoa's UMS. (\name[#] won't convert the control characters correctly.)
Extends the Bitmap.draw_text method & supports both draw_text(x, y, width, height, str[, align]) and draw_text(rect, str[, align]) formats
Author's Notes
In response to several requests to display item names in different colors.
Terms and Conditions
Please link to this thread instead of posting the script elsewhere. (even though I've posted it elsewhere) :scruff:
Feel free use for any legal purpose you can think of. Feel free to edit, modify, bend, spindle mutilate.
If you make edits or additions, please post them here so I can either include them, or link to them as enhancements.


