Problems with text alignment in say box

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
RewindTheGame
Regular
Posts: 80
Joined: Thu Dec 31, 2020 3:37 pm
Contact:

Problems with text alignment in say box

#1 Post by RewindTheGame »

I'm just cleaning up my game for release, and would like to centre align the text on the say screen. With my basic knowledge of Python, I had imagined I could do something like this:

Code: Select all

text "f{what : ^82} id "what" pos(450,140)
but this just complains about the what string not being identical to blah blah and I still don't understand that error message. Who cares if it's not identical - just do what I ask you already, RenPy :)

Anyway, I've got the text centred by doing this:

Code: Select all

text what id what pos(450,140) xalign 0.6
but this seems to ignore the position element and just aligns the text with the centre of the screen. If the string is long enough, it overlays the side image of the sayer on the left of the screen. What I want is to align the text within a box. The box would extend from the right side of the side image to the right side of the screen.

Any help would be appreciated, because although my game works and the text is displayed, I feel that it's messy and looks strange when somebody just says two words and they appear left aligned flush against the side image with a massive blank space to the right.

User avatar
plastiekk
Regular
Posts: 112
Joined: Wed Sep 29, 2021 4:08 am
Contact:

Re: Problems with text alignment in say box

#2 Post by plastiekk »

RewindTheGame wrote: Tue Jul 11, 2023 7:08 am I'm just cleaning up my game for release, and would like to centre align the text on the say screen. With my basic knowledge of Python, I had imagined I could do something like this:
You can either try it with the styles (which doesn't work for me for some reason) or define your characters with what_xalign=0.5:

Code: Select all

define sv = Character ("Sven", what_xalign=0.5)
Why on earth did I put the bread in the fridge?

RewindTheGame
Regular
Posts: 80
Joined: Thu Dec 31, 2020 3:37 pm
Contact:

Re: Problems with text alignment in say box

#3 Post by RewindTheGame »

Thank you. So simple. As you can imagine, I achieved this through the most convoluted method - on the other hand, it's now coming in useful elsewhere :)

User avatar
plastiekk
Regular
Posts: 112
Joined: Wed Sep 29, 2021 4:08 am
Contact:

Re: Problems with text alignment in say box

#4 Post by plastiekk »

RewindTheGame wrote: Sun Jul 16, 2023 6:25 pm Thank you. So simple. As you can imagine, I achieved this through the most convoluted method - on the other hand, it's now coming in useful elsewhere :)
I hear you, I tried it myself for a while. I think it's because of the lack of examples in the documentation, because who would get the idea on their own that there is a what_xalign method?
But that's what this forum is for :)
Why on earth did I put the bread in the fridge?

Post Reply

Who is online

Users browsing this forum: Amazon [Bot], jadeon12