-
Notifications
You must be signed in to change notification settings - Fork 0
User Guide
The only installment requirement is to download the line_brkr.py
file in the repo! You can download the file individually by clicking on it and selecting Download, or by downloading all the repo's contents.
line_brkr.py
is designed to run as a command-line interface. If you do not know what a command line interface is, consider reading this article to help you get started. Otherwise, continue reading the User Guide.
line_brkr.py
does not check for or makes any attempt to remedy .rpy
file scripting errors. Therefore, to use this program effectively you must guarantee that any files you pass into line_brkr.py
are errorless .rpy
files.
Before using the program, I recommend learning a few things about how line_brkr.py
behaves. Please read the next few sections to understand how the program behaves.
line_brkr.py
only handles a Text displayable when they're preceded by the show text
command and nothing else. Therefore, if you want to use line_brkr.py
for custom text then you're out of luck for now unfortunately.
For example, Text Displayable:
show text "Lorem ipsum dolor sit amet"
Is valid, whereas Text Displayable (where top_text
is defined elsewhere):
show top_text "Lorem ipsum dolor sit amet"
Will not. Same goes for any other possible Text Displayable.
Regardless of length, line_brkr.py
will always replace any newlines within a Text Displayable's text with whitespace before inserting new newlines. Furthermore, line_brkr.py
will trim any extra unescaped whitespace wherever it exists because "Ren'Py script text collapses adjacent whitespace into a single space character," so any
unescaped whitespace will be removed from the text since they are redundant.
For example, entering this command:
python line_brkr.py -r script.rpy -w newscript.rpy
Will run line_brkr.py
in its default mode (since no optional flags are given), so this Text Displayable:
show text " Lorem ipsum\ndolor \ sit \n amet"
pause
Will look like this after a default run of line_brkr.py
.
show text "Lorem ipsum dolor \ sit amet"
pause
Note the absence of any newline characters (\n) and trimming of all whitespace (except any escaped space characters '\ ').
line_brkr.py
will greedily keep your words within your Text Displayable text together if and only if the length of the word doesn't exceed the max length of the text before inserting a line break. In the case that a word exceeds the max text length, it will split the word by newlines as little as possible.
For example, entering this command:
python line_brkr.py -r script.rpy -w newscript.rpy -t 2
Will run line_brkr.py
with a max text length of 2
character before inserting a newline. So Text Displayable:
show text "Lorem ipsum dolor sit amet"
pause
Will look like this after this run of line_brkr.py
:
show text "Lo\nre\nm\nip\nsu\nm\ndo\nlo\nr\nsi\nt\nam\net"
pause
Consequently, doing a default run of line_brkr.py
will turn that Text Displayable into this:
show text "Lo re m ip su m do lo r si t am et"
pause
To avoid this behavior, I recommend setting the text length to nothing less than 25
characters, but sometimes your Text Displayable may contain words longer than the max length so consider yourself warned.
Ren'Py Text Tags allow a developer to stylize their text in many ways. Since most of these tags don't factor into the overall length of the line, they're often ignored when calculating the text length before breaking. However, there are some tags though that do require further analysis. These tags are:
Their special treatments are as follows. The {alt}
, {rt}
, and {art}
tags are not only ignored, but any text they envelop is also ignored too when calculating the text length. The {image}
tag is left ignored unless the -i
flag is used. The {space}
tag is left ignored unless the -s
flag is used. Finally, the {vspace}
is treated as an advanced newline, so it always remains unchanged but does reset the current text length count.
Ren'Py allows developers to use Ruby Text. When breaking lines, line_brkr.py
handles all ruby text (lenticular format or tag format) if and only if the length of the furigana/top-text does not exceed the length of the text underneath it. Because ruby text format is the responsibility of the developer, line_brkr.py
does not consider the possibility that the top-text length can exceed the bottom-text when calculating line length. Thus, it is the responsibility of the user to manage this possibility should it arise.
Now that you've read all that, it's time to learn about the Required Flags and the all the Optional Flags you can use with line_brkr.py
.