Text isn't all showing on the same line. Unsure of why.

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
NocturneLight
Regular
Posts: 163
Joined: Thu Jun 30, 2016 1:20 pm
Projects: Unsound Minds: The Clarevine Epoch
Organization: Reminiscent 64
Tumblr: Reminiscent64
itch: Reminiscent64
Location: Texas
Contact:

Text isn't all showing on the same line. Unsure of why.

#1 Post by NocturneLight »

So, when you press the right key to go to the right, starting from Spring 8 and onwards, the number goes over to the next line instead of all being on the same line.

I've tried xmaximum, xminimum, width, and spacing. None of them worked despite my expecting them to.

Does anyone have a solution to this?

Thanks in advance.

The code is:

Code: Select all

define mc = Character("Clarevine Cole", color="#c8ffc8", who_outlines=[(1,"#4d0066")],what_outlines=[(1,"#4d0066")])


default spring_visible = None
default summer_visible = None
default fall_visible = None
default winter_visible = None
default scroll = None



transform bubble_visible:

    subpixel True
    yanchor 0.0 alpha 0.0
    
    parallel:
        ease 1.0 yanchor 2.0 alpha 1.0
    
    
transform bubble_invisible:
    subpixel True
    xanchor 0.5 alpha 1.0
    
    parallel:
        easeout 1.0 xanchor 0.0 alpha 0.0
        
        
transform move_left:
    
    subpixel True
    
    xpos -512
    
    parallel:
        ease 1.0 xpos -1536

        
transform move_right:
    
    subpixel True
    
    xpos -1536
    
    parallel:
        ease 1.0 xpos -512
        


    
        
screen Test:
    modal True
    
    key "K_LEFT" action SetVariable("scroll", True)
    key "K_RIGHT" action SetVariable("scroll", False)
    
    window:
        background "#000"
        area(0, 0, 1300, 750)
        
    vbox xalign 0.1 yalign 0.5:
        textbutton "Spring" action ToggleVariable("spring_visible", True, False), SetVariable("summer_visible", None), SetVariable("fall_visible", None), SetVariable("winter_visible", None), SetVariable("scroll", None)
        textbutton "Summer" action ToggleVariable("summer_visible", True, False), SetVariable("spring_visible", None), SetVariable("fall_visible", None), SetVariable("winter_visible", None), SetVariable("scroll", None)
        textbutton "Fall" action ToggleVariable("fall_visible", True, False), SetVariable("spring_visible", None), SetVariable("summer_visible", None), SetVariable("winter_visible", None), SetVariable("scroll", None)
        textbutton "Winter" action ToggleVariable("winter_visible", True, False), SetVariable("spring_visible", None), SetVariable("summer_visible", None), SetVariable("fall_visible", None), SetVariable("scroll", None)
    
    
        
    hbox xalign -0.4 yalign 0.5 spacing 70:
        if spring_visible:
            at bubble_visible
            textbutton "Spring 1"
            textbutton "Spring 2"
            textbutton "Spring 3"
            textbutton "Spring 4"
            textbutton "Spring 5"
            textbutton "Spring 6"
            textbutton "Spring 7"
            textbutton "Spring 8"
            textbutton "Spring 9"
            textbutton "Spring 10"
            textbutton "Spring 11"
            textbutton "Spring 12"
            textbutton "Spring 13"
            textbutton "Spring 14"
            textbutton "Spring 15"
            
        if scroll:
            at move_left
        elif scroll != True:
            at move_right  
            
    hbox xalign -0.4 yalign 0.5 spacing 70:
        if summer_visible:
            at bubble_visible
            textbutton "Summer 1"
            textbutton "Summer 2"
            textbutton "Summer 3"
            textbutton "Summer 4"
            textbutton "Summer 5"
            textbutton "Summer 6"
            textbutton "Summer 7"
            textbutton "Summer 8"
            textbutton "Summer 9"
            textbutton "Summer 10"
            textbutton "Summer 11"
            textbutton "Summer 12"
            textbutton "Summer 13"
            textbutton "Summer 14"
            textbutton "Summer 15"
        
        if scroll:
            at move_left
        elif scroll != True:
            at move_right    
    
    hbox xalign -0.4 yalign 0.5 spacing 70:
        if fall_visible:
            at bubble_visible
            textbutton "Fall 1"
            textbutton "Fall 2"
            textbutton "Fall 3"
            textbutton "Fall 4"
            textbutton "Fall 5"
            textbutton "Fall 6"
            textbutton "Fall 7"
            textbutton "Fall 8"
            textbutton "Fall 9"
            textbutton "Fall 10"
            textbutton "Fall 11"
            textbutton "Fall 12"
            textbutton "Fall 13"
            textbutton "Fall 14"
            textbutton "Fall 15"
        
        if scroll:
            at move_left
        elif scroll != True:
            at move_right   
        
    hbox xalign -0.4 yalign 0.5 spacing 70:
        if winter_visible:
            at bubble_visible
            textbutton "Winter 1"
            textbutton "Winter 2"
            textbutton "Winter 3"
            textbutton "Winter 4"
            textbutton "Winter 5"
            textbutton "Winter 6"
            textbutton "Winter 7"
            textbutton "Winter 8"
            textbutton "Winter 9"
            textbutton "Winter 10"
            textbutton "Winter 11"
            textbutton "Winter 12"
            textbutton "Winter 13"
            textbutton "Winter 14"
            textbutton "Winter 15"
        
        if scroll:
            at move_left
        elif scroll != True:
            at move_right      
                
            
        

