Stats Screen, Bars Non-Uniform? [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
shootingaeros
Newbie
Posts: 4
Joined: Fri Nov 17, 2017 11:37 pm
Contact:

Stats Screen, Bars Non-Uniform? [SOLVED]

#1 Post by shootingaeros » Fri Nov 17, 2017 11:39 pm

Basically I want the bars to start at the same position after the 'rank', and the bars after 'Diligence' are different than the two prior - They have borders and the other two do not. How can I make it so I can have the bars line up and look all the same?

Code: Select all

screen stats():
    tag menu
    use navigation
    frame:
        style_group "multi_entry"
        has vbox
        vbox:
            style_group "multi_entry"            
            hbox:
                style_group "multi_entry"
                label "Guts:"
                if guts<6:
                    hbox:
                        style "multi_entry_hvbox"
                        label "Rank 1 - Milquetoast"
                        bar range 6 value guts xmaximum 400
                elif guts<16:
                    hbox:
                        style "multi_entry_hvbox"
                        label "Rank 2 - Bold"
                        bar range 16 value guts xmaximum 400
                elif guts<31:
                    hbox:
                        style "multi_entry_hvbox"
                        label "Rank 3 - Staunch"
                        bar range 31 value guts xmaximum 400
                elif guts<64:
                    hbox:
                        style "multi_entry_hvbox"
                        label "Rank 4 - Dauntless" 
                        bar range 64 value guts xmaximum 400
                elif guts>=64:
                    hbox:
                        style "multi_entry_hvbox"
                        label "Rank MAX - Lionhearted"
                        bar range 64 value guts xmaximum 400
            hbox:
                style_group "multi_entry"
                label "Diligence:"
                if diligence<8:
                    hbox:
                        style "multi_entry_hvbox"
                        label "Rank 1 - Callow" 
                        bar range 8 value diligence xmaximum 400
                elif diligence<21:
                    hbox:
                        style "multi_entry_hvbox"
                        label "Rank 2 - Persistent" 
                        bar range 21 value diligence xmaximum 400
                elif diligence<38:
                    hbox:
                        style "multi_entry_hvbox"
                        label "Rank 3 - Strong"
                        bar range 38 value diligence xmaximum 400
                elif diligence<55:
                    hbox:
                        style "multi_entry_hvbox"
                        label "Rank 4 - Persuasive" 
                        bar range 55 value diligence xmaximum 400
                elif diligence>=55:
                    hbox:
                        style "multi_entry_hvbox"
                        label "Rank MAX - Rock Solid"
                        bar range 55 value diligence xmaximum 400

            hbox:
                style_group "multi_entry"
                label "Charm:"
                if charm<6:
                    hbox:
                        style "multi_entry_hvbox"
                        label "Rank 1 - Existent"
                        bar range 6 value charm xmaximum 400
                elif charm<16:
                    hbox:
                        style "multi_entry_hvbox"
                        label "Rank 2 - Head-Turning"
                        bar range 16 value charm xmaximum 400
                elif charm<31:
                    hbox:
                        style "multi_entry_hvbox"
                        label "Rank 3 - Suave"
                        bar range 31 value charm xmaximum 400
                elif charm<64:
                    hbox:
                        style "multi_entry_hvbox"
                        label "Rank 4 - Charismatic"
                        bar range 64 value charm xmaximum 400
                elif charm>=64:
                    hbox:
                        style "multi_entry_hvbox"
                        label "Rank MAX - Debonair"
                        bar range 64 value charm xmaximum 400
            hbox:
                style_group "multi_entry"
                label "Understanding:"
                if understanding<16:
                    hbox:
                        style "multi_entry_hvbox"
                        label "Rank 1 - Basic"
                        bar range 16 value understanding xmaximum 400
                elif understanding<40:
                    hbox:
                        style "multi_entry_hvbox"
                        label "Rank 2 - Kindly"
                        bar range 40 value understanding xmaximum 400
                elif understanding<80:
                    hbox:
                        style "multi_entry_hvbox"
                        label "Rank 3 - Generous"
                        bar range 80 value understanding xmaximum 400
                elif understanding<140:
                    hbox:
                        style "multi_entry_hvbox"
                        label "Rank 4 - Motherly"
                        bar range 140 value understanding xmaximum 400
                elif understanding>=140:
                    hbox:
                        style "multi_entry_hvbox"
                        label "Rank MAX - Saintly"
                        bar range 140 value understanding xmaximum 400
            hbox:
                style_group "multi_entry"
                label "Knowledge:"
                if knowledge<30:
                    hbox:
                        style "multi_entry_hvbox"
                        label "Rank 1 - Aware"
                        bar range 30 value knowledge xmaximum 400
                elif knowledge<80:
                    hbox:
                        style "multi_entry_hvbox"
                        label "Rank 2 - Informed"
                        bar range 80 value knowledge xmaximum 400
                elif knowledge<150:
                    hbox:
                        style "multi_entry_hvbox"
                        label "Rank 3 - Scholarly"
                        bar range 150 value knowledge xmaximum 400
                elif knowledge<240:
                    hbox:
                        style "multi_entry_hvbox"
                        label "Rank 4 - Encyclopedic"
                        bar range 240 value knowledge xmaximum 400
                elif knowledge>=240:
                    hbox:
                        style "multi_entry_hvbox"
                        label "Rank MAX - Erudite"
                        bar range 240 value knowledge xmaximum 400
style multi_entry_frame: 
    is default
    xpos 325
    ypos 130 
style multi_entry_vbox:
    ymaximum 150
    yfill True
    spacing 50
style multi_entry_hbox:
    spacing 10
style multi_entry_hvbox:
    spacing 100
    xminimum 500
Last edited by shootingaeros on Sat Nov 18, 2017 11:47 am, edited 1 time in total.

User avatar
Remix
Veteran
Posts: 356
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet
Projects: An un-named 3d anime based trainer game
Contact:

Re: Stats Screen, Bars Non-Uniform?

#2 Post by Remix » Sat Nov 18, 2017 12:13 am

Your likely easiest method is to use Grid rather than the hboxes inside vbox. Each nested hbox will determine space for its own children independently so ignores those above/below. So saying, you might get around it using xminimum within every second level hbox

shootingaeros
Newbie
Posts: 4
Joined: Fri Nov 17, 2017 11:37 pm
Contact:

Re: Stats Screen, Bars Non-Uniform?

#3 Post by shootingaeros » Sat Nov 18, 2017 1:08 am

Okay, the grid works pretty well - the only problem is I can't find anything on how to change how wide in the x direction. Such as the first column to be 100, second 150, third 250 or something like that.

shootingaeros
Newbie
Posts: 4
Joined: Fri Nov 17, 2017 11:37 pm
Contact:

Re: Stats Screen, Bars Non-Uniform?

#4 Post by shootingaeros » Sat Nov 18, 2017 1:14 am

The current code:

Code: Select all

screen stats():
    tag menu
    use navigation
    frame:
        style_group "multi_entry"
        grid 3 5:
            label "Guts:"
            if guts<6:
                    label "Rank 1 - Milquetoast"
                    bar range 6 value guts xmaximum 400
            elif guts<16:
                    label "Rank 2 - Bold"
                    bar range 16 value guts xmaximum 400
            elif guts<31:
                    label "Rank 3 - Staunch"
                    bar range 31 value guts xmaximum 400
            elif guts<64:
                    label "Rank 4 - Dauntless" 
                    bar range 64 value guts xmaximum 400
            elif guts>=64:
                    label "Rank MAX - Lionhearted"
                    bar range 64 value guts xmaximum 400
            
            label "Diligence:"
            if diligence<8:
                label "Rank 1 - Callow" 
                bar range 8 value diligence xmaximum 400
            elif diligence<21:
                label "Rank 2 - Persistent" 
                bar range 21 value diligence xmaximum 400
            elif diligence<38:
                label "Rank 3 - Strong"
                bar range 38 value diligence xmaximum 400
            elif diligence<55:
                label "Rank 4 - Persuasive" 
                bar range 55 value diligence xmaximum 400
            elif diligence>=55:
                label "Rank MAX - Rock Solid"
                bar range 55 value diligence xmaximum 400
            
            
            label "Charm:"
            if charm<6:
                label "Rank 1 - Existent"
                bar range 6 value charm xmaximum 400
            elif charm<16:
                label "Rank 2 - Head-Turning"
                bar range 16 value charm xmaximum 400
            elif charm<31:
                label "Rank 3 - Suave"
                bar range 31 value charm xmaximum 400
            elif charm<64:
                label "Rank 4 - Charismatic"
                bar range 64 value charm xmaximum 400
            elif charm>=64:
                label "Rank MAX - Debonair"
                bar range 64 value charm xmaximum 400
    
            label "Understanding:"
            if understanding<16:
                label "Rank 1 - Basic"
                bar range 16 value understanding xmaximum 400
            elif understanding<40:
                label "Rank 2 - Kindly"
                bar range 40 value understanding xmaximum 400
            elif understanding<80:
                label "Rank 3 - Generous"
                bar range 80 value understanding xmaximum 400
            elif understanding<140:
                label "Rank 4 - Motherly"
                bar range 140 value understanding xmaximum 400
            elif understanding>=140:
                label "Rank MAX - Saintly"
                bar range 140 value understanding xmaximum 400
            
            
            
            label "Knowledge:"
            if knowledge<30:
                label "Rank 1 - Aware"
                bar range 30 value knowledge xmaximum 400
            elif knowledge<80:
                label "Rank 2 - Informed"
                bar range 80 value knowledge xmaximum 400
            elif knowledge<150:
                label "Rank 3 - Scholarly"
                bar range 150 value knowledge xmaximum 400
            elif knowledge<240:
                label "Rank 4 - Encyclopedic"
                bar range 240 value knowledge xmaximum 400
            elif knowledge>=240:
                label "Rank MAX - Erudite"
                bar range 240 value knowledge xmaximum 400

User avatar
Remix
Veteran
Posts: 356
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet
Projects: An un-named 3d anime based trainer game
Contact:

Re: Stats Screen, Bars Non-Uniform?

#5 Post by Remix » Sat Nov 18, 2017 7:10 am

Within Ren'py all Grids and MultiBoxes (hbox, vbox) use the largest child to set the widths and heights of All contained children, thus a hbox with "1", "22", "333" in it would still allow a width relevant to the "333" for the "1" and "22" as well.

To set your own values, you'd probably want to throw each part into its own fixed...

Code: Select all

vbox: # we do not car about height, so vbox will do here
    fixed:
        text "words" xanchor 1.0 xpos 190 # anchor on right, at 190px
        bar .... xmaximum 400 xpos 200 # 10px to the right of the text
        image ... xanchor 0.0 xpos 610 # an image 10px to right of the bar
    fixed:
        # item 2 etc
As positions for the items are relative to each fixed, it should allow a more uniform alignment

shootingaeros
Newbie
Posts: 4
Joined: Fri Nov 17, 2017 11:37 pm
Contact:

Re: Stats Screen, Bars Non-Uniform?

#6 Post by shootingaeros » Sat Nov 18, 2017 11:47 am

That works perfectly - I ended up using the vboxes like you specified and it worked just like I wanted it to. Thank you so much!

Post Reply

Who is online

Users browsing this forum: Ocelot