New account registration is temporarily disabled.

DATABASE SCRIPT HELP

Posts

Pages: 1
I want to change the Color and add an Icon of all my Submenu's in my Menu. Items, Skills, Ect.
However my Bitmap database script only changes the color or adds Icons to things in the data base. My Beastery Script for example is not in the database, so I would have to change the color in the Script now I have seen these commands before the name that goes in to the menu and if you change it it will change color. Is their any other colors you can change it to.

self.contents.font.color = system_color


self.contents.font.color = normal_color


\IC Replaced by the icon with the index n (n = Index of icon in the Iconset).

Here is the Script.
#==============================================================================
# ** Enhanced Bitmap#draw_text (by ERZENGEL at 27-April-2008 at 19:53)
#------------------------------------------------------------------------------
# Bitmap#draw_text is able to convert control characters.
#==============================================================================
=begin
###############################################################################

Default control characters:

\V Replaced by the value of variable n (n = ID of a variable).
\N Replaced by the name of actor n (n = ID of an actor).
\C Change the color of the following text(n = 0 til 31).
\G Replaced by the current gold amount.
\\ Replaced by the '\' character.

Control characters from woratanas NMS (v2.52):

\MAP Replaced by the current map name.
\NC Replaced by the class of actor n (n = ID of an actor).
\NP Replaced by the name of actor n in the party (n = integer between 1 and 4).
\NM Replaced by the name of enemy n (n = ID of an enemy).
\NT Replaced by the name of troop n (n = ID of a troop).
\NI Replaced by the name of item n (n = ID of an item).
\NW Replaced by the name of weapon n (n = ID of a weapon).
\NA Replaced by the name of armor n (n = ID of an armor).
\NS Replaced by the name of skill n (n = ID of a skill).
\PRICE Replaced by the price of the item n (n = ID of an item).
\IC Replaced by the icon with the index n (n = Index of icon in the Iconset).
\DW Replaced by the icon and name of weapon n (n = ID of a weapon).
\DI Replaced by the icon and name of item n (n = ID of an item).
\DA Replaced by the icon and name of armor n (n = ID of an armor).
\DS Replaced by the icon and name of skill n (n = ID of a skill).
\FN Following text is in font str (str = name of a font).
\FS Following text is in fontsize n (n = integer. Standard is 20).

Other control characters:

\BO Following text is or isn't bold.
\IT Following text is or isn't italic.
\SH Folling text is or isn't shadowed.
\AL Align text (n = integer between 0 and 2 (0 = left, 1 = center, 2 = right)).