label start:
    show screen Test
    mc "Boomshakalaka."
The Old Guard is at His Limit. The time is near to usher in the New Guard.

The Great Horror is soon to be free.

Clarevine is the key.


"Unsound Minds: The Clarevine Epoch" is a yuri visual novel that shatters english visual novel norms and aims to blend Christianity and the Cthulhu Mythos to tell a deep and dark story that you'll enjoy. You can follow the Kickstarter here.

Stay sound and persist through the chaos,
NocturneLight

User avatar
papiersam
Veteran
Posts: 231
Joined: Fri Aug 12, 2016 2:24 pm
Completed: Gem Hunt Beta, 1/Probably, Animunch
Projects: The Panda Who Dreamed
Contact:

Re: Text isn't all showing on the same line. Unsure of why.

#2 Post by papiersam »

I'm getting pretty odd behavior when using your code. Can you replace:

Code: Select all

    hbox xalign -0.4 yalign 0.5 spacing 70:
        if spring_visible:
            at bubble_visible
            textbutton "Spring 1"
            textbutton "Spring 2"
            textbutton "Spring 3"
            textbutton "Spring 4"
            textbutton "Spring 5"
            textbutton "Spring 6"
            textbutton "Spring 7"
            textbutton "Spring 8"
            textbutton "Spring 9"
            textbutton "Spring 10"
            textbutton "Spring 11"
            textbutton "Spring 12"
            textbutton "Spring 13"
            textbutton "Spring 14"
            textbutton "Spring 15"
            
        if scroll:
            at move_left
        elif scroll != True:
            at move_right  
with:

Code: Select all

   
    hbox xalign -0.4 yalign 0.5:
        if spring_visible:
            at bubble_visible
            for i in range(1,12):
                button: 
                    text "Spring [i]"
                    xsize 150
            
        if scroll:
            at move_left
        elif scroll != True:
            at move_right 
And tell me what happens?

User avatar
NocturneLight
Regular
Posts: 163
Joined: Thu Jun 30, 2016 1:20 pm
Projects: Unsound Minds: The Clarevine Epoch
Organization: Reminiscent 64
Tumblr: Reminiscent64
itch: Reminiscent64
Location: Texas
Contact:

Re: Text isn't all showing on the same line. Unsure of why.

#3 Post by NocturneLight »

r_sami wrote:I'm getting pretty odd behavior when using your code. Can you replace:

