How to make line breaks in screen texts

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
GeeSeki
Regular
Posts: 112
Joined: Sat Dec 17, 2016 3:39 am
Projects: A Town Uncovered
itch: geeseki
Contact:

How to make line breaks in screen texts

#1 Post by GeeSeki »

Hey, I'm wondering if there's an \n equivalent for text within a screen? I tried using \n but all it does is crashes my game and gives me an error.

It's just kind of annoying to have every new line start with 'text "...'

Code: Select all

vbox:
            
    text "+This is my text"
    text "+Hello world, I am testing this"
    text "+Random words to fill the lines"
I want it to be more like this for the sake of ease:

Code: Select all

vbox:
            
    text "+This is my text
          +Hello world, I am testing this
          +Random words to fill the lines"

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3791
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: How to make line breaks in screen texts

#2 Post by Imperf3kt »

Did you try to use \N instead of \n?

You can also use triple quoted strings.

Code: Select all

    """Your
    Text
    Here"""
Last edited by Imperf3kt on Tue Oct 16, 2018 2:28 am, edited 2 times in total.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

User avatar
GeeSeki
Regular
Posts: 112
Joined: Sat Dec 17, 2016 3:39 am
Projects: A Town Uncovered
itch: geeseki
Contact:

Re: How to make line breaks in screen texts

#3 Post by GeeSeki »

What's the difference between \N and \N? I tried both \N and \n and it gives me 'SyntaxError: EOL while scanning string literal'

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3791
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: How to make line breaks in screen texts

#4 Post by Imperf3kt »

Capital N is hard line break - do it no matter what, right here
Lower case n is soft line break - do it about here, if the word fits
Edit.
Damn phone, always messing up what I type!
Last edited by Imperf3kt on Tue Oct 16, 2018 2:27 am, edited 1 time in total.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

User avatar
GeeSeki
Regular
Posts: 112
Joined: Sat Dec 17, 2016 3:39 am
Projects: A Town Uncovered
itch: geeseki
Contact:

Re: How to make line breaks in screen texts

#5 Post by GeeSeki »

When I try the triple quoted string, it gives me this

Code: Select all

I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.


File "game/scenes/myhouse/mybedroom/both/mybedroom_desk.rpy", line 97: expected a keyword argument, colon, or end of line.
(Perhaps you left out a " at the end of the first line.)
    text """+This is my text\n
           ^
                      Hello everybody"""

Post Reply

Who is online

Users browsing this forum: Google [Bot]