Version: 1.0
Introduction
This script allows you to display text onscreen without interrupting the action. This is useful for cutscenes, minigames, etc. This has several advantages over the default message system.
- It does not interrupt the action. Events and characters can still move around and things can blow up while a message is onscreen.
- The player can still input, move the character, use items, etc. while the text is onscreen. This is useful for minigames where you don't want to interrupt the action.
- You can set the message to disappear exactly when you want it to in the events. This will make it much easier to make cutscenes by reducing the amount of trial and error.
- You can format the text of each individual line. You can change the face, size, color, outline, shadow, bold and italic status.
Included in attachment
Script
Give credit to KGC for this script!
Code:
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/ â—†ç¸å–り・影文å—æç”» ï¼ KGC_FrameShadowTextâ—†
#_/----------------------------------------------------------------------------
#_/ draw_text を強化ã—ã€ç¸å–りや影文å—ã®æç”»æ©Ÿèƒ½ã‚’è¿½åŠ ã—ã¾ã™ã€‚
#_/ Provides functions to draw texts which framed or dropped shadow.
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
<span style="color:#000080; font-style:italic;">=begin
<span style="color:#000080; font-style:italic;">â”â”â”â”â” æ載メソッド - Methods â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”
<span style="color:#000080; font-style:italic;">┠─── Class - Bitmap ────────────────────────────
<span style="color:#000080; font-style:italic;">┃ draw_frame_text(x, y, width, height, string[, align, frame_color])
<span style="color:#000080; font-style:italic;">┃ draw_frame_text(rect, string[, align, frame_color])
<span style="color:#000080; font-style:italic;">┃ x, y : æ画先座標 [Integer]
<span style="color:#000080; font-style:italic;">┃ Destination.
<span style="color:#000080; font-style:italic;">┃ width, height : æ画サイズ [Integer]
<span style="color:#000080; font-style:italic;">┃ Size.
<span style="color:#000080; font-style:italic;">┃ rect : æç”»é ˜åŸŸ [Rect]
<span style="color:#000080; font-style:italic;">┃ Rectangle.
<span style="color:#000080; font-style:italic;">┃ string : æ画文å—列 [String]
<span style="color:#000080; font-style:italic;">┃ Output text.
<span style="color:#000080; font-style:italic;">┃ align : æ–‡å—æ•´åˆ—å½¢å¼ [Integer]
<span style="color:#000080; font-style:italic;">┃ Alignment.
<span style="color:#000080; font-style:italic;">┃ frame_color : ç¸å–り色 [Color]
<span style="color:#000080; font-style:italic;">┃ Frame color.
<span style="color:#000080; font-style:italic;">┃ 周りを frame_color ã§ç¸å–ã‚Šã—ãŸæ–‡å—列をæç”»ã—ã¾ã™ã€‚
<span style="color:#000080; font-style:italic;">┃ Draws a character string framed in 'frame_color'.
<span style="color:#000080; font-style:italic;">┃
<span style="color:#000080; font-style:italic;">┃ draw_shadow_text(x, y, width, height, string[, align, frame_color])
<span style="color:#000080; font-style:italic;">┃ draw_shadow_text(rect, string[, align, frame_color])
<span style="color:#000080; font-style:italic;">┃ x, y : æ画先座標 [Integer]
<span style="color:#000080; font-style:italic;">┃ Destination.
<span style="color:#000080; font-style:italic;">┃ width, height : æ画サイズ [Integer]
<span style="color:#000080; font-style:italic;">┃ Size.
<span style="color:#000080; font-style:italic;">┃ rect : æç”»é ˜åŸŸ [Rect]
<span style="color:#000080; font-style:italic;">┃ Rectangle.
<span style="color:#000080; font-style:italic;">┃ string : æ画文å—列 [String]
<span style="color:#000080; font-style:italic;">┃ Output text.
<span style="color:#000080; font-style:italic;">┃ align : æ–‡å—æ•´åˆ—å½¢å¼ [Integer]
<span style="color:#000080; font-style:italic;">┃ Alignment.
<span style="color:#000080; font-style:italic;">┃ frame_color : ç¸å–り色 [Color]
<span style="color:#000080; font-style:italic;">┃ Frame color.
<span style="color:#000080; font-style:italic;">┃ å³ä¸‹ã«å½±ã‚’è½ã¨ã—ãŸæ–‡å—列をæç”»ã—ã¾ã™ã€‚
<span style="color:#000080; font-style:italic;">┃ Draws a character string which drops shadow to lower right.
<span style="color:#000080; font-style:italic;">┃
<span style="color:#000080; font-style:italic;">â”—â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”
<span style="color:#000080; font-style:italic;">=end
$imported = {} if $imported == nil
$imported["FrameShadowText"] = true
#==============================================================================
# â– Bitmap
#==============================================================================
class Bitmap
#--------------------------------------------------------------------------
# â— ç¸å–ã‚Šæ–‡å—æç”»
# x, y, width, height, string[, align, frame_color]
# rect, string[, align, frame_color]
#--------------------------------------------------------------------------
def draw_frame_text(*args)
# 引数判定
if args[0].is_a?(Rect)
if args.size >= 2 && args.size <= 4
# 引数を処ç†ç”¨ã®ãƒãƒ¼ã‚«ãƒ«å¤‰æ•°ã¸ã‚³ãƒ”ー
x, y = args[0].x, args[0].y
width, height = args[0].width, args[0].height
string = args[1]
align = args[2].equal?(nil) ? 0 : args[2]
frame_color = args[3].equal?(nil) ? Color.new(0, 0, 0) : args[3]
else
# 引数ãŒä¸æ£ãªã‚‰ã‚¨ãƒ©ãƒ¼ã‚’åã
raise(ArgumentError, "wrong number of arguments(#{args.size} of #{args.size < 2 ? 2 : 4})")
return
end
else
if args.size >= 5 && args.size <= 7
# 引数を処ç†ç”¨ã®ãƒãƒ¼ã‚«ãƒ«å¤‰æ•°ã¸ã‚³ãƒ”ー
x, y, width, height = args
string = args[4]
align = args[5].equal?(nil) ? 0 : args[5]
frame_color = args[6].equal?(nil) ? Color.new(0, 0, 0) : args[6]
else
# 引数ãŒä¸æ£ãªã‚‰ã‚¨ãƒ©ãƒ¼ã‚’åã
raise(ArgumentError, "wrong number of arguments(#{args.size} of #{args.size < 5 ? 5 : 7})")
return
end
end
# å…ƒã®è‰²ã‚’ä¿å˜
origin_color = font.color.dup
# ç¸å–ã‚Š
font.color = frame_color
draw_text(x - 1, y - 1, width, height, string, align)
draw_text(x - 1, y + 1, width, height, string, align)
draw_text(x + 1, y - 1, width, height, string, align)
draw_text(x + 1, y + 1, width, height, string, align)
# å…ƒã®è‰²ã«æˆ»ã™
font.color = origin_color
draw_text(x, y, width, height, string, align)
end
#--------------------------------------------------------------------------
# ◠影文å—æç”»
# x, y, width, height, string[, align, shadow_color]
# rect, string[, align, shadow_color]
#--------------------------------------------------------------------------
def draw_shadow_text(*args)
# 引数判定
if args[0].is_a?(Rect)
if args.size >= 2 && args.size <= 4
# 引数を処ç†ç”¨ã®ãƒãƒ¼ã‚«ãƒ«å¤‰æ•°ã¸ã‚³ãƒ”ー
x, y = args[0].x, args[0].y
width, height = args[0].width, args[0].height
string = args[1]
align = args[2].equal?(nil) ? 0 : args[2]
shadow_color = args[3].equal?(nil) ? Color.new(0, 0, 0) : args[3]
else
# 引数ãŒä¸æ£ãªã‚‰ã‚¨ãƒ©ãƒ¼ã‚’åã
raise(ArgumentError, "wrong number of arguments(#{args.size} of #{args.size < 2 ? 2 : 4})")
return
end
else
if args.size >= 5 && args.size <= 7
# 引数を処ç†ç”¨ã®ãƒãƒ¼ã‚«ãƒ«å¤‰æ•°ã¸ã‚³ãƒ”ー
x, y, width, height = args
string = args[4]
align = args[5].equal?(nil) ? 0 : args[5]
shadow_color = args[6].equal?(nil) ? Color.new(0, 0, 0) : args[6]
else
# 引数ãŒä¸æ£ãªã‚‰ã‚¨ãƒ©ãƒ¼ã‚’åã
raise(ArgumentError, "wrong number of arguments(#{args.size} of #{args.size < 5 ? 5 : 7})")
return
end
end
# å…ƒã®è‰²ã‚’ä¿å˜
origin_color = font.color.dup
# å½±æç”»
font.color = shadow_color
draw_text(x + 2, y + 2, width, height, string, align)
# å…ƒã®è‰²ã«æˆ»ã™
font.color = origin_color
draw_text(x, y, width, height, string, align)
end
end
Code:
<span style="color:#000080; font-style:italic;">=begin
<span style="color:#000080; font-style:italic;">These are strings to be used in JesseG88's Background
<span style="color:#000080; font-style:italic;">Message System.
<span style="color:#000080; font-style:italic;">
<span style="color:#000080; font-style:italic;">You can easily modify the strings or create new ones.
<span style="color:#000080; font-style:italic;">Just put them inside module STRINGS.
<span style="color:#000080; font-style:italic;">
<span style="color:#000080; font-style:italic;">Refer to [Background Message] for instructions.
<span style="color:#000080; font-style:italic;">=end
module STRINGS
BLANK = ""
HELLO1 = "If you were hoping to see World, preceded by Hello, too bad!"
HELLO2 = "Putting that in would be detrimental to my sanity."
RED_ALERT = "Red Alert! Red Alert! Enemy forces detected!"
BATTLE_STATIONS = "All hands to battle stations!"
end
Code:
<span style="color:#000080; font-style:italic;">=begin
<span style="color:#000080; font-style:italic;">#=======================================
<span style="color:#000080; font-style:italic;"># ** Background Message System
<span style="color:#000080; font-style:italic;">#------------------------------------------------------------------------------
<span style="color:#000080; font-style:italic;"># JesseG88
<span style="color:#000080; font-style:italic;"># 1.0
<span style="color:#000080; font-style:italic;"># 2006-06-06
<span style="color:#000080; font-style:italic;">#=======================================
<span style="color:#000080; font-style:italic;"># This allows text to show up onscreen during the game
<span style="color:#000080; font-style:italic;"># without interrupting events. All event processing,
<span style="color:#000080; font-style:italic;"># including player input and "normal" messages will
<span style="color:#000080; font-style:italic;"># continue uninterrupted while text is displayed. This
<span style="color:#000080; font-style:italic;"># is useful for cutscenes, minigames, etc.
<span style="color:#000080; font-style:italic;">#=======================================
<span style="color:#000080; font-style:italic;">
<span style="color:#000080; font-style:italic;">#=====================================
<span style="color:#000080; font-style:italic;"># Instructions
<span style="color:#000080; font-style:italic;">#=====================================
<span style="color:#000080; font-style:italic;">
<span style="color:#000080; font-style:italic;"> - Installation -
<span style="color:#000080; font-style:italic;">Place the strings file and the BMS file (this one) between
<span style="color:#000080; font-style:italic;">[Scene_Debug] and [Main]. Make sure to place the
<span style="color:#000080; font-style:italic;">strings ABOVE this file.
<span style="color:#000080; font-style:italic;">
<span style="color:#000080; font-style:italic;">In addition, make sure to install [KGC_FrameShadowText]
<span style="color:#000080; font-style:italic;">or you will get an error.
<span style="color:#000080; font-style:italic;">
<span style="color:#000080; font-style:italic;"> - Making text strings -
<span style="color:#000080; font-style:italic;">Go into [BMS Strings] and look at the existing strings to see what
<span style="color:#000080; font-style:italic;">they should look like. You can create new strings easile by following
<span style="color:#000080; font-style:italic;">the format and keeping them in the strings module.
<span style="color:#000080; font-style:italic;">
<span style="color:#000080; font-style:italic;">For example:
<span style="color:#000080; font-style:italic;">
<span style="color:#000080; font-style:italic;">module STRINGS
<span style="color:#000080; font-style:italic;"> STRING_NAME = "Text inside string"
<span style="color:#000080; font-style:italic;">end
<span style="color:#000080; font-style:italic;">
<span style="color:#000080; font-style:italic;">
<span style="color:#000080; font-style:italic;">=end
#------------------------------------------------------------------------------
# * SDK Log Script
#------------------------------------------------------------------------------
SDK.log('Background Message System', 'JesseG88', '1.0', '2006-06-06')
#------------------------------------------------------------------------------
# Begin SDK Enabled Check
#------------------------------------------------------------------------------
if SDK.state('Background Message System') == true
module BMS
#Perform any customizations inside this module.
#Windowskin Opacity
WINDOW_OPACITY = 0
#Upper Left Corner
WINDOW_X1 = 0
WINDOW_Y1 = 0 #Set to 0 for top, 160 for middle, 320 for bottom.
#Window Size
WINDOW_X2 = 640
WINDOW_Y2 = 160
#Line 1 Settings
LINE1_FONT_FACE = "Arial"
LINE1_FONT_SIZE = 20
LINE1_FONT_BOLD = true
LINE1_FONT_ITALIC = false
LINE1_FONT_COLOR = Color.new(255, 255, 255, 255)
LINE1_FST_MODE = 0 # 0-Plain, 1-Frame, 2-Shadow
LINE1_STRING = STRINGS::BLANK
#Line 2 Settings
LINE2_FONT_FACE = "Arial"
LINE2_FONT_SIZE = 20
LINE2_FONT_BOLD = true
LINE2_FONT_ITALIC = false
LINE2_FONT_COLOR = Color.new(255, 255, 255, 255)
LINE2_FST_MODE = 0 # 0-Plain, 1-Frame, 2-Shadow
LINE2_STRING = STRINGS::BLANK
#Line 3 Settings
LINE3_FONT_FACE = "Arial"
LINE3_FONT_SIZE = 20
LINE3_FONT_BOLD = true
LINE3_FONT_ITALIC = false
LINE3_FONT_COLOR = Color.new(255, 255, 255, 255)
LINE3_FST_MODE = 0 # 0-Plain, 1-Frame, 2-Shadow
LINE3_STRING = STRINGS::BLANK
#Line 4 Settings
LINE4_FONT_FACE = "Arial"
LINE4_FONT_SIZE = 20
LINE4_FONT_BOLD = true
LINE4_FONT_ITALIC = false
LINE4_FONT_COLOR = Color.new(255, 255, 255, 255)
LINE4_FST_MODE = 0 # 0-Plain, 1-Frame, 2-Shadow
LINE4_STRING = STRINGS::BLANK
#Unless you know what you are doing,
#do not modify anything below this line.
end
class Window_BGMessage < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(BMS::WINDOW_X1, BMS::WINDOW_Y1, BMS::WINDOW_X2, BMS::WINDOW_Y2)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = BMS::WINDOW_OPACITY
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
#Collect settings from BMS module, then print text.
#Start of Line 1
self.contents.font.name = BMS::LINE1_FONT_FACE
self.contents.font.size = BMS::LINE1_FONT_SIZE
self.contents.font.bold = BMS::LINE1_FONT_BOLD
self.contents.font.italic = BMS::LINE1_FONT_ITALIC
self.contents.font.color = BMS::LINE1_FONT_COLOR
case BMS::LINE1_FST_MODE
when 0
self.contents.draw_text(0, 0, 608, 32, BMS::LINE1_STRING)
when 1
self.contents.draw_frame_text(0, 0, 608, 32, BMS::LINE1_STRING)
when 2
self.contents.draw_shadow_text(0, 0, 608, 32, BMS::LINE1_STRING)
end
#End of Line 1
#Start of Line 2
self.contents.font.name = BMS::LINE2_FONT_FACE
self.contents.font.size = BMS::LINE2_FONT_SIZE
self.contents.font.bold = BMS::LINE2_FONT_BOLD
self.contents.font.italic = BMS::LINE2_FONT_ITALIC
self.contents.font.color = BMS::LINE2_FONT_COLOR
case BMS::LINE2_FST_MODE
when 0
self.contents.draw_text(0, 32, 608, 32, BMS::LINE2_STRING)
when 1
self.contents.draw_frame_text(0, 32, 608, 32, BMS::LINE2_STRING)
when 2
self.contents.draw_shadow_text(0, 32, 608, 32, BMS::LINE2_STRING)
end
#End of Line 2
#Start of Line 3
self.contents.font.name = BMS::LINE3_FONT_FACE
self.contents.font.size = BMS::LINE3_FONT_SIZE
self.contents.font.bold = BMS::LINE3_FONT_BOLD
self.contents.font.italic = BMS::LINE3_FONT_ITALIC
self.contents.font.color = BMS::LINE3_FONT_COLOR
case BMS::LINE3_FST_MODE
when 0
self.contents.draw_text(0, 64, 608, 32, BMS::LINE3_STRING)
when 1
self.contents.draw_frame_text(0, 64, 608, 32, BMS::LINE3_STRING)
when 2
self.contents.draw_shadow_text(0, 64, 608, 32, BMS::LINE3_STRING)
end
#End of Line 3
#Start of Line 4
self.contents.font.name = BMS::LINE4_FONT_FACE
self.contents.font.size = BMS::LINE4_FONT_SIZE
self.contents.font.bold = BMS::LINE4_FONT_BOLD
self.contents.font.italic = BMS::LINE4_FONT_ITALIC
self.contents.font.color = BMS::LINE4_FONT_COLOR
case BMS::LINE4_FST_MODE
when 0
self.contents.draw_text(0, 128, 608, 32, BMS::LINE4_STRING)
when 1
self.contents.draw_frame_text(0, 128, 608, 32, BMS::LINE4_STRING)
when 2
self.contents.draw_shadow_text(0, 128, 608, 32, BMS::LINE4_STRING)
end
#End of Line 4
end #of def refresh
end #of class Window_BGMessage
end #of if SDK.state('Background Message System') == true
#------------------------------------------------------------------------------
# End SDK Enabled Test
#------------------------------------------------------------------------------
Installation
Get the SDK, and all the scripts listed above. Place them in the following order in the editor:
- SDK
- KGC_FrameShadowText
- BMS Strings
- Background Message
Go into BMS strings and look at the example strings that are already in there. Adding a new string should be ridiculously easy.
Formatting the window
Go into Background Message and look at module BMS. (Lines 49-101) Simply change the attributes to suit your needs. You can even change the attirbutes in-game. Just add "BMS::", without quotes, to an attribute in an in-game script. It should similar to this:
Code:
BMS::LINE1_FST_MODE = 1
BMS::LINE1_FONT_COLOR = Color.new(255, 0, 0, 255)
Run a script like this:
Code:
BMS::LINE1_STRING = STRINGS::HELLO1
BMS::LINE2_STRING = STRINGS::HELLO2
@BGMessage = Window_BGMessage.new
BMS::LINE1_STRING = "Aluxus"
The line @BGMessage = Window_BGMessage.new causes the message to appear onscreen.
Removing a message
Run this script:
Code:
@BGMessage.dispose
Compatibility
This script requires the SDK. It also needs KGC's Frame and Shadow Text script, which I included.
Bugs, Errors
If you call a message and dispose of it on a different page or event, you may get an error message. To avoid this, call the message and dispose of it on the same event page.
Credits and Thanks
SDK Team - SDK
KGC Software - Frame and Shadow Text script, as well as the idea of customization modules.
Author's Notes
This is the first script I have posted, so it may not be all that great.
I may post a demo later.