###############################################################################
=end
#==============================================================================
# ** Bitmap
#==============================================================================
class Bitmap
#--------------------------------------------------------------------------
# * Draw text
#--------------------------------------------------------------------------
alias :erzvx_draw_text :draw_text unless $@
def draw_text(*args)
# Falls erstes Argument ein Rectobjekt ist
if args.is_a?(Rect)
if args.size > 3 then raise(ArgumentError) end
x, y, width, height = args.x, args.y, args.width, args.height
str = args
align = args
else
if args.size > 6 then raise(ArgumentError) end
x, y, width, height, str, align = args
end
# Links ausrichten, falls Wert von align nil oder größer als 2 ist
align = 0 if align.nil? || align > 2
# Standardeigenschaften in Variablen speichern
name, size, color = self.font.name, self.font.size, self.font.color
bold, italic, shadow = self.font.bold, self.font.italic, self.font.shadow
# Temporäre Variablen erstellen
tstr = (str.is_a?(String) ? str : str.to_s) + "\n"; tc = ''; tx = 0
begin
lasttstr = tstr.clone
tstr = convert_special_characters(tstr)
end until tstr == lasttstr
while (!(c = tstr.slice!(/./m)).nil?)
case c
when "\x01" # \C
tstr.sub!(/\[(+)\]/, "")
tcolor = $1.to_i
self.font.color = text_color(tcolor) if tcolor >= 0 && tcolor <= 31
when "\x02" # \C
tstr.sub!(/\[(+)\]/, "")
align = $1.to_i
when "\x83" # \IC
tstr.sub!(/\[(+)\]/, "")
icon_index = $1.to_i
draw_icon(icon_index, x, y)
tx += 24
when "\x84" # \FN
tstr.sub!(/\/, "")
self.font.name = $1.to_s
when "\x85" # \FS
tstr.sub!(/\[(+)\]/, "")
self.font.size = $1.to_i
when "\x88" # \BO
self.font.bold = !self.font.bold
when "\x89" # \IT
self.font.italic = !self.font.italic
when "\x93" # \SH
self.font.shadow = !self.font.shadow
when "\n" # Neue Zeile
if align == 1 # Zentriert
tx = width - tx
tx = tx / 2
erzvx_draw_text((x + tx), y, (width - tx), height, tc)
elsif align == 2 # Rechts
tx = width - tx
erzvx_draw_text((x + tx), y, (width - tx), height, tc)
end
# Temporäre Variablen zurücksetzen
tc = tstr = ''; tx = 0
else # Normal text character
# Ausrichtungsabfrage (Links)
if align == 0
erzvx_draw_text((x + tx), y, width, height, c, align)
tx += text_size(c).width
else
tc += c
tx += text_size(c).width
end
end
end
# Standardeigenschaften wiederherstellen
self.font.name, self.font.size, self.font.color = name, size, color
self.font.bold, self.font.italic, self.font.shadow = bold, italic, shadow
end
#--------------------------------------------------------------------------
# * Convert Special Characters
#--------------------------------------------------------------------------
def convert_special_characters(str)
# Mit Wert einer Variable ersetzen
str.gsub!(/\\V\[(+)\]/i) { $game_variables }
# Mit Namen eines Heldens ersetzen
str.gsub!(/\\N\[(+)\]/i) { $game_actors.name }
# Nachfolgenden Text in anderer Farbe anzeigen
str.gsub!(/\\C\[(+)\]/i) { "\x01" }
# Mit dem aktuellen Goldbetrag ersetzen
str.gsub!(/\\G/) { $game_party.gold.to_s }
# Backslash anzeigen
str.gsub!(/\\\\/) { "\\" }
# Ausrichtung ändern
str.gsub!(/\\AL\[(+)\]/i) { "\x02" }
# Woratana's :: Map Name
str.gsub!(/\\MAP/i) { get_map_name }
# Woratana's :: Actor Class Name
str.gsub!(/\\NC\[(+)\]/i) {
$data_classes[$data_actors.class_id].name }
# Woratana's :: Party Actor Name
str.gsub!(/\\NP\[(+)\]/i) { $game_party.members.name }
# Woratana's :: Monster Name
str.gsub!(/\\NM\[(+)\]/i) { $data_enemies.name }
# Woratana's :: Troop Name
str.gsub!(/\\NT\[(+)\]/i) { $data_troops.name }
# Woratana's :: Item Name
str.gsub!(/\\NI\[(+)\]/i) { $data_items.name }
# Woratana's :: Weapon Name
str.gsub!(/\\NW\[(+)\]/i) { $data_weapons.name }
# Woratana's :: Armor Name
str.gsub!(/\\NA\[(+)\]/i) { $data_armors.name }
# Woratana's :: Skill Name
str.gsub!(/\\NS\[(+)\]/i) { $data_skills.name }
# Woratana's :: Item Price
str.gsub!(/\\PRICE\[(+)\]/i) { $data_items.price.to_s }
# Woratana's :: Draw Icon
str.gsub!(/\\IC\[(+)\]/i) { "\x83" }
# Woratana's :: Draw Weapon Name + Icon
str.gsub!(/\\DW\[(+)\]/i) {
"\x83[#{$data_weapons.icon_index}]\\NW" }
# Woratana's :: Draw Item Name + Icon
str.gsub!(/\\DI\[(+)\]/i) {
"\x83[#{$data_items.icon_index}]\\NI" }
# Woratana's :: Draw Armor Name + Icon
str.gsub!(/\\DA\[(+)\]/i) {
"\x83[#{$data_armors.icon_index}]\\NA" }
# Woratana's :: Draw Skill Name + Icon
str.gsub!(/\\DS\[(+)\]/i) {
"\x83[#{$data_skills.icon_index}]\\ns" }
# Woratana's :: Font Name Change
str.gsub!(/\\FN\/i) { "\x84" }
# Woratana's :: Font Size Change
str.gsub!(/\\FS\[(+)\]/i) { "\x85" }
# Woratana's :: BOLD Text
str.gsub!(/\\BO/i) { "\x88" }
# Woratana's :: ITALIC Text
str.gsub!(/\\IT/i) { "\x89" }
# Woratana's :: SHADOW Text
str.gsub!(/\\SH/i) { "\x93" }
return str
end
#--------------------------------------------------------------------------
# * Get Text Color
#--------------------------------------------------------------------------
def text_color(n)
x = 64 + (n % 8) * 8
y = 96 + (n / 8) * 8
windowskin = Cache.system('Window')
return windowskin.get_pixel(x, y)
end
#--------------------------------------------------------------------------
# * Get Map Name
#--------------------------------------------------------------------------
def get_map_name
$data_mapinfos = load_data('Data/MapInfos.rvdata') if $data_mapinfos.nil?
map_id = $game_map.map_id
return $data_mapinfos.name
end
#--------------------------------------------------------------------------
# * Draw Icon
#--------------------------------------------------------------------------
def draw_icon(icon_index, x, y)
bitmap = Cache.system('Iconset')
rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
self.blt(x, y, bitmap, rect)
end
end
Pages: 1