Centering Who Text

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
Zeekee
Regular
Posts: 67
Joined: Wed Jul 23, 2014 10:17 pm
Projects: No One But You, The Anomaly
Organization: Annexe Interactive
Skype: ytmnd111
Soundcloud: zomgaarh
Location: USAF Academy, CO
Contact:

Centering Who Text

#1 Post by Zeekee »

I'm trying to figure out whether or not it's possible to center the player's name in the Who box. Ordinarily, I'd just find the exact x-coordinates, but there are a few dynamic characters that rely on user input for their names, so the lengths will more often than not be different from the default.

Any help would be much appreciated!
"When people sometimes misquote me, I don't know if they understand what I'm saying."
-Tommy Wiseau

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3791
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: Centering Who Text

#2 Post by Imperf3kt »

Are you using the new GUI?
in gui.rpy, find these lines and edit them (you want to create a new yalign property)

Code: Select all

## The horizontal alignment of the character's name. This can be 0.0 for left-
## aligned, 0.5 for centered, and 1.0 for right-aligned.
define gui.name_xalign = 0.0
After you add a yalign, make sure the namebox uses the property.
You may need to copy some code from a 00file in your renpy directory.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

User avatar
Zeekee
Regular
Posts: 67
Joined: Wed Jul 23, 2014 10:17 pm
Projects: No One But You, The Anomaly
Organization: Annexe Interactive
Skype: ytmnd111
Soundcloud: zomgaarh
Location: USAF Academy, CO
Contact:

Re: Centering Who Text

#3 Post by Zeekee »

Unfortunately, I'm not using the new GUI.
"When people sometimes misquote me, I don't know if they understand what I'm saying."
-Tommy Wiseau

User avatar
Belgerum
Regular
Posts: 110
Joined: Thu Nov 06, 2014 12:24 am
Skype: belgerum09
Soundcloud: Belgerum
itch: Belgerum
Contact:

Re: Centering Who Text

#4 Post by Belgerum »

You'll want to find the "Say" screen, usually near the top of screens.rpy, and modify the text fields for the namebox to have xalign 0.5

For example, take the following:

Code: Select all

            if who:
                text who id "who"
And add an xalign statement:

Code: Select all

            if who:
                text who id "who" xalign 0.5
You may also want to add it into the section below that, if you're using the two window variant.

Code: Select all

            if who:
                window:
                    style "say_who_window"

                    text who:
                        id "who" xalign 0.5

Post Reply

Who is online

Users browsing this forum: No registered users