Input text prompt to fit in xmaximum

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
Kinmoku
Miko-Class Veteran
Posts: 591
Joined: Mon Aug 11, 2014 9:39 am
Completed: One Night Stand
Projects: VIDEOVERSE
Tumblr: gamesbykinmoku
itch: kinmoku
Location: Germany
Contact:

Input text prompt to fit in xmaximum

#1 Post by Kinmoku »

Hi all,

I'm stress-testing my game and noticed that, if the player inputs a very long one word into the input prompt, it overflows out of the box (see image). However, the input works as desired when typical text (with spaces) is written, going to multiple lines and fitting within the box.

This is kind of a non issue, but no doubt some player will spot it and think it's messy. Is there a way to get the input text to wrap (even if it's one long word)?

My code:

Code: Select all

    frame:
        background None
        xpos 582
        ypos 442

        xmaximum 760
        ymaximum 160

        input id "quote" default "" caret theme_image("caret") changed quote_change length 80 exclude "{}" color get_primary() xmaximum 760 ymaximum 160
quote_overflow.png
(6.03 KiB) Not downloaded yet

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

Re: Input text prompt to fit in xmaximum

#2 Post by Ocelot »

I don't think RenPy has support for individual word wrap.
You could detect long words in changed function and insert zero-width space symbol to break it up.
< < insert Rick Cook quote here > >

User avatar
Kinmoku
Miko-Class Veteran
Posts: 591
Joined: Mon Aug 11, 2014 9:39 am
Completed: One Night Stand
Projects: VIDEOVERSE
Tumblr: gamesbykinmoku
itch: kinmoku
Location: Germany
Contact:

Re: Input text prompt to fit in xmaximum

#3 Post by Kinmoku »

Ocelot wrote: Mon Jul 12, 2021 4:10 am I don't think RenPy has support for individual word wrap.
Ah, that makes sense.
Ocelot wrote: Mon Jul 12, 2021 4:10 am You could detect long words in changed function and insert zero-width space symbol to break it up.
I'm not quite sure what you mean.

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

Re: Input text prompt to fit in xmaximum

#4 Post by Ocelot »

Z​e​r​o​-​w​i​d​t​h s​p​a​c​e i​s a s​p​e​c​i​a​l c​h​a​r​a​c​t​e​r t​h​a​t i​s t​r​e​a​t​e​d a​s s​pa​c​e a​n​d l​o​g​i​c​a​l​l​y s​e​p​a​r​a​t​e w​o​r​d​s f​o​r w​o​r​d​-​w​r​a​p​, b​u​t d​o​e​s n​o​t h​a​v​e a w​i​d​t​h​, p​r​e​v​i​o​u​s a​n​d n​e​x​t l​​​e​t​t​e​r​s w​o​u​l​d b​e d​i​s​p​l​a​y​e​d t​o​g​e​t​h​e​r w​i​t​h​o​u​t a​n​y ​g​a​p​. E​v​e​r​y w​o​r​d o​f m​y m​e​s​s​a​g​e i​s w​r​i​t​t​e​n w​i​t​h t​h​a​t c​h​a​r​a​c​t​e​r b​e​t​w​e​e​n e​a​c​h l​e​t​t​e​r​. T​h​i​s i​s w​h​y w​o​r​d​s a​r​e b​r​e​a​k​i​n​g i​n s​t​r​​a​n​g​e p​l​a​c​e​s​.

You can detect ling words and break them apart with this character to allow word-wrap to apply to them.
< < insert Rick Cook quote here > >

Post Reply

Who is online

Users browsing this forum: Bing [Bot]