Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- =begin
- Simple Paragrapher 1.01 by Balrogic
- This script is really simple. It does all the work on it's own.
- There is only one thing you might need to configure, the offset
- of the text drawing area in your message box. It's optional,
- you can leave it alone unless you're using a different font and
- the message box is giving you problems. For example,
- OFFSET = 1 + (24)
- will fix a problem that can cause certain custom font settings
- to draw characters outside of the message box. Number in
- parenthesis equal to standard_padding * 2, leave it alone unless
- you've changed the standard padding in Window_Base.
- This script is free to use in both commercial and non-commercial
- games. Donations are optional but not discouraged. Private message
- me at http://forums.rpgmakerweb.com/index.php?/user/52841-balrogic/
- and offer me some pizza money if you just can't help yourself.
- =end
- class Window_Message < Window_Base
- # CONFIGURATION - Positive for shorter text, negative for longer text.
- OFFSET = 0 + (24)
- def process_all_text
- open_and_wait
- text = convert_escape_characters($game_message.all_text)
- pos = {}
- new_page(text, pos)
- text = new_text_thingy(text)
- puts contents.text_size(text).width
- process_character(text.slice!(0, 1), text, pos) until text.empty?
- end
- def new_text_thingy(text)
- @texty = []
- allowable = width - OFFSET - new_line_x
- text = text.split("\n")
- text.each_with_index {|value, index| text[index] = value.split(" ")}
- text.each_with_index {|value, index|
- @lengthy = 0
- if contents.text_size(value.join(" ")).width <= allowable
- @texty[index] = value.join(" ")
- else
- @texty[index] = ""
- value.each {|final|
- if contents.text_size(@texty[index] + final).width - @lengthy <= allowable
- @texty[index] += final + " "
- else
- @texty[index] += "\n"
- @lengthy = contents.text_size(@texty[index]).width
- @texty[index] += final + " "
- end
- } # value.each
- end
- } # text.each_with_index
- @texty.join("\n")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment