Sorry, I just read that you wanted -a and -b, not _a and _b, but unless you have serious objections, I think I will stick with the underscores. Anyway, here's what I have so far. I decided I would take your request and just go all out and make an Advanced Message System. Since I needed to overwrite a major method of Window_Message, my script would have been incompatible with pretty much any other message system, and I figured I could add in all those features, so why not?
Well, one reason why not is that I could easily have made mistakes. It might throw errors so I suggest you test it in a non-critical project, or a test project. I doubt anything will corrupt the entire project, but it won't hurt to be careful. Anyway yeah, there's a bunch of stuff in the code that you never asked for. Take a look in the comments for what those are.
#=======================================================================
# Modern Algebra Message Script
# Version 0.5
# Author: modern algebra
# February 22, 2008
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Special Thanks to:
# Arrow-1 for the request. I loved the animated facesets idea
# Zeriab for his regular expressions tutorial
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Current Features:
# - Precise letter-by-letter timing control
# - Animated Facesets
# - Can play a sound effect with each letter drawn
# - numerous additional codes - see below for all the codes
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Current Codes:
# - \< Slows the speed at which the text is drawn
# - \> Increases the speed at which the text is drawn
# - \b bold text
# - \i italicized text
# - \name[text] name box
# - \ne[enemy_id] name of enemy
# - \ni[item_id] Name of item
# - \nw[weapon_id] Name of weapon
# - \na[armor_id] Name of Armor
# - \pi[item_id] price of item
# - \pw[weapon_id] price of weapon
# - \pa[armor_id] price of Armor
# - \icon[icon_index] draw icon assigned to icon_index
# - \iicon[item_id] draw icon of item
# - \wicon[weapon_id] draw icon of weapon
# - \aicon[armor_id] draw icon of armor
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Instructions:
# Fill in the constants below for default settings. You can change pretty much all of these
# constants in-game with the codes:
#
# Message_Options.letter_by_letter_sound = true/false
# Message_Options.message_se = 'filename'
# Message_Options.default_timing = integer (lower = faster)
# Message_Options.namebox_windowskin = 'Windowskin'
# Message_Options.namebox_color = integer (0..32)
# Message_Options.namebox_fontname = 'font name'
# Message_Options.namebox_fontsize = 'Windowskin'
# Message_Options.namebox_offset_x = integer
# Message_Options.namebox_offset_y = integer
# Message_Options.opacity = integer (0..255)
#
# To use animated facesets, merely use a face graphic that ends with _a and you must have
# another faceset with the same name but ending with _b.
#=======================================================================
module Message_Options
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Constants
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DEFAULT_TIMING = 0 # The default amount of frames between each letter as it is drawn
LETTER_BY_LETTER_SOUND = true # Whether there should be an SE played with each character drawn
MESSAGE_SE = 'Open1' # The SE to be played if LETTER_BY_LETTER_SOUND == true
ANIMATED_FACESETS = true # true => active animated facesets; false => deactivated
NAMEBOX_WINDOWSKIN = "Window" # The windowskin for the name box
NAMEBOX_COLOR = 5 # The Color of the text in the namebox
NAMEBOX_FONTNAME = 'Times New Roman' # The Font of the namebox
NAMEBOX_FONTSIZE = 20 # The Size of the text in the namebox
NAMEBOX_OFFSET_X = 16 # How much the Namebox is in the X direction away from default
NAMEBOX_OFFSET_Y = 16 # How much the Namebox is in the Y direction away from default
NAMEBOX_OPACITY = 100 # The opacity of the name box
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Message SE (Lazy Initialization)
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def self.message_se
self.message_se = MESSAGE_SE if @message_se.nil?
return @message_se
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Message SE =
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def self.message_se= (file_name)
@message_se = RPG::SE.new (file_name)
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Message_SE_Active?
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def self.message_se_active?
@letter_by_letter_sound = LETTER_BY_LETTER_SOUND if @letter_by_letter_sound.nil?
return @letter_by_letter_sound
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Letter BY Letter Sound =
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def self.letter_by_letter_sound= (boolean)
@letter_by_letter_sound = boolean
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * NameBox Windowskin
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def self.namebox_windowskin
@namebox_windowskin = Cache.system (NAMEBOX_WINDOWSKIN) if @namebox_windowskin == nil
return @namebox_windowskin
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * NameBox Windowskin=
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def self.namebox_windowskin= (string)
@namebox_windowskin = Cache.system (string)
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * NameBox Color
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def self.namebox_color
@namebox_color = NAMEBOX_COLOR if @namebox_color == nil
return @namebox_color
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * NameBox Color=
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def self.namebox_color= (value)
@namebox_color = value
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * NameBox Fontname
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def self.namebox_fontname
@namebox_font = NAMEBOX_FONTNAME if @namebox_font == nil
return @namebox_font
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * NameBox Fontname=
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def self.namebox_fontname= (string)
@namebox_font = string
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * NameBox Fontsize
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def self.namebox_fontsize
@namebox_fontsize = NAMEBOX_FONTSIZE if @namebox_fontsize == nil
return @namebox_fontsize
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * NameBox Fontsize=
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def self.namebox_fontsize= (value)
@namebox_fontsize = value
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * NameBox Offset X
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def self.namebox_offset_x
@namebox_x = NAMEBOX_OFFSET_X if @namebox_x == nil
return @namebox_x
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * NameBox Offset X=
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def self.namebox_offset_x= (value)
@namebox_x = value
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * NameBox Offset Y
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def self.namebox_offset_y
@namebox_y = NAMEBOX_OFFSET_Y if @namebox_y == nil
return @namebox_y
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * NameBox Offset Y=
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def self.namebox_offset_y= (value)
@namebox_y = value
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * NameBox Opacity
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def self.namebox_opacity
@namebox_opacity = NAMEBOX_OPACITY if @namebox_opacity == nil
return @namebox_opacity
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * NameBox Opacity=
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def self.namebox_opacity= (value)
@namebox_opacity = value
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Default timing
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def self.default_timing
@default_timing = DEFAULT_TIMING if @default_timing == nil
return @default_timing
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Default Timing =
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def self.default_timing= (value)
value = [value, 0].max
@default_timing = value
end
end
module Sound
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Play Message SE
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def self.play_message_se
Message_Options.message_se.play
end
end
#======================================================================
# ** Sprite Message Face
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# A sprite to reduce lag when using Animated Facesets
#======================================================================
class Sprite_MessageFace < Sprite_Base
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Object Initialization
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def initialize (face_file, face_index = 0, size = 96, single = false)
super ()
self.visible = false
self.z = 250
face = Cache.face (face_file)
if single
self.bitmap = face
else
self.bitmap = Bitmap.new (face.width / 4, face.height / 2)
rect = Rect.new(0, 0, 0, 0)
rect.x = face_index % 4* 96 + (96 - size) / 2
rect.y = face_index / 4 * 96 + (96 - size) / 2
rect.width = size
rect.height = size
self.bitmap.blt(x, y, face, rect)
face.dispose
end
end
end
#========================================================================
# ** Window Name Box
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# This window displays the name of a speaker in Window_Message
#========================================================================
class Window_NameBox < Window_Base
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Object Initialization
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def initialize (x, y, string)
temp_bitmap = Bitmap.new (1, 1)
temp_bitmap.font.name = Message_Options.namebox_fontname
temp_bitmap.font.size = Message_Options.namebox_fontsize
rect = temp_bitmap.text_size (string)
temp_bitmap.dispose
super (x, y, rect.width + 32, rect.height + 32)
self.z = 300
create_contents
# Use Namebox settings
self.back_opacity = Message_Options.namebox_opacity
self.windowskin = Message_Options.namebox_windowskin
self.contents.font.name = Message_Options.namebox_fontname
self.contents.font.size = Message_Options.namebox_fontsize
self.contents.font.color = text_color(Message_Options.namebox_color)
# Draw the text
self.contents.draw_text (0, 0, rect.width, rect.height, string)
end
end
#======================================================================
# ** Window_Message
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Summary of changes:
# Basically, this script changes the way letter-by-letter works in order to allow for various
# options: namely speed variability, sound effects, and animated facesets
#
# aliased method - convert_special_characters
# overwritten methods - update_message
#======================================================================
class Window_Message < Window_Selectable
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Convert Special Characters
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias modalg_msg_script_special_char_conversion convert_special_characters
def convert_special_characters
# New codes
modalg_msg_script_special_char_conversion
@text.gsub!(/\\NE\[([0-9]+)\]/i) { $data_enemies[$1.to_i].name } # Name Enemy
@text.gsub!(/\\NI\[([0-9]+)\]/i) { $data_items[$1.to_i].name } # Name Item
@text.gsub!(/\\NW\[([0-9]+)\]/i) { $data_weapons[$1.to_i].name } # Name Weapon
@text.gsub!(/\\NA\[([0-9]+)\]/i) { $data_armors[$1.to_i].name } # Name Armor
@text.gsub!(/\\PI\[([0-9]+)\]/i) { $data_items[$1.to_i].price.to_s } # Price Item
@text.gsub!(/\\PW\[([0-9]+)\]/i) { $data_weapons[$1.to_i].price.to_s } # Price Weapon
@text.gsub!(/\\PA\[([0-9]+)\]/i) { $data_armors[$1.to_i].price.to_s } # Price Armor
@text.gsub! (/\\IICON\[([0-9]+)\]/i) { "\x10[#{$data_items[$1.to_i].icon_index}]" } # Icon Item
@text.gsub! (/\\WICON\[([0-9]+)\]/i) { "\x10[#{$data_weapons[$1.to_i].icon_index}]" } # Icon Weapon
@text.gsub! (/\\AICON\[([0-9]+)\]/i) { "\x10[#{$data_armors[$1.to_i].icon_index}]" } # Icon Armor
# Retrieve Name
name = @text[/\\NAME\[.*?\]/i]
name.sub! (/\\NAME/i, '') unless name == nil
@text.gsub! (/\\NAME\[.*?\]/i) { "\x09#{name}" } # Name Window
@text.gsub! (/\\ICON\[([0-9]+)\]/i) { "\x10[#{$1}]" } # Icon
@text.gsub!(/\\B/i) { "\x11" } # Bold
@text.gsub!(/\\I/i) { "\x12" } # Italic
# Run original script
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Object Initialization
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias modalg_msg_script_init initialize
def initialize
# Run original method
modalg_msg_script_init
@letter_timing = Message_Options.default_timing
@face_sprites = []
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * New Page
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def new_page
contents.clear
if $game_message.face_name.empty?
@contents_x = 0
else
@face_sprites.clear
name = $game_message.face_name.dup
index = $game_message.face_index
# Determine if the face is a single graphic
single = name[/^\$/] != nil
face = Sprite_MessageFace.new (name, index, 96, single)
face.x = self.x + 16
face.y = self.y + 16
face.visible = true
@face_sprites.push (face)
@current_face = 0
unless name[/\_a$/i] == nil
name.gsub! (/\_a$/i) {|s| s = '_b'}
face = Sprite_MessageFace.new (name, index, 96, single)
face.x = self.x + 16
face.y = self.y + 16
@face_sprites.push (face)
end
@contents_x = 112
end
@contents_y = 0
@line_count = 0
@show_fast = false
@line_show_fast = false
@pause_skip = false
contents.font.color = text_color(0)
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Update Message
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def update_message
loop do
@wait_count = Message_Options.default_timing
c = @text.slice!(/./m) # ???????
case c
when nil # ??????????
finish_message # ????
break
when "\x00" # ??
new_line
if @line_count >= MAX_LINE # ????????
unless @text.empty? # ??????????
self.pause = true # ????????
break
end
end
break
when "\x01" # \C[n] (?????)
@text.sub!(/\[([0-9]+)\]/, "")
contents.font.color = text_color($1.to_i)
next
when "\x02" # \G (?????)
@gold_window.refresh
@gold_window.open
when "\x03" # \. (???? 1/4 ?)
@wait_count = 15
break
when "\x04" # \| (???? 1 ?)
@wait_count = 60
break
when "\x05" # \! (????)
self.pause = true
when "\x06" # \> (???? ON)
@letter_timing -= 1
@letter_timing = 0 if @letter_timing < 0
when "\x07" # \< (???? OFF)
@letter_timing += 1
when "\x08" # \^ (??????)
@pause_skip = true
when "\x09" # \name Name Box
name = @text[/\[.*?\]/]
@text.sub!(/\[.*?\]/, "")
name = name[1, name.size - 2]
x = self.x + Message_Options.namebox_offset_x
y = self.y + Message_Options.namebox_offset_y
@name_window = Window_NameBox.new (x, y, name)
@name_window.y -= @name_window.height
when "\x10" # \icon Shows an icon
@text.sub!(/\[([0-9]+)\]/, "")
draw_icon ($1.to_i, @contents_x, @contents_y)
@contents_x += 24
@wait_count += @letter_timing
when "\x11" # \b Bold
# Toggle Bold
self.contents.font.bold = self.contents.font.bold ? false : true
when "\x12" # \i Italic
# Toggle Italic
self.contents.font.italic = self.contents.font.italic ? false : true
else # ?????
contents.draw_text(@contents_x, @contents_y, 40, WLH, c)
c_width = contents.text_size(c).width
@contents_x += c_width
Sound.play_message_se if Message_Options.message_se_active?
@wait_count += @letter_timing
# Switch Facesets
if Message_Options::ANIMATED_FACESETS && @face_sprites.size > 1
@face_sprites[@current_face].visible = false
@current_face += 1
@current_face %= @face_sprites.size
@face_sprites[@current_face].visible = true
end
end
break unless @show_fast or @line_show_fast
end
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Finish Message
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias modalg_msg_script_message_fin finish_message
def finish_message
# Show initial face
unless @face_sprites.empty?
@face_sprites[@current_face].visible = false
@current_face = 0
@face_sprites[0].visible = true
end
@letter_timing = Message_Options.default_timing
modalg_msg_script_message_fin
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Terminate Message
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias modalg_msg_script_message_term terminate_message
def terminate_message
self.contents.font.bold = false
self.contents.font.italic = false
modalg_msg_script_message_term
@face_sprites.each {|face| face.dispose}
@name_window.dispose unless @name_window.nil? || @name_window.disposed?
@face_sprites.clear
end
end
Yeah, it's probably not so hard, but I always find it weird to work with events. I would suggest making pseudorandom boats. Give them seemingly random movement through Custom Move Route. However, since this is a script request topic I suppose I can pull it off. Give me a little bit. How do you want to identify boats by the way?
EDIT::
Alright, here's a script:
#========================================================================
# ** Game_Event
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Summary of Changes:
# aliased method - initialize
# super methods changed - passable?
#========================================================================
class Game_Event < Game_Character
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Object Initialization
# map_id : map ID
# event : event object (RPG::Event)
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias modalg_boat_random_movement_init initialize
def initialize(map_id, event)
# Run Original Method
modalg_boat_random_movement_init (map_id, event)
@boat_object = @event.name[/\\BOAT/i] != nil
@ship_object = @event.name[/\\SHIP/i] != nil
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Passable?
# x : the x coordinate of the square being tested
# y : the y coordinate of the square being tested
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def passable? (x, y)
return false if collide_with_characters? (x, y)
if @ship_object
return $game_map.ship_passable? (x, y)
elsif @boat_object
return $game_map.boat_passable? (x, y)
end
return super (x, y)
end
end
Like I said, pseudorandom is going to be better because there is a possibilty that a randomly moving boat will continually try to move towards land, and it will make it look stationary. In any case, it ought to keep the little guy from getting onto land. To identify any given event as being a ship or a boat, just type \boat or \ship (captialization doesn't matter) as some part of the name of the event. So, if you name an event:
\boat Captain Amos, then it will be identified as a boat and adhere to passability of boats. If it is named \ship Captain Amos, it will identify as a ship and will adhere to rules regarding ships. If named \boatCaptain Amos\ShIp, it will identify as ship since ship has priority over boat. I would do airship as well, but it seems to me that clicking the Through Box would be enough.
Sorry, I just read that you wanted -a and -b, not _a and _b, but unless you have serious objections, I think I will stick with the underscores. Anyway, here's what I have so far. I decided I would take your request and just go all out and make an Advanced Message System. Since I needed to overwrite a major method of Window_Message, my script would have been incompatible with pretty much any other message system, and I figured I could add in all those features, so why not?
Well, one reason why not is that I could easily have made mistakes. It might throw errors so I suggest you test it in a non-critical project, or a test project. I doubt anything will corrupt the entire project, but it won't hurt to be careful. Anyway yeah, there's a bunch of stuff in the code that you never asked for. Take a look in the comments for what those are.
#=======================================================================
# Modern Algebra Message Script
# Version 0.5
# Author: modern algebra
# February 22, 2008
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Special Thanks to:
# Arrow-1 for the request. I loved the animated facesets idea
# Zeriab for his regular expressions tutorial
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Current Features:
# - Precise letter-by-letter timing control
# - Animated Facesets
# - Can play a sound effect with each letter drawn
# - numerous additional codes - see below for all the codes
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Current Codes:
# - \< Slows the speed at which the text is drawn
# - \> Increases the speed at which the text is drawn
# - \b bold text
# - \i italicized text
# - \name[text] name box
# - \ne[enemy_id] name of enemy
# - \ni[item_id] Name of item
# - \nw[weapon_id] Name of weapon
# - \na[armor_id] Name of Armor
# - \pi[item_id] price of item
# - \pw[weapon_id] price of weapon
# - \pa[armor_id] price of Armor
# - \icon[icon_index] draw icon assigned to icon_index
# - \iicon[item_id] draw icon of item
# - \wicon[weapon_id] draw icon of weapon
# - \aicon[armor_id] draw icon of armor
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Instructions:
# Fill in the constants below for default settings. You can change pretty much all of these
# constants in-game with the codes:
#
# Message_Options.letter_by_letter_sound = true/false
# Message_Options.message_se = 'filename'
# Message_Options.default_timing = integer (lower = faster)
# Message_Options.namebox_windowskin = 'Windowskin'
# Message_Options.namebox_color = integer (0..32)
# Message_Options.namebox_fontname = 'font name'
# Message_Options.namebox_fontsize = 'Windowskin'
# Message_Options.namebox_offset_x = integer
# Message_Options.namebox_offset_y = integer
# Message_Options.opacity = integer (0..255)
#
# To use animated facesets, merely use a face graphic that ends with _a and you must have
# another faceset with the same name but ending with _b.
#=======================================================================
module Message_Options
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Constants
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DEFAULT_TIMING = 0 # The default amount of frames between each letter as it is drawn
LETTER_BY_LETTER_SOUND = true # Whether there should be an SE played with each character drawn
MESSAGE_SE = 'Open1' # The SE to be played if LETTER_BY_LETTER_SOUND == true
ANIMATED_FACESETS = true # true => active animated facesets; false => deactivated
NAMEBOX_WINDOWSKIN = "Window" # The windowskin for the name box
NAMEBOX_COLOR = 5 # The Color of the text in the namebox
NAMEBOX_FONTNAME = 'Times New Roman' # The Font of the namebox
NAMEBOX_FONTSIZE = 20 # The Size of the text in the namebox
NAMEBOX_OFFSET_X = 16 # How much the Namebox is in the X direction away from default
NAMEBOX_OFFSET_Y = 16 # How much the Namebox is in the Y direction away from default
NAMEBOX_OPACITY = 100 # The opacity of the name box
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Message SE (Lazy Initialization)
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def self.message_se
self.message_se = MESSAGE_SE if @message_se.nil?
return @message_se
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Message SE =
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def self.message_se= (file_name)
@message_se = RPG::SE.new (file_name)
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Message_SE_Active?
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def self.message_se_active?
@letter_by_letter_sound = LETTER_BY_LETTER_SOUND if @letter_by_letter_sound.nil?
return @letter_by_letter_sound
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Letter BY Letter Sound =
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def self.letter_by_letter_sound= (boolean)
@letter_by_letter_sound = boolean
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * NameBox Windowskin
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def self.namebox_windowskin
@namebox_windowskin = Cache.system (NAMEBOX_WINDOWSKIN) if @namebox_windowskin == nil
return @namebox_windowskin
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * NameBox Windowskin=
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def self.namebox_windowskin= (string)
@namebox_windowskin = Cache.system (string)
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * NameBox Color
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def self.namebox_color
@namebox_color = NAMEBOX_COLOR if @namebox_color == nil
return @namebox_color
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * NameBox Color=
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def self.namebox_color= (value)
@namebox_color = value
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * NameBox Fontname
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def self.namebox_fontname
@namebox_font = NAMEBOX_FONTNAME if @namebox_font == nil
return @namebox_font
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * NameBox Fontname=
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def self.namebox_fontname= (string)
@namebox_font = string
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * NameBox Fontsize
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def self.namebox_fontsize
@namebox_fontsize = NAMEBOX_FONTSIZE if @namebox_fontsize == nil
return @namebox_fontsize
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * NameBox Fontsize=
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def self.namebox_fontsize= (value)
@namebox_fontsize = value
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * NameBox Offset X
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def self.namebox_offset_x
@namebox_x = NAMEBOX_OFFSET_X if @namebox_x == nil
return @namebox_x
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * NameBox Offset X=
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def self.namebox_offset_x= (value)
@namebox_x = value
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * NameBox Offset Y
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def self.namebox_offset_y
@namebox_y = NAMEBOX_OFFSET_Y if @namebox_y == nil
return @namebox_y
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * NameBox Offset Y=
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def self.namebox_offset_y= (value)
@namebox_y = value
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * NameBox Opacity
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def self.namebox_opacity
@namebox_opacity = NAMEBOX_OPACITY if @namebox_opacity == nil
return @namebox_opacity
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * NameBox Opacity=
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def self.namebox_opacity= (value)
@namebox_opacity = value
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Default timing
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def self.default_timing
@default_timing = DEFAULT_TIMING if @default_timing == nil
return @default_timing
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Default Timing =
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def self.default_timing= (value)
value = [value, 0].max
@default_timing = value
end
end
module Sound
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Play Message SE
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def self.play_message_se
Message_Options.message_se.play
end
end
#======================================================================
# ** Sprite Message Face
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# A sprite to reduce lag when using Animated Facesets
#======================================================================
class Sprite_MessageFace < Sprite_Base
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Object Initialization
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def initialize (face_file, face_index = 0, size = 96, single = false)
super ()
self.visible = false
self.z = 250
face = Cache.face (face_file)
if single
self.bitmap = face
else
self.bitmap = Bitmap.new (face.width / 4, face.height / 2)
rect = Rect.new(0, 0, 0, 0)
rect.x = face_index % 4* 96 + (96 - size) / 2
rect.y = face_index / 4 * 96 + (96 - size) / 2
rect.width = size
rect.height = size
self.bitmap.blt(x, y, face, rect)
face.dispose
end
end
end
#========================================================================
# ** Window Name Box
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# This window displays the name of a speaker in Window_Message
#========================================================================
class Window_NameBox < Window_Base
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Object Initialization
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def initialize (x, y, string)
temp_bitmap = Bitmap.new (1, 1)
temp_bitmap.font.name = Message_Options.namebox_fontname
temp_bitmap.font.size = Message_Options.namebox_fontsize
rect = temp_bitmap.text_size (string)
temp_bitmap.dispose
super (x, y, rect.width + 32, rect.height + 32)
self.z = 300
create_contents
# Use Namebox settings
self.back_opacity = Message_Options.namebox_opacity
self.windowskin = Message_Options.namebox_windowskin
self.contents.font.name = Message_Options.namebox_fontname
self.contents.font.size = Message_Options.namebox_fontsize
self.contents.font.color = text_color(Message_Options.namebox_color)
# Draw the text
self.contents.draw_text (0, 0, rect.width, rect.height, string)
end
end
#======================================================================
# ** Window_Message
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Summary of changes:
# Basically, this script changes the way letter-by-letter works in order to allow for various
# options: namely speed variability, sound effects, and animated facesets
#
# aliased method - convert_special_characters
# overwritten methods - update_message
#======================================================================
class Window_Message < Window_Selectable
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Convert Special Characters
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias modalg_msg_script_special_char_conversion convert_special_characters
def convert_special_characters
# New codes
modalg_msg_script_special_char_conversion
@text.gsub!(/\\NE\[([0-9]+)\]/i) { $data_enemies[$1.to_i].name } # Name Enemy
@text.gsub!(/\\NI\[([0-9]+)\]/i) { $data_items[$1.to_i].name } # Name Item
@text.gsub!(/\\NW\[([0-9]+)\]/i) { $data_weapons[$1.to_i].name } # Name Weapon
@text.gsub!(/\\NA\[([0-9]+)\]/i) { $data_armors[$1.to_i].name } # Name Armor
@text.gsub!(/\\PI\[([0-9]+)\]/i) { $data_items[$1.to_i].price.to_s } # Price Item
@text.gsub!(/\\PW\[([0-9]+)\]/i) { $data_weapons[$1.to_i].price.to_s } # Price Weapon
@text.gsub!(/\\PA\[([0-9]+)\]/i) { $data_armors[$1.to_i].price.to_s } # Price Armor
@text.gsub! (/\\IICON\[([0-9]+)\]/i) { "\x10[#{$data_items[$1.to_i].icon_index}]" } # Icon Item
@text.gsub! (/\\WICON\[([0-9]+)\]/i) { "\x10[#{$data_weapons[$1.to_i].icon_index}]" } # Icon Weapon
@text.gsub! (/\\AICON\[([0-9]+)\]/i) { "\x10[#{$data_armors[$1.to_i].icon_index}]" } # Icon Armor
# Retrieve Name
name = @text[/\\NAME\[.*?\]/i]
name.sub! (/\\NAME/i, '') unless name == nil
@text.gsub! (/\\NAME\[.*?\]/i) { "\x09#{name}" } # Name Window
@text.gsub! (/\\ICON\[([0-9]+)\]/i) { "\x10[#{$1}]" } # Icon
@text.gsub!(/\\B/i) { "\x11" } # Bold
@text.gsub!(/\\I/i) { "\x12" } # Italic
# Run original script
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Object Initialization
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias modalg_msg_script_init initialize
def initialize
# Run original method
modalg_msg_script_init
@letter_timing = Message_Options.default_timing
@face_sprites = []
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * New Page
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def new_page
contents.clear
if $game_message.face_name.empty?
@contents_x = 0
else
@face_sprites.clear
name = $game_message.face_name.dup
index = $game_message.face_index
# Determine if the face is a single graphic
single = name[/^\$/] != nil
face = Sprite_MessageFace.new (name, index, 96, single)
face.x = self.x + 16
face.y = self.y + 16
face.visible = true
@face_sprites.push (face)
@current_face = 0
unless name[/\_a$/i] == nil
name.gsub! (/\_a$/i) {|s| s = '_b'}
face = Sprite_MessageFace.new (name, index, 96, single)
face.x = self.x + 16
face.y = self.y + 16
@face_sprites.push (face)
end
@contents_x = 112
end
@contents_y = 0
@line_count = 0
@show_fast = false
@line_show_fast = false
@pause_skip = false
contents.font.color = text_color(0)
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Update Message
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def update_message
loop do
@wait_count = Message_Options.default_timing
c = @text.slice!(/./m) # ???????
case c
when nil # ??????????
finish_message # ????
break
when "\x00" # ??
new_line
if @line_count >= MAX_LINE # ????????
unless @text.empty? # ??????????
self.pause = true # ????????
break
end
end
break
when "\x01" # \C[n] (?????)
@text.sub!(/\[([0-9]+)\]/, "")
contents.font.color = text_color($1.to_i)
next
when "\x02" # \G (?????)
@gold_window.refresh
@gold_window.open
when "\x03" # \. (???? 1/4 ?)
@wait_count = 15
break
when "\x04" # \| (???? 1 ?)
@wait_count = 60
break
when "\x05" # \! (????)
self.pause = true
when "\x06" # \> (???? ON)
@letter_timing -= 1
@letter_timing = 0 if @letter_timing < 0
when "\x07" # \< (???? OFF)
@letter_timing += 1
when "\x08" # \^ (??????)
@pause_skip = true
when "\x09" # \name Name Box
name = @text[/\[.*?\]/]
@text.sub!(/\[.*?\]/, "")
name = name[1, name.size - 2]
x = self.x + Message_Options.namebox_offset_x
y = self.y + Message_Options.namebox_offset_y
@name_window = Window_NameBox.new (x, y, name)
@name_window.y -= @name_window.height
when "\x10" # \icon Shows an icon
@text.sub!(/\[([0-9]+)\]/, "")
draw_icon ($1.to_i, @contents_x, @contents_y)
@contents_x += 24
@wait_count += @letter_timing
when "\x11" # \b Bold
# Toggle Bold
self.contents.font.bold = self.contents.font.bold ? false : true
when "\x12" # \i Italic
# Toggle Italic
self.contents.font.italic = self.contents.font.italic ? false : true
else # ?????
contents.draw_text(@contents_x, @contents_y, 40, WLH, c)
c_width = contents.text_size(c).width
@contents_x += c_width
Sound.play_message_se if Message_Options.message_se_active?
@wait_count += @letter_timing
# Switch Facesets
if Message_Options::ANIMATED_FACESETS && @face_sprites.size > 1
@face_sprites[@current_face].visible = false
@current_face += 1
@current_face %= @face_sprites.size
@face_sprites[@current_face].visible = true
end
end
break unless @show_fast or @line_show_fast
end
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Finish Message
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias modalg_msg_script_message_fin finish_message
def finish_message
# Show initial face
unless @face_sprites.empty?
@face_sprites[@current_face].visible = false
@current_face = 0
@face_sprites[0].visible = true
end
@letter_timing = Message_Options.default_timing
modalg_msg_script_message_fin
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Terminate Message
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias modalg_msg_script_message_term terminate_message
def terminate_message
self.contents.font.bold = false
self.contents.font.italic = false
modalg_msg_script_message_term
@face_sprites.each {|face| face.dispose}
@name_window.dispose unless @name_window.nil? || @name_window.disposed?
@face_sprites.clear
end
end
Post was deleted, but in summation: THANKS! Very much appreciated, good buddy! I owe you a song or something.