how to word wrap?

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
Lighthouse
Newbie
Posts: 4
Joined: Wed Jan 24, 2024 1:59 pm
Contact:

how to word wrap?

#1 Post by Lighthouse »

Hi,

in the script.rpy file I have something like:
j "Greetings! ( press the space-bar to continue )"

How can I force a new line for: ( press the space-bar to continue )"

Thanks and kind regards

Lighthouse
Newbie
Posts: 4
Joined: Wed Jan 24, 2024 1:59 pm
Contact:

Re: how to word wrap?

#2 Post by Lighthouse »

Hi,

in the script.rpy file I have something like:
j "Greetings! ( press the space-bar to continue )"
j is a Character.
How can I force a new line for: ( press the space-bar to continue )"

Thanks and kind regards

User avatar
Sugar-Junkie
Regular
Posts: 63
Joined: Sat Jul 14, 2012 9:08 am
Projects: Smile for Me (WIP), Greystone Manor (hiatus)
Location: France
Contact:

Re: how to word wrap?

#3 Post by Sugar-Junkie »

Maybe j "Greetings! {p}( press the space-bar to continue )" ? It does create a paragraph break, but it pauses between both lines, unsure if that's how you want it to go.

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

Re: how to word wrap?

#4 Post by Imperf3kt »

You could add a hard linebreak with \n

Code: Select all

    j "Greetings!\n( press the space-bar to continue )"

I believe triple quoted strings also work (but I haven't tested this)
These will format the text however you enter it.

Code: Select all

    j _("""Greetings!
( press the space-bar to continue )""")
Edited to fix an error in original post
Last edited by Imperf3kt on Fri Jan 26, 2024 4:08 pm, 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

Lighthouse
Newbie
Posts: 4
Joined: Wed Jan 24, 2024 1:59 pm
Contact:

Re: how to word wrap?

#5 Post by Lighthouse »

Thanks to Sugar-Junkie and Imperf3kt,
as a beginner I appreciate your help very much. Both {p} and \N do not work. They give no error but fail in giving out two lines at the same time. I asked chatGPT3.5 which suggested [br] which results in errors. Also using 'vpunch' or using a variable did not work.
$ text_to_display = "wort1 wort2\nwort3"
e " {text_to_display}
It is very well possible that I made errors, but such a simple need should not require such an effort. Finally, on second try triple quotes worked with the following formating:
j """
This is a multi-line say statement.
It allows you to display text over multiple lines
without the need for explicit line breaks.
"""
Thanks again
Lighthouse

PS out of topic, how do I insert an logo/avatar in my profile?

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2407
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: how to word wrap?

#6 Post by Ocelot »

it is \n not \N (capitalization matter)

For the future, it is nessesary to specify what "does not work" means. Does it crashes without giving any errors? Does it give you an error? Does it work, but output is not what you want? If so, what did you get, and what did you expect? Or maybe it does give you what you want, but with some side effects, that makes it unuseable?
< < insert Rick Cook quote here > >

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

Re: how to word wrap?

#7 Post by Imperf3kt »

Oops, that's my mistake. I always confuse whether I'm supposed to capitalize that or not
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

Lighthouse
Newbie
Posts: 4
Joined: Wed Jan 24, 2024 1:59 pm
Contact:

Re: how to word wrap? Addition and SOLVED

#8 Post by Lighthouse »

For the benefit of all I may add that within a triple quotes say statement one can force a linebreak by using \n.

Post Reply

Who is online

Users browsing this forum: Google [Bot], Sirifys-Al, Zapor