Code: Select all

    hbox xalign -0.4 yalign 0.5 spacing 70:
        if spring_visible:
            at bubble_visible
            textbutton "Spring 1"
            textbutton "Spring 2"
            textbutton "Spring 3"
            textbutton "Spring 4"
            textbutton "Spring 5"
            textbutton "Spring 6"
            textbutton "Spring 7"
            textbutton "Spring 8"
            textbutton "Spring 9"
            textbutton "Spring 10"
            textbutton "Spring 11"
            textbutton "Spring 12"
            textbutton "Spring 13"
            textbutton "Spring 14"
            textbutton "Spring 15"
            
        if scroll:
            at move_left
        elif scroll != True:
            at move_right  
with:

Code: Select all

   
    hbox xalign -0.4 yalign 0.5:
        if spring_visible:
            at bubble_visible
            for i in range(1,12):
                button: 
                    text "Spring [i]"
                    xsize 150
            
        if scroll:
            at move_left
        elif scroll != True:
            at move_right 
And tell me what happens?

When I replace the code with your code, the transforms completely stop working. I don't know why this happens, but it's been happening to me this entire time I've been trying to implement transforms when I try to use for loops.
The Old Guard is at His Limit. The time is near to usher in the New Guard.

The Great Horror is soon to be free.

Clarevine is the key.


"Unsound Minds: The Clarevine Epoch" is a yuri visual novel that shatters english visual novel norms and aims to blend Christianity and the Cthulhu Mythos to tell a deep and dark story that you'll enjoy. You can follow the Kickstarter here.

Stay sound and persist through the chaos,
NocturneLight

User avatar
NocturneLight
Regular
Posts: 163
Joined: Thu Jun 30, 2016 1:20 pm
Projects: Unsound Minds: The Clarevine Epoch
Organization: Reminiscent 64
Tumblr: Reminiscent64
itch: Reminiscent64
Location: Texas
Contact:

Re: Text isn't all showing on the same line. Unsure of why.

#4 Post by NocturneLight »

If everyone is as stumped as I am about what's causing the text to change lines, and if everyone is as stumped as I am about why for loops break the transforms...


PyTom... I think I've found some more bugs in this build of Ren'Py for you to iron out. :wink:
The Old Guard is at His Limit. The time is near to usher in the New Guard.

The Great Horror is soon to be free.

Clarevine is the key.


"Unsound Minds: The Clarevine Epoch" is a yuri visual novel that shatters english visual novel norms and aims to blend Christianity and the Cthulhu Mythos to tell a deep and dark story that you'll enjoy. You can follow the Kickstarter here.

Stay sound and persist through the chaos,
NocturneLight

User avatar
papiersam
Veteran
Posts: 231
Joined: Fri Aug 12, 2016 2:24 pm
Completed: Gem Hunt Beta, 1/Probably, Animunch
Projects: The Panda Who Dreamed
Contact:

Re: Text isn't all showing on the same line. Unsure of why.

#5 Post by papiersam »

I doubt it's a bug, but all the same, you could try something like:

Code: Select all

    vbox xalign -0.4 yalign 0.5 spacing 70:
        hbox:
            at bubble_visible
            textbutton "Spring 1"
            textbutton "Spring 2"
            textbutton "Spring 3"
            textbutton "Spring 4"
            textbutton "Spring 5"
            textbutton "Spring 6"
            textbutton "Spring 7"
        hbox:
            at bubble_visible
            textbutton "Spring 8"
            textbutton "Spring 9"
            textbutton "Spring 10"
            textbutton "Spring 11"
            textbutton "Spring 12"
            textbutton "Spring 13"
            textbutton "Spring 14"
            textbutton "Spring 15"
            
        if scroll:
            at move_left
        elif scroll != True:
            at move_right  

User avatar
NocturneLight
Regular
Posts: 163
Joined: Thu Jun 30, 2016 1:20 pm
Projects: Unsound Minds: The Clarevine Epoch
Organization: Reminiscent 64
Tumblr: Reminiscent64
itch: Reminiscent64
Location: Texas
Contact:

Re: Text isn't all showing on the same line. Unsure of why.

#6 Post by NocturneLight »

Hm... Splitting them up is still making buttons 8 and up have their numbers go onto a different line.


