[solved]How to set main text align to center by default?

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
SONTSE
Regular
Posts: 95
Joined: Sun Nov 24, 2013 10:49 pm
Completed: 8 VN's so far
Contact:

[solved]How to set main text align to center by default?

#1 Post by SONTSE » Sun Jan 19, 2014 5:29 am

Hello there. I'm trying to make every text on my vn to appear center-aligned. So naturally i pushed this string into options.rpy

Code: Select all

style.default.xalign = 0.5
But it doesn't do the job. It seems the written text is placed in some kind of box, and then this box is drawn aligned by center. But the text within the box is still aligned to left.
So is there an elegant way to solve the issue? I need a row-by-row center alignment, just as my MS Word does.
Attachments
shak2.jpg
What I need
shak1.jpg
What I get
Last edited by SONTSE on Sun Jan 19, 2014 9:34 am, edited 1 time in total.

User avatar
Donmai
Eileen-Class Veteran
Posts: 1919
Joined: Sun Jun 10, 2012 1:45 am
Completed: Toire No Hanako, Li'l Red [NaNoRenO 2013], The One in LOVE [NaNoRenO 2014], Running Blade [NaNoRenO 2016], The Other Question, To The Girl With Sunflowers
Projects: Slumberland
Location: Brazil
Contact:

Re: How to set main text align to center by default?

#2 Post by Donmai » Sun Jan 19, 2014 9:03 am

You are nearly there, Lena. You have used xalign and it did its job, centering the block of text.
http://www.renpy.org/doc/html/style.htm ... rty-xalign
Now, to center the lines of text you will also need to apply another style: text_align.
http://www.renpy.org/doc/html/style.htm ... text_align
Image
No, sorry! You must be mistaking me for someone else.
TOIRE NO HANAKO (A Story About Fear)

User avatar
SONTSE
Regular
Posts: 95
Joined: Sun Nov 24, 2013 10:49 pm
Completed: 8 VN's so far
Contact:

Re: How to set main text align to center by default?

#3 Post by SONTSE » Sun Jan 19, 2014 9:32 am

So what I need to do is to push this code

Code: Select all

style.default.text_align = 0.5
And it works like a charm! Thank You, Donmai! Not only for pointing to the exact command, but also for introdusing me to this priceless rtfm, I was unlucky to find by myself. Now I think I'll be able to do even more cool stuff with vn projects :twisted:

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot]