Vbox in screen seems to... move around? [SOLVED!]

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
Yone28
Newbie
Posts: 12
Joined: Sat Feb 25, 2023 4:11 pm
Contact:

Vbox in screen seems to... move around? [SOLVED!]

#1 Post by Yone28 »

Hello all! I have the following screen:

Code: Select all

screen journal_incomplete:
    modal True
    zorder 998
    add "journal_background" xalign 0.5 yalign 0.5
    add "journal_header" yalign 0.05 at backbut_resize
    imagebutton:
        yalign 0.05
        auto "header_back_%s"
        action [Hide("journal_incomplete"), Show("game_ui"), Show("time_screen")]
        at backbut_resize 
    hbox:
        xalign 0.5
        yalign 0.179
        spacing 75
        textbutton "{color=#e91e1e}Incomplete" action [Hide("journal_incomplete"), Show("journal_incomplete")] text_style "textbutton"
        textbutton "Completed" action [Hide("journal_incomplete"), Show("journal_complete")] text_style "textbutton" 

    vbox:
        xpos 115
        ypos 315
        if urge_quest in a.journal and urge_quest.completed == False:
            textbutton "{size=28}{font=SyneTactile-Regular.ttf}The Urge" align (0.5, 0) action [SetVariable("current_quest_text", "urge")] text_style "quest_text"
        if melodie_quest in a.journal and melodie_quest.completed == False:
            textbutton "{size=28}The Shy Lily" align (0.5, 0) action [SetVariable("current_quest_text", "melodie")] text_style "quest_text"
        if mitsuha_quest in a.journal and mitsuha_quest.completed == False:
            textbutton "{size=28}The Glamorous Tomboy" align (0.5, 0) action [SetVariable("current_quest_text", "mitsuha")] text_style "quest_text"
        if mia_quest in a.journal and mia_quest.completed == False:
            textbutton "{size=28}The Exhausted Teacher" align (0.5, 0) action [SetVariable("current_quest_text", "mia")] text_style "quest_text"
        if maid_quest in a.journal and maid_quest.completed == False:
            textbutton "{size=28}The Mysterious Maid" align (0.5, 0) action [SetVariable("current_quest_text", "maid")] text_style "quest_text"
        if marca_quest in a.journal and marca_quest.completed == False:
            textbutton "{size=28}The Stressed Mother" align (0.5, 0) action [SetVariable("current_quest_text", "marca")] text_style "quest_text"
        if zenaida_quest in a.journal and zenaida_quest.completed == False:
            textbutton "{size=28}The Fitness Fanatic" align (0.5, 0) action [SetVariable("current_quest_text", "zena")] text_style "quest_text"
        if sarah_quest in a.journal and sarah_quest.completed == False:
            textbutton "{size=28}The Smiling Barista" align (0.5, 0) action [SetVariable("current_quest_text", "sarah")] text_style "quest_text"
        if mary_quest in a.journal and mary_quest.completed == False:
            textbutton "{size=28}The Joyous Shopkeeper" align (0.5, 0) action [SetVariable("current_quest_text", "mary")] text_style "quest_text"
        if bike_quest in a.journal and bike_quest.completed == False:
            textbutton "{size=28}The Bike" align (0.5, 0) action [SetVariable("current_quest_text", "bike")] text_style "quest_text"
        if lover_quest in a.journal and lover_quest.completed == False:
            textbutton "{size=28}The Club" align (0.5, 0) action [SetVariable("current_quest_text", "lover")] text_style "quest_text"
Note this part:

Code: Select all

 vbox:
        xpos 35
        ypos 308
        if urge_quest in a.journal and urge_quest.completed == False:
When I call this screen while there are more than one "quests" in a.journal, it looks fine and centers itself properly:
Captura de pantalla 2024-04-25 013927.png
(27.44 KiB) Not downloaded yet
Buuuut if I call it while there are is only one:
Captura de pantalla 2024-04-25 013902.png
(23.18 KiB) Not downloaded yet
It does this. I can't seem to find why it does that and how to fix it. My only theory is that the game is trying to place the vbox at xpos 35, which makes the shorter texts center themselves relative to the longer texts. So if a quest with short text is alone in the list, it goes to the far left of the box.

I would love some help and ideas on how to fix this.
Last edited by Yone28 on Thu Apr 25, 2024 8:52 pm, edited 1 time in total.
I am losing it

philat
Eileen-Class Veteran
Posts: 1923
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Vbox in screen seems to... move around?

#2 Post by philat »

If box size is not specified, a box is only as large as it needs to be - i.e., the size of the largest child. While there are many ways to approach organizing your screen, the path of least change for now is probably to specify the xsize of your vbox.

User avatar
Yone28
Newbie
Posts: 12
Joined: Sat Feb 25, 2023 4:11 pm
Contact:

Re: Vbox in screen seems to... move around?

#3 Post by Yone28 »

philat wrote: Thu Apr 25, 2024 1:04 am If box size is not specified, a box is only as large as it needs to be - i.e., the size of the largest child. While there are many ways to approach organizing your screen, the path of least change for now is probably to specify the xsize of your vbox.
I see, I did not know that applied to vboxes. I thought it was a unique to grids.

I'll do that, then. Cheers.
I am losing it

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Ocelot