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.
-
yuucie
- Regular
- Posts: 164
- Joined: Sun Jun 22, 2014 4:04 am
- Completed: NaNoReNo[2015] Those Without Names
- Tumblr: an-na-ko
- Location: Toronto, Canada
-
Contact:
#1
Post
by yuucie » Wed Jun 25, 2014 3:11 pm
I poked around and found an old thread asking the same question, but the answers didn't work for me (and I didn't want to necro) so here's the question again. Sometimes I want to center text in the textbox (not on the full screen, so centered "dialogue" is out of the question), and I don't want to assign it to a character only as I want to use it for various events (so defining Character is probably not what I'm looking for).
I also do not want to black out the screen and have it appear NVL style, so I don't think NVL is the kind I'm looking for.
So far, I tried to make:
so when I want to center text:
Code: Select all
"Centered Text in Textbox" with cen
the problem is, it's not working. I don't think what_text_align is the right code, but I can't seem to find the one I'm looking for. Help please?
Last edited by
yuucie on Wed Jun 25, 2014 9:07 pm, edited 1 time in total.
-
ArachneJericho
- Regular
- Posts: 196
- Joined: Sun Jun 22, 2014 2:04 am
- Projects: Kaguya Hime
- Tumblr: mousedeerproductions
- Location: Seattle, WA, USA
-
Contact:
#2
Post
by ArachneJericho » Wed Jun 25, 2014 3:43 pm
-
yuucie
- Regular
- Posts: 164
- Joined: Sun Jun 22, 2014 4:04 am
- Completed: NaNoReNo[2015] Those Without Names
- Tumblr: an-na-ko
- Location: Toronto, Canada
-
Contact:
#3
Post
by yuucie » Wed Jun 25, 2014 3:51 pm
the centered tag isn't what i'm looking for, but the second part is! Thanks!
EDIT the code isn't working. Sigh... I have it written as:
Code: Select all
$ cen = Character(None, what_xalign=0.5, what_text_align=0.5)
and when I write dialogue:
Code: Select all
"Centered Textbox dialogue" with cen
neither of them work.
So I've tried defining it as a character:
Code: Select all
define cen = Character(None, what_xalign=0.5, what_text_align=0.5, text_xpos=0.5)
which worked but not in the way I want it too ;__;
I can't believe I'm having so much trouble with something that seems so simple, haha..
-
xavimat
- Eileen-Class Veteran
- Posts: 1458
- Joined: Sat Feb 25, 2012 8:45 pm
- Completed: Yeshua, Jesus Life, Cops&Robbers
- Projects: Fear&Love, unknown
- Organization: Pilgrim Creations
- Github: xavi-mat
- itch: pilgrimcreations
- Location: Spain
-
Contact:
#4
Post
by xavimat » Wed Jun 25, 2014 4:44 pm
Maybe you need also: window_xalign=0.5, #Centers the window horizontally
-
yuucie
- Regular
- Posts: 164
- Joined: Sun Jun 22, 2014 4:04 am
- Completed: NaNoReNo[2015] Those Without Names
- Tumblr: an-na-ko
- Location: Toronto, Canada
-
Contact:
#5
Post
by yuucie » Wed Jun 25, 2014 8:19 pm
xavimat wrote:Maybe you need also: window_xalign=0.5, #Centers the window horizontally
added it in, but didn't seem to do anything ;_; OTL (thanks for helping tho!)
-
Chaotic
- Regular
- Posts: 30
- Joined: Fri Feb 22, 2013 7:32 pm
- Location: England, UK
-
Contact:
#6
Post
by Chaotic » Wed Jun 25, 2014 8:29 pm
I have centered text in my project too and what I did was I put this in the options.rpy under the text (font) section so I knew it was to do with the text/textbox:
It works perfectly for me and centers the text into the middle
EDIT: Answered the question wrong but still useful for those who want to center all text...OTL
-
yuucie
- Regular
- Posts: 164
- Joined: Sun Jun 22, 2014 4:04 am
- Completed: NaNoReNo[2015] Those Without Names
- Tumblr: an-na-ko
- Location: Toronto, Canada
-
Contact:
#7
Post
by yuucie » Wed Jun 25, 2014 8:37 pm
Chaotic wrote:I have centered text in my project too and what I did was I put this in the options.rpy under the text (font) section so I knew it was to do with the text/textbox:
It works perfectly for me and centers the text into the middle
EDIT: Answered the question wrong but still useful for those who want to center all text...OTL
Ah yeah, the problem is I only want my text to be centered in specific events, not all the time. But thanks! I'll keep trying to center it properly @_@
-
Asceai
- Eileen-Class Veteran
- Posts: 1258
- Joined: Fri Sep 21, 2007 7:13 am
- Projects: a battle engine
-
Contact:
#8
Post
by Asceai » Wed Jun 25, 2014 8:47 pm
The problem is the structure. You have a window (that's the transparent-black section of the screen where the text goes) and it is styled with window_... params by the Character function. Inside that is a vbox. Inside the vbox is the text, which is styled with the what_... params. Centering the window does nothing because the window fills the screen horizontally. Centering the 'what' text does nothing because the 'what' text is contained within the vbox which is exactly large enough for the 'what' text. You can't style the vbox by passing params to Character.
Code: Select all
+------------------------------------------------+
|Window |
|+----------------+ |
||Vbox | |
||+--------------+| |
|||What || |
||+--------------+| |
|+----------------+ |
+------------------------------------------------+
Even if 'what' is centered, it's only centered within vbox, so you can see why what_xalign = 0.5 does nothing.
Here's a solution:
This will expand the vbox out to fill the window.
Then
Code: Select all
define cen = Character(None, what_xalign=0.5, what_text_align=0.5)
should do the trick.
-
yuucie
- Regular
- Posts: 164
- Joined: Sun Jun 22, 2014 4:04 am
- Completed: NaNoReNo[2015] Those Without Names
- Tumblr: an-na-ko
- Location: Toronto, Canada
-
Contact:
#9
Post
by yuucie » Wed Jun 25, 2014 9:06 pm
Asceai wrote:The problem is the structure. You have a window (that's the transparent-black section of the screen where the text goes) and it is styled with window_... params by the Character function. Inside that is a vbox. Inside the vbox is the text, which is styled with the what_... params. Centering the window does nothing because the window fills the screen horizontally. Centering the 'what' text does nothing because the 'what' text is contained within the vbox which is exactly large enough for the 'what' text. You can't style the vbox by passing params to Character.
Code: Select all
+------------------------------------------------+
|Window |
|+----------------+ |
||Vbox | |
||+--------------+| |
|||What || |
||+--------------+| |
|+----------------+ |
+------------------------------------------------+
Even if 'what' is centered, it's only centered within vbox, so you can see why what_xalign = 0.5 does nothing.
Here's a solution:
This will expand the vbox out to fill the window.
Then
Code: Select all
define cen = Character(None, what_xalign=0.5, what_text_align=0.5)
should do the trick.
oh my goodness, thank you so much for the explanation. I like knowing what each code is supposed to control, which is why I was so confused why some of them didn't work the way I thought they did, but with your diagram everything makes so much more sense.
Thank you!! Just for clarification to anyone else with the same problem, I wrote
into my options.rpy script, and it works beautifully!
Thank you so much Asceai (and everyone who tried to help too!)
-
Laiska
- Veteran
- Posts: 323
- Joined: Sat Jan 11, 2014 1:14 am
- Completed: Queen At Arms, Cerulean, The Shadows That Run Alongside Our Car, Vicarwissen
- Projects: Caramel Mokaccino
- Tumblr: minesweeperaddict
- Deviantart: koyoba
-
Contact:
#10
Post
by Laiska » Mon May 18, 2015 8:42 pm
I don't mean to necro, but how does one go about doing this but with vertical centering? i.e. centering the dialogue of a specific character along the y-axis, but inside the text box?
Defining a character like
Code: Select all
define cen = Character(None, what_xalign=0.5, what_text_align=0.5)
and then doing this
produces the intended result, sort of, but then the text box expands to fill the whole screen!
Is there a way to achieve this without changing the size of the textbox?
-
xavimat
- Eileen-Class Veteran
- Posts: 1458
- Joined: Sat Feb 25, 2012 8:45 pm
- Completed: Yeshua, Jesus Life, Cops&Robbers
- Projects: Fear&Love, unknown
- Organization: Pilgrim Creations
- Github: xavi-mat
- itch: pilgrimcreations
- Location: Spain
-
Contact:
#11
Post
by xavimat » Sat May 23, 2015 6:36 am
Have you tried style.say_vbox.xfill = True or style.say_vbox.yfill = True ?
I think style.say_vbox.yalign = .5 could work.
More options to try:
Something like style.window.ymaximum = 300 in options.rpy?
Or maybe, in the character definition:
define cen = Character(None, window_ymaximum=300)
Users browsing this forum: Google [Bot]