Vertically centered text in the text 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
bambino358
Regular
Posts: 26
Joined: Sat Apr 27, 2019 7:17 am
Contact:

Vertically centered text in the text box??

#1 Post by bambino358 » Tue Jun 09, 2020 12:44 am

Hi,
I cannot figure out how to vertically centered dialogue text in the textbox.

In the textbox can be 1-3 lines of the text and I want to have the text always in the middle of the textbox. For better ilustration I add simple image to ilustrate, what I want to achieve.

I use Ren'Py 7.0.0.

Basic code for "text position in the textbox" uses "ypos". I tried to replace it with "yalign", but it doesn't work (or I don't know how to do it properly).

So the question is… how to vertically centered dialogue text in the textbox?

Thank you
Attachments
centered text.png

User avatar
hell_oh_world
Miko-Class Veteran
Posts: 777
Joined: Fri Jul 12, 2019 5:21 am
Projects: The Button Man
Organization: NILA
Github: hell-oh-world
Location: Philippines
Contact:

Re: Vertically centered text in the text box??

#2 Post by hell_oh_world » Tue Jun 09, 2020 3:59 am

have you tried using the special characters?
https://www.renpy.org/doc/html/dialogue ... characters

Code: Select all

vcentered "this dialogue is centered vertically"
centered "this dialogue is centered horizontally and vertically"
you can also probably define the position of the window when defining the characters.

Code: Select all

define e = Character("Eileen", window_align=(0.5, 0.5), who_xalign=0.5, what_xalign=0.5)
label start:
	e "this dialogue is centered *i think*"
or pass parameters in a say statement

Code: Select all

label start:
	e "this dialogue is centered *i think*" (window_align=(0.5, 0.5), who_xalign=0.5, what_xalign=0.5)
or refer to this guide and tweak the different styles found below the say screen in screens.rpy.
https://www.renpy.org/doc/html/gui.html

bambino358
Regular
Posts: 26
Joined: Sat Apr 27, 2019 7:17 am
Contact:

Re: Vertically centered text in the text box??

#3 Post by bambino358 » Tue Jun 09, 2020 6:46 am

I think I tried "centered" but the text was in the middle of the screen not in the middle of the textbox, but I'm not sure.

Thanks for reply I'll try it in a few hours.

bambino358
Regular
Posts: 26
Joined: Sat Apr 27, 2019 7:17 am
Contact:

Re: Vertically centered text in the text box??

#4 Post by bambino358 » Tue Jun 09, 2020 11:11 am

Thank you,
this code do the job:

Code: Select all

define e = Character("name", window_align=(0.5, 1.0), what_xalign=0.5, what_yalign=0.5)

Post Reply

Who is online

Users browsing this forum: mold.FF