Text in Choice Menus Not Centering? [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.
Message
Author
User avatar
Milkymalk
Miko-Class Veteran
Posts: 747
Joined: Wed Nov 23, 2011 5:30 pm
Completed: Don't Look (AGS game)
Projects: KANPEKI! ★Perfect Play★
Organization: Crappy White Wings
Location: Germany
Contact:

Re: Text in Choice Menus Not Centering?

#16 Post by Milkymalk » Thu Jul 27, 2017 3:37 pm

narutochats wrote:
Wed Jul 26, 2017 10:14 pm
Sorry, I'm a bit of a moron at coding, I'm more of a script kiddie. Where exactly? I don't see any sort of thing in my code that defines the text inside of a button. And I'm not sure where to place that myself.

Code: Select all

                    button:     ## <--- this is the button
                        action action
                        style "menu_choice_button"
                        xysize(440,53)
                        text caption style "menu_choice"    ## <--- this is the text inside the button
Do this:

Code: Select all

 text caption:
    style "menu_choice"
    yanchor 0.5
    # additional attributes here
Please read the introduction to screen language in the docs if you intent to customize your screens or make your own ones. You should at least know where to put stuff even if you don't know yet what you want to put there.
https://www.renpy.org/doc/html/screens.html

You can add attributes to practically any element by putting ":" behind it and giving it a block (indented lines that come directly after it).
Crappy White Wings (currently quite inactive)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)

User avatar
narutochats
Newbie
Posts: 24
Joined: Sun Apr 22, 2012 10:02 pm
Contact:

Re: Text in Choice Menus Not Centering?

#17 Post by narutochats » Fri Jul 28, 2017 12:18 am

Milkymalk wrote:
Thu Jul 27, 2017 3:37 pm

Code: Select all

                    button:     ## <--- this is the button
                        action action
                        style "menu_choice_button"
                        xysize(440,53)
                        text caption style "menu_choice"    ## <--- this is the text inside the button
Do this:

Code: Select all

 text caption:
    style "menu_choice"
    yanchor 0.5
    # additional attributes here
Please read the introduction to screen language in the docs if you intent to customize your screens or make your own ones. You should at least know where to put stuff even if you don't know yet what you want to put there.
https://www.renpy.org/doc/html/screens.html

You can add attributes to practically any element by putting ":" behind it and giving it a block (indented lines that come directly after it).


Yeah no I definitely understand enough to know what the button is/other things are and how to change their attributes haha. I know that much, along with a good handful of things. I had looked through the screens section but there wasn't anything in there to help me with changing text attributes, at least from what I saw. I knew text caption had to do with the text but the "text caption" and "style menu choice" being in the same line was throwing me off. (I had gotten that code from another troubleshooting post, I didn't create it myself.)

But yes, this worked for me! Ended up setting it to ~0.35 instead, and it was perfect. Thank you so much for the help!
I've been at this too long...

User avatar
Milkymalk
Miko-Class Veteran
Posts: 747
Joined: Wed Nov 23, 2011 5:30 pm
Completed: Don't Look (AGS game)
Projects: KANPEKI! ★Perfect Play★
Organization: Crappy White Wings
Location: Germany
Contact:

Re: Text in Choice Menus Not Centering? [SOLVED]

#18 Post by Milkymalk » Fri Jul 28, 2017 10:15 am

What you did was a workaround, never the best solution. If yanchor 0.5 doesn't center the text, it means the ypos is off.

Try yalign 0.5 instead, is it still centered?

You can either put all attributes in the same line as the element itself, or you can make a block for it, no difference. A block is better to read though if there are several attributes.
Crappy White Wings (currently quite inactive)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)

User avatar
narutochats
Newbie
Posts: 24
Joined: Sun Apr 22, 2012 10:02 pm
Contact:

Re: Text in Choice Menus Not Centering? [SOLVED]

#19 Post by narutochats » Sat Jul 29, 2017 9:55 am

Milkymalk wrote:
Fri Jul 28, 2017 10:15 am
What you did was a workaround, never the best solution. If yanchor 0.5 doesn't center the text, it means the ypos is off.

Try yalign 0.5 instead, is it still centered?

You can either put all attributes in the same line as the element itself, or you can make a block for it, no difference. A block is better to read though if there are several attributes.

Still the same problem. I'm thinking maybe it's just something to do with my button. I defined it as the correct size and everything (and even if I didn't it'd just stretch to fit the "xysize") so I don't understand why it's causing this error.
I've been at this too long...

User avatar
Milkymalk
Miko-Class Veteran
Posts: 747
Joined: Wed Nov 23, 2011 5:30 pm
Completed: Don't Look (AGS game)
Projects: KANPEKI! ★Perfect Play★
Organization: Crappy White Wings
Location: Germany
Contact:

Re: Text in Choice Menus Not Centering? [SOLVED]

#20 Post by Milkymalk » Sat Jul 29, 2017 10:41 am

It must be either the position or the anchor of the text as nothing else influences the alignment inside the button. Maybe some strange style problem. Anyway, it's too much work to check it "remote-controlled" ;)
Crappy White Wings (currently quite inactive)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)

User avatar
narutochats
Newbie
Posts: 24
Joined: Sun Apr 22, 2012 10:02 pm
Contact:

Re: Text in Choice Menus Not Centering? [SOLVED]

#21 Post by narutochats » Tue Aug 01, 2017 7:09 pm

Milkymalk wrote:
Sat Jul 29, 2017 10:41 am
It must be either the position or the anchor of the text as nothing else influences the alignment inside the button. Maybe some strange style problem. Anyway, it's too much work to check it "remote-controlled" ;)
Ah, well thank you for your help anyways! Hopefully nothing else is randomly out of place like that. At least I know what to do now.
I've been at this too long...

Post Reply

Who is online

Users browsing this forum: Eyzi