Center A Dynamic Player's Name

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:

Center A Dynamic Player's Name

#1 Post by Zeekee »

When defining a dynamic character instance for the player, I used the following code:

define pl = DynamicCharacter('plyr', color="#ffcc3e", ctc="right_thingy", ctc_position="fixed", who_xalign=0.5)

When setting the name, I use this:

$ plyr = renpy.input("What is your name?", length=14)
$ plyr = plyr.strip()

if plyr == "":
$ plyr = "Boaty McBoatface"

$ renpy.block_rollback()

p '"I\'m called %(plyr)s!"'


But, when the player is speaking, their name doesn't center on the who box properly. I can rearrange each of the character names with who_xpos so that they fit evenly inside the who box, but I can't automate it with who_xalign, which is particularly annoying. 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
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: Center A Dynamic Player's Name

#2 Post by Zeekee »

Shoot, looks like I was able to fix it on my own. To be fair, I'd been working on it for a while!

Anyway, here's my fix:

In screens.rpy, I modified the x and y components of the who id for both window variants under the Say screen:

if who:
text who id "who" xpos 120 ypos 17 xalign 0.5


...and, of course...

text who:
id "who" xpos 120 ypos 17 xalign 0.5


Looks like that fixed it! Oh, and I removed the who_xalign=0.5 from the dynamic charatcer definition.
"When people sometimes misquote me, I don't know if they understand what I'm saying."
-Tommy Wiseau

Post Reply

Who is online

Users browsing this forum: Google [Bot]