ATS: Formatting
Version: 1.1.5
Author: modern algebra
Date: 26 February 2015
Version History
- <Version 1.1.5> 2015.02.26 - Fixed error when used with Face Options
- <Version 1.1.3> 2014.04.30 - Fixed error with mid-line size changes and incomplete lines after forcing a new page with \pn. Also updated ParagraphFormatter to version 1.0.1
- <Version 1.1.2> 2012.10.04 - Fixed an error where alignment would erase the text if paragraph formatting was not on and if there were wait codes in the text.
- <Version 1.1.1> 2012.09.24 - Fixed an error where alignment would not work if there was a space before an explicit line break.
- <Version 1.1.0> 2012.09.08 - Modified the paragraph formatting methods in this script to be more consistent with my other scripts, and I also fixed an error where \n would not break a line if there was nothing in it.
- <Version 1.0.3> 2012.08.01 - Added \lb as an alternate code to break a line
- <Version 1.0.2> 2012.07.31 - Fixed an incompatibility that could occur with other message scripts
- <Version 1.0a> 2012.04.23 - Included the Escape Codes Fix (http://rmrk.net/index.php/topic,45836.0.html) in the body of the script
- <Version 1.0> 2012.01.28 - Original Release
Description
This script adds a few features when using the Display Text event command. Most notably, the paragraph formatting feature allows you to write text without any fear that it will get cut off when it shows up in-game. This should work with any font and it is designed to recognize most message codes that are added, even by unrelated scripts. Supplementary to that, you can set it so that subsequent text boxes are appended, which allows you to write long dialogues using paragraph format without fear of weird page breaks. Finally, it adds a feature that allows you to align the text differently.
Features
- Paragraph Formatting permits you to ignore the markers when displaying text - nothing will get cut off.
- Appended Text supplements paragraph formatting for long dialogues
- Can align the text
Screenshots
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fimg837.imageshack.us%2Fimg837%2F7975%2Fpf1o.png&hash=36f5505bbd72bbf37946dd16e52fe362ba088fd1)
Instructions
Paste this script into its own slot in the Script Editor, above Main but below Materials. If you are using another message script, I recommend that this script be placed below it.
Please see the header of the script for instructions on use.
Script
#==============================================================================
# ATS: Formatting [VXA]
# Version: 1.1.5
# Author: modern algebra (rmrk.net)
# Date: 26 February 2015
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Description:
#
# This script essentially adds three features to your messages, all of which
# may be familiar if you used the VX version of the ATS. The first feature is
# paragraph formatting, and if that is on then the script will essentially
# draw the text so that only as much text as can fit on a line is included.
# In other words, if you have put so much text in a message such that it
# would normally be cut off on the right, this script will make it so that
# instead, if the text is in danger of being cut off, it will simply draw it
# on the next line. Along with this, this script will also bring in a new
# message code to start a new line (since the traditional line breaks are
# wiped out when you use paragraph format).
#
# The second feature is appended text, which in this context is really only
# useful if you are using paragraph format. When you have this feature on,
# what it will do is make it so that the text in any immediately subsequent
# Display Text event command with the same settings will be joined to the
# first text window, and then they will be shown in the same window if there
# is room. What this means is that if, for instance, you have two messages,
# and the first would only show two lines and the second would show three
# lines, then in-game, if appended text is on, the first two lines of the
# second command would be shown with the two lines of the first command, and
# the next page would only show the last line of the second command. It is a
# useful feature when using paragraph formatting, since otherwise when
# writing long dialogues with the same character, you would need to be
# writing in sets of four lines so that it doesn't have weird stops.
#
# The third feature is text alignment, so you can now set it so that text is
# aligned to the left, right or centre in the message box.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# ATS Series:
#
# This script is part of the Advanced Text System series of scripts. These
# scripts are based off the Advanced Text System for RMVX, but since RMVX Ace
# has a much more sensibly designed message system, it is no longer necessary
# that it be one large script. For that reason, and responding to feedback on
# the ATS, I have split the ATS into multiple different scripts so that you
# only need to pick up the components for the features that you want. It is
# therefore easier to customize and configure.
#
# To find more scripts in the ATS Series, please visit:
# http://rmrk.net/index.php/topic,44525.0.html
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Instructions:
#
# Paste this script into its own slot in the Script Editor, above Main but
# below Materials. If you are using another message system, such as Yanfly's
# Ace Message System, I recommend that this script be placed underneath it.
#
# You can change the default setting for paragraph formatting at line 127.
# Currently, it is set to true, which means that it will be operative in
# every message unless you specifically turn it off. To change this default
# value in-game, use one of the following codes in a script call:
#
# ats_all(:paragraph_format, true) # Turns paragraph format on
# ats_all(:paragraph_format, false) # Turns paragraph format off
#
# Similarly, you can change it for just the very next display text command.
# Simply use one of the following codes in a script call:
#
# ats_next(:paragraph_format, true) # Turns paragraph format on
# ats_next(:paragraph_format, false) # Turns paragraph format off
#
# Alternatively, you can turn paragraph format on or off for a message by
# message codes. See the special message codes list at lines 96 and 97.
#
# You can change the default setting for appended text at line 135. If true,
# then any immediately subsequent display text commands with the same
# same settings (same face, background, position) will be added to the
# message shown.
#
# Similar to paragraph format, you can use the following commands in a
# script call
#
# ats_all(:append_text, true) # Turns default appended text on
# ats_all(:append_text, false) # Turns default appended text off
# ats_next(:append_text, true) # Turns appended text on for next message
# ats_next(:append_text, false) # Turns appended text off for next message
#
# Finally, you can also change the alignment of text with the special
# message codes listed below at lines 100, 101 & 102.
#
# Lastly, I would draw your attention to the \n and \pn codes, which allows
# you to make new lines and new pages, respectively. These are useful for
# when you are using paragraph format and appended text, as it allows you
# more control. They are described at line 98 and 99.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# List of Special Message Codes Added:
#
# \pf - Turn on paragraph format for this message.
# /pf - Turn off paragraph format for this message.
# \n - Start a new line.
# \lb - Start a new line.
# \pn - Start a new page.
# \a[L] - Aligns the text to the left for this line. Can also use \a[0].
# \a[C] - Aligns the text to the centre for this line. Can also use \a[1].
# \a[R] - Aligns the text to the right for this line. Can also use \a[2].
#==============================================================================
$imported ||= {}
if !$imported[:ATS_Formatting]
$imported[:ATS_Formatting] = true
#==============================================================================
# ** Game_ATS
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# new public instance variables - ats_paragraph_formatting; ats_alignment;
# paragraph_format
#==============================================================================
class Game_ATS
CONFIG ||= {}
CONFIG[:ats_formatting] = {
ats_formatting: true,
ats_alignment: 0,
#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
# EDITABLE REGION
#||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
# Set the below value to either true or false. If true, then paragraph
# format will be on by default. If false, then paragraph_format will be
# off by default.
paragraph_format: true,
# Set the below value to either true or false. If true, then any
# immediately subsequent display text event commands with the same settings
# will be joined together and they will show in the same message window if
# there is space. This option is only useful if using paragraph format. If
# you are using ATS: Message Options, it will only recognize the value of
# :append_text set up in that script.
append_text: true,
#||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
# END EDITABLE REGION
#////////////////////////////////////////////////////////////////////////
}
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Public Instance Variables
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CONFIG[:ats_formatting].delete(:append_text) if $imported[:ATS_MessageOptions]
CONFIG[:ats_formatting].keys.each { |key| attr_accessor key }
end
#==============================================================================
# Initialize Common ATS Data if no other ATS script interpreted first
#==============================================================================
if !$imported[:AdvancedTextSystem]
#============================================================================
# *** DataManager
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# aliased method - create_game_objects; make_save_contents;
# extract_save_contents
#============================================================================
module DataManager
class << self
alias modb_ats_crtgmobj_6yh7 create_game_objects
alias mlba_ats_mksave_5tg9 make_save_contents
alias ma_ats_extrcsvcon_8uj2 extract_save_contents
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Create Game Objects
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def self.create_game_objects(*args, &block)
modb_ats_crtgmobj_6yh7(*args, &block)
$game_ats = Game_ATS.new
$game_ats.init_new_installs
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Make Save Contents
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def self.make_save_contents(*args, &block)
contents = mlba_ats_mksave_5tg9(*args, &block)
contents[:ats] = $game_ats
contents
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Extract Save Contents
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def self.extract_save_contents(contents, *args, &block)
ma_ats_extrcsvcon_8uj2(contents, *args, &block)
$game_ats = contents[:ats] ? contents[:ats] : Game_ATS.new
$game_ats.init_new_installs
end
end
#============================================================================
# ** Game_ATS
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# This class holds the default data for all scripts in the ATS series
#============================================================================
class Game_ATS
def initialize; reset; end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Reset any or all installed ATS scripts
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def reset(script_name = nil)
if script_name.is_a? (Symbol) # If script to reset specified
CONFIG[script_name].each_pair { |key, value|
self.send("#{key}=".to_sym, value)
$game_message.send("#{key}=".to_sym, value)
}
else # Reset all ATS scripts
CONFIG.keys.each { |script| reset(script) }
end
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Initialize any newly installed ATS scripts
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def init_new_installs
CONFIG.keys.each { |script| reset(script) unless self.send(script) }
end
end
#============================================================================
# ** Game_Message
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# aliased method - clear
#============================================================================
class Game_Message
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Clear
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias mlb_ats_clrats_5tv1 clear
def clear(*args, &block)
mlb_ats_clrats_5tv1(*args, &block) # Run Original Method
return if !$game_ats
Game_ATS::CONFIG.values.each { |installed|
installed.keys.each { |key| self.send("#{key}=".to_sym, $game_ats.send(key)) }
}
end
end
#============================================================================
# ** Game_Interpreter
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# new methods - ats_all; ats_next
#============================================================================
class Game_Interpreter
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * ATS All
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def ats_all(sym, *args, &block)
$game_ats.send("#{sym}=".to_sym, *args, &block)
ats_next(sym, *args, &block)
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * ATS Next
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def ats_next(sym, *args, &block)
$game_message.send("#{sym}=".to_sym, *args, &block)
end
end
$imported[:AdvancedTextSystem] = true
end
# Fix the error with Escape codes
unless $imported[:MA_EscapeCodesFix]
#============================================================================
# ** Window_Base
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# aliased method - obtain_escape_code
#============================================================================
class Window_Base
alias maatspf_obtainesccode_2jk3 obtain_escape_code
def obtain_escape_code(*args, &block)
code = maatspf_obtainesccode_2jk3(*args, &block)
if code.nil?
p "ERROR in #{self}:\nThere is no escaped code between \ and [ in your text."
""
else
code
end
end
end
$imported[:MA_EscapeCodesFix] = true
end
unless $imported[:"MA_ParagraphFormat_1.0.1"]
#==============================================================================
# ** MA_Window_ParagraphFormat
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# This module inserts into Window_Base and provides a method to format the
# strings so as to go to the next line if it exceeds a set limit. This is
# designed to work with draw_text_ex, and a string formatted by this method
# should go through that, not draw_text.
#==============================================================================
module MA_Window_ParagraphFormat
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Calc Line Width
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def mapf_calc_line_width(line, tw = 0, contents_dummy = false)
return tw if line.nil?
line = line.clone
unless contents_dummy
real_contents = contents # Preserve Real Contents
# Create a dummy contents
self.contents = Bitmap.new(24, 24)
reset_font_settings
end
pos = {x: 0, y: 0, new_x: 0, height: calc_line_height(line)}
while line[/^(.*?)\e(.*)/]
tw += text_size($1).width
line = $2
# Remove all ancillaries to the code, like parameters
code = obtain_escape_code(line)
# If direct setting of x, reset tw.
tw = 0 if ($imported[:ATS_SpecialMessageCodes] && code.upcase == 'X') ||
($imported["YEA-MessageSystem"] && code.upcase == 'PX')
# If I need to do something special on the basis that it is testing,
# alias process_escape_character and differentiate using @atsf_testing
process_escape_character(code, line, pos)
end
# Add width of remaining text, as well as the value of pos[:x] under the
# assumption that any additions to it are because the special code is
# replaced by something which requires space (like icons)
tw += text_size(line).width + pos[:x]
unless contents_dummy
contents.dispose # Dispose dummy contents
self.contents = real_contents # Restore real contents
end
return tw
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Format Paragraph
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def mapf_format_paragraph(text, max_width = contents_width)
text = text.clone
# Create a Dummy Contents - I wanted to boost compatibility by using the
# default process method for escape codes. It may have the opposite effect,
# for some :(
real_contents = contents # Preserve Real Contents
self.contents = Bitmap.new(24, 24)
reset_font_settings
paragraph = ""
while !text.empty?
text.lstrip!
oline, nline, tw = mapf_format_by_line(text.clone, max_width)
# Replace old line with the new one
text.sub!(/#{Regexp.escape(oline)}/m, nline)
paragraph += text.slice!(/.*?(\n|$)/)
end
contents.dispose # Dispose dummy contents
self.contents = real_contents # Restore real contents
return paragraph
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Format By Line
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def mapf_format_by_line(text, max_width = contents_width)
oline, nline, tw = "", "", 0
loop do
# Format each word until reach the width limit
oline, nline, tw, done = mapf_format_by_word(text, nline, tw, max_width)
return oline, nline, tw if done
end
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Format By Word
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def mapf_format_by_word(text, line, tw, max_width)
return line, line, tw, true if text.nil? || text.empty?
# Extract next word
if text.sub!(/([ \t\r]*)(\S*)([\n\f]?)/, "") != nil
prespace, word, line_end = $1, $2, $3
ntw = mapf_calc_line_width(word, tw, true)
pw = contents.text_size(prespace).width
if (pw + ntw >= max_width)
# Insert
if line.empty?
# If one word takes entire line
return prespace + word, word + "\n", ntw, true
else
return line + prespace + word, line + "\n" + word, tw, true
end
else
line += prespace + word
tw = pw + ntw
# If the line is force ended, then end
return line, line, tw, true if !line_end.strip.empty?
end
else
return line, line, tw, true
end
return line, line, tw, false
end
end
class Window_Base
include MA_Window_ParagraphFormat
end
$imported[:"MA_ParagraphFormat_1.0"] = true
$imported[:"MA_ParagraphFormat_1.0.1"] = true
end
#==============================================================================
# ** Game Message
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# new public instance variables - ats_paragraph_formatting; paragraph_format;
# ats_alignment; append_text
# aliased method - all_text
#==============================================================================
class Game_Message
Game_ATS::CONFIG[:ats_formatting].keys.each { |key| attr_accessor key }
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * All Text
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias maatsf_alltex_6hu7 all_text
def all_text(*args, &block)
result = maatsf_alltex_6hu7(*args, &block) # Call Original Method
# Look for the Paragraph Format Code
result.gsub!(/([\/\\])PF/i) { |match| self.paragraph_format = (match[0] == "\\"); "" }
# Remove natural \n if paragraph format is ON
result.gsub!(/\s*[\r\n\f]\s*/) {" "} if paragraph_format
result
end
end
#==============================================================================
# ** Game_Interpreter
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# aliased methods - command_101; next_event_code
# new method - maatsf_same_message_conditions?
#==============================================================================
if !$imported[:ATS_MessageOptions]
class Game_Interpreter
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Display Text Message
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias maatsf_disptext_3jf5 command_101
def command_101(*args, &block)
@ats_appending_text = $game_message.append_text
maatsf_disptext_3jf5(*args, &block) # Call Original Method
@ats_appending_text = false
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Next Event Code
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias maatsf_nexcode_5rq9 next_event_code
def next_event_code(*args, &block)
result = maatsf_nexcode_5rq9(*args, &block) # Call Original Method
if @ats_appending_text && result == 101
if maats_same_message_conditions?(@index + 1)
@index += 1
result = next_event_code(*args, &block)
end
end
result
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Same Message Conditions?
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def maats_same_message_conditions?(list_index)
n_params = @list[list_index].parameters
if ($imported[:MA_CompositeGraphics] || $imported[:ATS_FaceOptions]) &&
@list[list_index + 1] && @list[list_index + 1].parameters[0][/^\\([AP])F\[(\d+)\]/i]
param = $2.to_i
actor = ($1 == 'A') ? $game_actors[param] : $game_party.members[param - 1]
return (actor.face_name == $game_message.face_name &&
actor.face_index == $game_message.face_index &&
n_params[2] == $game_message.background && n_params[3] == $game_message.position)
end
n_params[0] == $game_message.face_name && n_params[1] == $game_message.face_index &&
n_params[2] == $game_message.background && n_params[3] == $game_message.position
end
end
end
#==============================================================================
# *** Paragraph Formatting for Message Windows
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# This module is included in Window_Message and Window_ScrollText
#==============================================================================
module ATS_Formatting_WindowMessage
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Convert Escape Characters
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def maatsf_convert_escape_characters(text, *args, &block)
# Alignment
text.gsub!(/\eA\[([012])\]/i) { "\eALIGN\[#{$1}\]" }
text.gsub!(/\eA\[([LRC])\]/i) { "\eALIGN\[#{$1.upcase == 'L' ? 0 : $1.upcase == 'C' ? 1 : 2}\]" }
text.gsub!(/\ePN/i, "\f") # New Page
# New Line
text.gsub!(/\e(N|LB)/i, "\n") unless $imported[:ATS_SpecialMessageCodes]
text
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Paragraph New Line
#``````````````````````````````````````````````````````````````````````````
# This adds processing for paragraph format and alignment to these methods
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def maatsf_paragraph_new_line(orig_method, text, pos, *args, &block)
tw = nil
tw = maatsf_set_next_line(text, pos) if $game_message.paragraph_format && !text.nil? && !text.empty?
orig_method.call(text, pos, *args, &block) # Call original Method
# Alignment
next_line = text[/^[^\n\f]*/]
align = maatsf_line_alignment(next_line)
if align != 0 # If not left aligned
if tw.nil?
@atsf_testing = true
tw = mapf_calc_line_width(next_line)
@atsf_testing = false
end
space = maatsf_total_line_width(pos[:y]) - tw
pos[:x] = [pos[:x] + (space / (align == 1 ? 2 : 1)), pos[:x]].max
end
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Paragraph Line
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def maatsf_set_next_line(text, pos)
text.gsub!(/^[ \t\r\f]*/, "")
max_width = maatsf_total_line_width(pos[:y])
# Create a Dummy Contents
real_contents = contents # Preserve Real Contents
self.contents = Bitmap.new(24, 24)
self.contents.font = real_contents.font.dup
@atsf_testing = true
# Do everything
oline, nline, tw = mapf_format_by_line(text.clone, max_width)
# Replace old line with the new one
text.sub!(/#{Regexp.escape(oline)}/m, nline)
contents.dispose # Dispose dummy contents
self.contents = real_contents # Restore real contents
@atsf_testing = false
return tw
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Alignment
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def maatsf_line_alignment(line)
line[/\eALIGN\[([012])\]/] != nil ? $1.to_i : $game_message.ats_alignment
end
end
#==============================================================================
# ** Window_Message
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# aliased methods - convert_escape_characters; new_page; process_new_line;
# wait; wait_for_one_character; input_pause; process_escape_character
# new methods - maatsf_set_next_line; mapf_format_by_word;
# mapf_calc_line_width; maatsf_total_line_width;
# maatsf_line_alignment; maats_convert_escape_characters;
# maatsf_paragraph_new_line
#==============================================================================
class Window_Message
include ATS_Formatting_WindowMessage
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Convert Escape Characters
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if instance_methods(false).include?(:convert_escape_characters)
# If convert_escape_characters already defined in Window_Message, just alias
alias maatsf_convrtescchars_8ju5 convert_escape_characters
def convert_escape_characters(*args, &block)
maatsf_convert_escape_characters(maatsf_convrtescchars_8ju5(*args, &block))
end
else
# If convert_escape_characters undefined in Window_Message, call super method
def convert_escape_characters(*args, &block)
maatsf_convert_escape_characters(super(*args, &block))
end
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * New Page / Process New Line
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[:new_page, :process_new_line].each { |meth|
alias_method(:"maatsf_#{meth}_3wj9", meth)
define_method(meth) do |*args|
maatsf_paragraph_new_line(method(:"maatsf_#{meth}_3wj9"), *args)
end
}
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Wait / Wait for One Character / Process Input
#``````````````````````````````````````````````````````````````````````````
# Do not permit these to run when testing
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[:wait, :wait_for_one_character, :input_pause].each { |meth|
alias_method(:"maatsf_#{meth}_2hd4", meth)
define_method(meth) do |*args|
send(:"maatsf_#{meth}_2hd4", *args) unless @atsf_testing
end
}
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Process Escape Character
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias maatsf_proceschar_4fq6 process_escape_character
def process_escape_character(code, text, *args, &block)
if code.upcase == 'ALIGN'
$game_message.ats_alignment = obtain_escape_param(text)
else
maatsf_proceschar_4fq6(code, text, *args, &block) # Call Original Method
end
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Total Line Width
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def maatsf_total_line_width(y = 0)
contents_width - new_line_x
end
end
#==============================================================================
# ** Window_ScrollText
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# aliased methods - convert_escape_characters; process_new_line;
# update_all_text_height
# new methods - maatsf_set_next_line; mapf_format_by_word;
# mapf_calc_line_width; maatsf_total_line_width;
# maatsf_line_alignment; maats_convert_escape_characters;
# maatsf_paragraph_new_line
#==============================================================================
class Window_ScrollText
include ATS_Formatting_WindowMessage
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Convert Escape Characters
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias maatsf_convescchrs_3wv5 convert_escape_characters
def convert_escape_characters(*args, &block)
maatsf_convert_escape_characters(maatsf_convescchrs_3wv5(*args, &block))
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Process New Line
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias maatsf_procenewlin_2gv5 process_new_line
def process_new_line(*args, &block)
maatsf_paragraph_new_line(method(:maatsf_procenewlin_2gv5), *args, &block)
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Has to be done in process Character
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias maatsf_updalltextheight_2sd8 update_all_text_height
def update_all_text_height(*args, &block)
text = convert_escape_characters(@text)
if $game_message.paragraph_format
new_text = ""
pos = { x: 4, y: 0, new_x: 4, height: fitting_height(1) }
while !text.nil? && !text.empty?
maatsf_set_next_line(text, pos)
if text.sub!(/^([^\n\f]*)([\n\f])/, "")
new_text += $1 + $2
else
new_text += text
break
end
end
@text = new_text
end
maatsf_updalltextheight_2sd8(*args, &block) # Run Original Method
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Process Escape Character
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias maatsf_processesc_2hk8 process_escape_character
def process_escape_character(code, text, *args, &block)
if code.upcase == 'ALIGN'
$game_message.ats_alignment = obtain_escape_param(text)
else
maatsf_processesc_2hk8(code, text, *args, &block) # Call Original Method
end
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Total Line Width
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def maatsf_total_line_width(y = 0)
contents_width
end
end
else
p "You have two copies of ATS: Formatting installed. Please remove one."
end
Credit
Thanks
- djDarkX, for a bug report.
- titan_strife, for a bug report.
- ThatRandomGuy00, for a bug report.
Support
Please post in this topic at RMRK if you require any assistance with this script at all. If you encounter any bugs or incompatibilities, please let me know about them so that I can fix them.
Known Compatibility Issues
It should be compatible with all other scripts in the ATS series, and it might also be compatible with other message systems as long as this script is placed below them in the Script Editor (though still above Main).
[spoiler=Yanfly's Victory Aftermath]
If using Yanfly's Victory Aftermath with the Formatting, then \n will not work in quotes to break lines. You can fix that in two ways (Note: In some older versions of the Victory Aftermath script, \n would not work at all. The following fixes apply only to versions of Yanfly's Victory Aftermath that are v. 1.04 or greater):
If you want to turn off paragraph formatting altogether, you can simply go to line 171 of the Victory Aftermath script and add /pf anywhere the following line:
HEADER_TEXT = "\e>\eC[6]%s\eC[0]\e<\n" # Always at start of messages.
Like this:
HEADER_TEXT = "/pf\e>\eC[6]%s\eC[0]\e<\n" # Always at start of messages.
Alternatively, if you have ATS: Formatting 1.0.3. or later, the \lb code can be used. So, if you want paragraph formatting to apply to the body of the quote but not to the header, you would change the same line and replace \n with \elb, like so:
HEADER_TEXT = "\e>\eC[6]%s\eC[0]\e<\elb" # Always at start of messages.
You can also use \lb in the notefields to break a line manually.
[/spoiler]
I may have found a compatibility issue between this script and your Composite Graphics script. (that, or something else is interfeering, or I just mucked it up myself).
As soon as I made an event show text where there is a \af[3] reference on top, and a fairly long line of text underneath that (enough to require formating from this script) it gave an error:
QuoteScript 'ATSTextAlignment' line 334: NoMethodError ocurred.
undefined method 'face_name' for nil:NilClass
Funny thing is that this text I want to show has two other show texts before it, and the error occurs between the first and second show texts (which also have an \af reference, but the text bellow is too short to require formating of any kind)
Line 334, btw, is in this code:
Quotedef maats_same_message_conditions?(list_index)
n_params = @list[list_index].parameters
if ($imported[:MA_CompositeGraphics] || $imported[:ATS_FaceOptions]) &&
@list[list_index + 1] && @list[list_index + 1].parameters[0][/^\\([AP])F\[(\d+)\]/i]
param = $2.to_i
actor = ($1 == 'A') ? $game_actors[param] : $game_party.members[param - 1]
return (actor.face_name == $game_message.face_name && <===== This is line 334
actor.face_index == $game_message.face_index &&
n_params[2] == $game_message.background && n_params[3] == $game_message.position)
end
n_params[0] == $game_message.face_name && n_params[1] == $game_message.face_index &&
n_params[2] == $game_message.background && n_params[3] == $game_message.position
end
end
end
P.S - The scripts I have are, in this order, between Materials and Main Process:
Composite Graphics
Custom Item Categories
Receipt Window
ATS Special Message Codes
ATS Text Alignment
Customizable Main Menu
Quest Journal
all from RMRK
Alrighty, I will look into it tomorrow. Thank you for the error report.
First of all, I want to say I've always loved your scripts! Now then, just wanted to quickly report another (possible) issue. I don't get an error per se, but all naturally displayed text without alignment code is automatically aligned to the right for some reason, including some that are harder to control (like the after battle text). Nothing else, like menus and so on, seems to be affected. Just text displayed in the message window. Of course, it may just be something stupid I did, but removing your script fixes the issue. Also, I haven't modified it at all.
I'm using yanfly's Ace Message System, but you specifically note it in your code so I doubt it's a compatibility issue. I browsed through the code but unfortunately couldn't find the problem or a way to permanently align everything to the left. Thus I'm stumped, which is a shame, because this script of yours makes dialogue a whole lot less of an annoyance! Anyway, sorry for troubling you.
EDIT:
It actually seems to be a combatability issue with one of my other scripts, as putting yours at the very bottom seems to have fixed my problem. I'm not sure which, but I'll see if I can go through a process of elimination and find out. Besides yanfly's, I really don't use many other scripts, I'm an old fashioned eventing knid of guy.
<just a sec>
Have I ever mentioned how I love you forever, Seamus?
is there a way to force a new message window using this script, to stop it putting text from two separate text events in the same 'box'?
Yes:
Quote from: Seamus on January 28, 2012, 07:41:48 PM
# Set the below value to either true or false. If true, then any
# immediately subsequent display text event commands with the same settings
# will be joined together and they will show in the same message window if
# there is space. This option is only useful if using paragraph format. If
# you are using ATS: Message Options, then this script should be below it
# and it will only recognize the value of :append_text set up in that
# script.
append_text: true,
Quote from: Seamus on January 28, 2012, 07:41:48 PM
# Similar to paragraph format, you can use the following commands in a
# script call
#
# ats_all(:append_text, true) # Turns default appended text on
# ats_all(:append_text, false) # Turns default appended text off
# ats_next(:append_text, true) # Turns appended text on for next message
# ats_next(:append_text, false) # Turns appended text off for next message
In other words, if you want to turn that feature off for all messages then set that line in the configuration to false:
append_text: false,
If you only want to turn it off for the next message but want it on generally, leave the above line as true and instead insert the following in a Script command above the message:
ats_next(:append_text, false)
Alternately, you can insert a blank comment between the two message commands.
Quote from: Seamus on April 19, 2012, 06:47:43 PM
Alternately, you can insert a blank comment between the two message commands.
simple, thanks
Modern Algebra I seem to be getting a script error in regards to your 'Process Escape Character' section.
Here is the error
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fimg4host.net%2Fupload%2F231732234f9576078026c.JPG&hash=14b992adca1216f62f805c9a195fe8d07b5652f5)
And this is what that person is saying
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fimg4host.net%2Fupload%2F231734464f957696bf74e.JPG&hash=457a652233564240274db9006772e3f2732cf773)
Hmm, can I see a demo with the error recreated?
What's happening is that it is calling the process_escape_character and passing nil as the code, but that would cause an error with or without my script. I need to see a demo of the error in order to see where in the script the method call is happening and work from there.
I was gonna post a demo with the error in the first post, but I thought it was something simple, so I chose not to.
Anyway, here.
Ah, well it's because you forgot the c between \[0]. It shouldn't be:
Why hello \c[12]Azula\[0], what brings you to my lovely home?
It should be:
Why hello \c[12]Azula\
c- , what brings you to my lovely home?
That error happens whether or not you have my ATS: Formatting script - it's an error inherited from the default scripts. That said, it's a nasty error for such a small oversight. I will have to fix it.
In the time frame between you looking at the project and me proof reading my text, I realised that very same thing ;_;
My mistake 8)
Also thanks for this script MA, it's doing wonders in speeding up the text process ;D
Hello,
Your script seems to not work with Ace Message System (http://yanflychannel.wordpress.com/rmvxa/core-scripts/ace-message-system/)
Because this is what happen and I've put your script below it :
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fuppix.net%2Ff%2F5%2F3%2Faac157670051d9d7cc90fe2ed5909t.jpg&hash=6d1e2f2215fc6d7b65f875856880f03f3548ca54) (http://uppix.net/f/5/3/aac157670051d9d7cc90fe2ed5909.html)
Did you try doing \n (new line) or \pn (new page)
Example:
My test \n My test \pn My test
The following above will result to
Messagebox:
My test
My test
New Message Box
My test
I just tried it and it didn't work.
Well, what is your input, and what are you trying to make it look like?
Just the normal thing :
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fimg837.imageshack.us%2Fimg837%2F7975%2Fpf1o.png&hash=36f5505bbd72bbf37946dd16e52fe362ba088fd1)
Here how I set it up :
First example > http://uppix.net/e/1/8/10cda5815710ae16fd000dba02309.gif
Result > http://uppix.net/f/5/3/aac157670051d9d7cc90fe2ed5909.gif
Second example (on another map) > http://uppix.net/7/4/a/35d95d8a7c36fdaca93d7c483283f.gif
Result > http://uppix.net/c/8/8/e793af5e6d10d4df528b3f549b7c9.gif
I don't know why the display is different from map n°1 and 2... I only changed the font size in Yanfly script and didn't touch anything else even in your script.
So, is the problem that your window is only one line high? Are you sure that when you say you changed the font size, you didn't accidentally just change the window size?
Anyway, the first example picture has different input from your first result picture so I can't really tell anything from that. One thing I can say is that YEA uses \n<> for a code, so that might be interfering with the line break code. The other thing I can say is that the formatting script won't divide a line into syllables, so you should put spaces in your test string. In other words, if you have a long string like:
TestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTest
then the script will draw it all on one line and most of it will thus be invisible; it won't automatically break the string. So, put spaces in your test strings.
Anyway, I think the easiest thing would be for you to recreate the error in a test project and share it with me. That way I will be able to assist you more quickly and accurately.
I've found why I got the result in the first screenshot, it's because I used game variable 21 and 22 and Yanfly use them too in his script.
So the only problem remain is the result I got in the second screenshot because I can't get automaticly the same result like you showed in your example in your first post. I can't get this feature with Yanfly script+your script.
QuoteParagraph Formatting permits you to ignore the markers when displaying text - nothing will get cut off.
Demo is in the attachement.
I tested the demo and am still unsure what your objective is. As I mentioned earlier, you should use spaces, but in this case everything that you put in the text box was able to fit on one line, so it was all drawn on one line. Nothing was cut off, so there was no reason to bring the text to a second line. I also tested using \n to break the lines, and that worked too. I'm not sure what problem you are detecting with the script since it is operating the way it is supposed to operate.
I understood wrong your instructions because my english is bad.
I though your script automaticly break line.
Sorry, for the bother.
It does automatically break lines, but only when it's necessary. If everything you write in a text box can fit on one line, it will be shown on one line. It does automatically break lines when it's necessary though.
Your tests are such that the entire text you input can fit on one line - that is the reason the text is not being broken up. If you wrote something such that it couldn't all fit on just one line, then this script would put it on more than one line.
Just tried and copy pasted what you said in my dialog and indeed it work.
I though it will automaticly break line if my words gone beyond the margin.
Thank you very much for your help. :)
p.s : will upload a demo for the quest journal script ?
Wow. Another fantastic script. FYI I found a slight "quirk" that might be worth mentioning in the title. If you have a space between the end of a line and a \n line break it ignores formatting.
For example;
\a[C]Hello\n
\a[C]My name is Chickan
Displays
Hello
My name is Chickan[/size]
Whereas
\a[C]Hello \n
\a[C]My name is Chickan
would display
Hello
My name is Chickan
It's not aproblem as such but it was causing me some initial confusion.
Thanks for the error report.
Okay, so I'm having a slight problem with text alignment and pauses. When I align a message to the center via \a[C] (or \a[1]) and try to put a 1 second (\| or \w[60]) pause anywhere in the message, whenever the message begins a second or third line, the entire message window blanks out, as if no text was inputted, but it returns a second later.
For example :
\a[C]Hello, this is a test.\|
This line appearing instantly is vital to my survival.\|
Will make the window write "Hello, this is a test." and as soon as the first line is completed, it blanks out, as in the window is completely empty as shown below:
(https://dl.dropbox.com/u/19590483/Troubleshooting.png)
The message window stays like that for a second before writing the rest of the message, the first line teleporting in as if nothing was wrong in the first place.
I've tried this with a completely new project and no other scripts enabled, and I've tried the message both with a face and without a face image, the facial image disappears with the message as well.
Line 129's paragraph_format is set to false.
Line 136's append_text is also set to false.
I would rather they both stay off, and I need those 1 second pauses (actually more like 3 second pauses, but it happens with a one second pause anyway.) for certain dialogue in my project.
Oddly enough, the error does not happen if I use the 15 frame pause ( \. ) once or twice, but when I have four \.s then it does the same glitch as just putting a \|
Is there something I'm doing wrong or is this a legitimate bug in the coding? This did not happen with version 1.0 of this script.
Sorry, I haven't tested this script enough when paragraph formatting is off. Thank you so much for directing me to that error and I have updated the script to version 1.1.2 with a fix.
No problem, and thank you for the same-day fix. ;8
Hi there, I'm new, but I figured I'd chime in with a bit of a bug.
I noticed that when trying to center text, alignment doesn't take into account changes in font size very well. For instance, if I do:
\pf\a[c]\{This is a line of text\n
\}This is sub-text
It looks rather weird and misaligned. If I forgo font sizes, it works beautifully. Also, this is with paragraph and append off by default as I'm using quite a few Yanfly scripts, like his message system and victory aftermath.
Also, it's not an incompatibility with his scripts as I used yours alone, before even installing his message system and I had the same result and even worse with \{\{ in place.
By the way, thanks for the killer script. This is a must-have add-on for if using Yanfly's and a must have period for any game!
Well, when I tried it like this:
\pf\a[c]\{This is a line of text\}\n
This is sub-text
It worked fine, so I think it is only when the size of the font changes in the middle of a line that problems arise. I will look into it.
Interesting. Thanks for the tip and glad you're looking into it.
I have a question, how can you make the alignment default for all messages? It's kind of a hassle editing each text and appending \a[C] to them. Thanks :D
Right above the Editable Region, you should see this line:
ats_alignment: 0,
Change it to:
ats_alignment: 1,
You can also change it throughout the game with the ats_next and ats_all codes:
ats_all(:ats_alignment, 1)
ats_next(:ats_alignment, 1)
Naturally, 0 is left-aligned; 1 is centre-aligned; and 2 is right-aligned.
Wow, I didn't see that. Thanks! :D
I'm not sure if Modern Algebra still supports this script or anything but I've come up with a problem with it. For some reason I have text that is forcing line breaks even though I'm not specifying for one to occur. It's kind of annoying. the following are a few screen shots of what I'm talking about.
This image here shows that I have the text in the editor all on one line separated by page breaks.
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fi294.photobucket.com%2Falbums%2Fmm114%2Ftitanstrife%2FTextWrap-1.png&hash=50a1d0494add3ceb86d1c30b3d996d9dbbb21622)
This image shows that when tested and gone into the game to play it, the game is forcing a chunk of text down a line even though there is clearly space for more words on the first line.
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fi294.photobucket.com%2Falbums%2Fmm114%2Ftitanstrife%2FTextWrap2.png&hash=3d9c98e02f43014e830cbf758183a23b1c06465e)
This image is similar to the one above that happens a few pages down in the text where the process repeats itself.
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fi294.photobucket.com%2Falbums%2Fmm114%2Ftitanstrife%2FTextWrap3-1.png&hash=389c5c5d7532196f934a2c9ebe3125517f26890e)
This script seemed to be doing just fine until I went in and tested it in the game. To make things easier to possibly find the problem here, I have not edited or changed anything in the script and I am not using any other scripts but this one at the moment.
How have I not noticed this before...
This will prove very useful for my new game, modern. Thank you!
Thanks zach! I'm glad you like it.
Also, thank you for the detailed bug report titan_strife. I have updated the script and I believe that I've fixed that error. You can collect the updated script from the first post. Let me know.
Thanks! The update seemed to fix the problem I was having. I'll let you know if I come up with any other problems. It is a really awesome script.
So, I've been a huge fan of this script on RMVX, so when I started a new project on RMVXa I had to get it - but it doesn't seem to be working correctly.
The first time a message pops up, the paragraph is not formatted correctly. But if you bring up the message a second time, it's correct. It appears to be correct until you quit the game, I have no idea why it's doing that.
Like so:
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FxQuQKeP.png&hash=26d8e924cd9b37b9b859da246f9546809f203e27)
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FDjzUl9o.png&hash=ee2f82d1cb7abf8239cedaed5e6ac627d3b5c623)
The only scripts I have installed are the other MA Message scripts.
QuoteATS: Special Message Codes [VXA]
ATS: Formatting [VXA]
ATS: Message Options [VXA]
ATS: Choice Options [VXA]
If you'd like me to upload the project file, just let me know.
I can't really help with scripting, but I think I know how to find out what's causing it.
Make a new project, insert the Formatting script. Place some characters with some dialogue.
1. Test it. (Does it format correctly? If yes, go to step 2. No? Go to step 3.)
2. Add another script from the list, go to step 1.
3. The latest script you just added is most likely the one causing it.
Is line height not adjustable with this script? If a small font size is set, it can almost look double-spaced.
Is there a way to make spaces in the beginning of the paragraph? The script seems to ignore the spaces that i put in manually.
Very nice script, thank you modern algebra!
I just wanted to ask if it is okay to use this script in a commercial game.