It's like it's telling me to never try to give transforms to anything on a screen...

I'll keep messing with it. I want to know what voodoo/sorcery/alchemy is causing all these problems.



EDIT: Just a partial fix. If I put the buttons in a grid, all the words will stay on the same line. The problem though? The spacing is still off for everything past button 9.
The Old Guard is at His Limit. The time is near to usher in the New Guard.

The Great Horror is soon to be free.

Clarevine is the key.


"Unsound Minds: The Clarevine Epoch" is a yuri visual novel that shatters english visual novel norms and aims to blend Christianity and the Cthulhu Mythos to tell a deep and dark story that you'll enjoy. You can follow the Kickstarter here.

Stay sound and persist through the chaos,
NocturneLight

User avatar
papiersam
Veteran
Posts: 231
Joined: Fri Aug 12, 2016 2:24 pm
Completed: Gem Hunt Beta, 1/Probably, Animunch
Projects: The Panda Who Dreamed
Contact:

Re: Text isn't all showing on the same line. Unsure of why.

#7 Post by papiersam »

Hm... Splitting them up is still making buttons 8 and up have their numbers go onto a different line.
Huh. That wasn't the case for me before. But I switched to Ubuntu and tested it out anew, same problem.
It's like it's telling me to never try to give transforms to anything on a screen...
Nah, I tested it without the transforms. Same problem.

I would attribute it to 'too many textbuttons to one box'; I switched the order of the buttons, and 'Spring 5' and under ended up being two lines.

Or, I would say, 'in-proportionate textbuttons', because I changed the window screen width to 2400 and the text was all in one line, and all the button spacings were correct.

Conclusively, I would take another approach: one that either doesn't use as many buttons in one line, or using a different technique (not hbox).

User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Text isn't all showing on the same line. Unsure of why.

#8 Post by PyTom »

So, the reason behind this is that the viewport doesn't know how much space to offer the hbox, so it offers it the amount of space available to the viewport. The hbox then offers progressively less space to each, until it's offering no space at all, causing the text to wrap after one word. (This makes sense when you think about the usual vertical scrolling case, where you want the text to wrap.)

You can fix this with the child_size parameter to viewport. Something like:

Code: Select all

viewport:
    child_size (100000, None)
Will offer 10,000 pixels of horizontal space to the box, which should prevent it from wrapping.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

User avatar
NocturneLight
Regular
Posts: 163
Joined: Thu Jun 30, 2016 1:20 pm
Projects: Unsound Minds: The Clarevine Epoch
Organization: Reminiscent 64
Tumblr: Reminiscent64
itch: Reminiscent64
Location: Texas
Contact:

Re: Text isn't all showing on the same line. Unsure of why.

#9 Post by NocturneLight »

PyTom wrote:So, the reason behind this is that the viewport doesn't know how much space to offer the hbox, so it offers it the amount of space available to the viewport. The hbox then offers progressively less space to each, until it's offering no space at all, causing the text to wrap after one word. (This makes sense when you think about the usual vertical scrolling case, where you want the text to wrap.)

You can fix this with the child_size parameter to viewport. Something like:

Code: Select all

viewport:
    child_size (100000, None)
Will offer 10,000 pixels of horizontal space to the box, which should prevent it from wrapping.

Thanks for giving the explanation for why it does that. I appreciate knowing the reason behind the sorcery.

Also, where am I supposed to put that viewport code? Putting it before the hbox doesn't do anything and nesting it does nothing but make the text disappear. Or perhaps adjusting the viewport makes it so that you have to readjust xalign and yalign on everything?
The Old Guard is at His Limit. The time is near to usher in the New Guard.

The Great Horror is soon to be free.

Clarevine is the key.


"Unsound Minds: The Clarevine Epoch" is a yuri visual novel that shatters english visual novel norms and aims to blend Christianity and the Cthulhu Mythos to tell a deep and dark story that you'll enjoy. You can follow the Kickstarter here.

Stay sound and persist through the chaos,
NocturneLight

Post Reply

Who is online

Users browsing this forum: No registered users