View difference between Paste ID: qneEXhL5 and itFCjaiU
SHOW: | | - or go back to the newest paste.
1
=begin
2-
Simple Paragrapher by Balrogic
2+
Simple Paragrapher 1.01 by Balrogic
3
4
This script is really simple. It does all the work on it's own.
5-
There is only one thing you need to configure, the width of the
5+
There is only one thing you might need to configure, the offset
6-
text drawing area in your message box. The default value of 520
6+
of the text drawing area in your message box. It's optional,
7-
is perfect with the default font settings and message box size.
7+
you can leave it alone unless you're using a different font and
8-
If you change your font or window and notice that text gets cut
8+
the message box is giving you problems. For example,
9-
off at the right side of your message window then uncomment puts
9+
10-
statement at line 32, activate your console window if inactive
10+
OFFSET = 1 + (24)
11-
and make a test event with a line of text that fills the entire
11+
12-
message line without getting cut off. Change the TEXT_WIDTH to
12+
will fix a problem that can cause certain custom font settings
13-
that number.
13+
to draw characters outside of the message box. Number in
14
parenthesis equal to standard_padding * 2, leave it alone unless
15
you've changed the standard padding in Window_Base.
16
17
This script is free to use in both commercial and non-commercial
18
games. Donations are optional but not discouraged. Private message
19
me at http://forums.rpgmakerweb.com/index.php?/user/52841-balrogic/
20
and offer me some pizza money if you just can't help yourself.
21
=end
22
class Window_Message < Window_Base
23-
  # CONFIGURATION  # Changing this changes how much text
23+
24-
  TEXT_WIDTH = 520 # to draw before making a new line.
24+
  # CONFIGURATION - Positive for shorter text, negative for longer text.
25
  OFFSET = 0 + (24)
26
27
  def process_all_text
28
    open_and_wait
29
    text = convert_escape_characters($game_message.all_text)
30
    pos = {}
31
    new_page(text, pos)
32-
    #puts contents.text_size(text).width
32+
33
    puts contents.text_size(text).width
34
    process_character(text.slice!(0, 1), text, pos) until text.empty?
35
  end
36
  def new_text_thingy(text)
37-
    @lengthy = 0
37+
38-
    allowable = TEXT_WIDTH - new_line_x
38+
    allowable = width - OFFSET - new_line_x
39
    text = text.split("\n")
40
    text.each_with_index {|value, index| text[index] = value.split(" ")}
41
    text.each_with_index {|value, index|
42
      @lengthy = 0
43
      if contents.text_size(value.join(" ")).width <= allowable
44
        @texty[index] = value.join(" ")
45
      else
46
        @texty[index] = ""
47
        value.each {|final|
48
          if contents.text_size(@texty[index] + final).width - @lengthy <= allowable
49
            @texty[index] += final + " "
50
          else
51
            @texty[index] += "\n"
52
            @lengthy = contents.text_size(@texty[index]).width
53
            @texty[index] += final + " "
54
          end
55
        } # value.each
56
      end
57
    } # text.each_with_index
58
    @texty.join("\n")
59
  end
60
end