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.
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.
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:
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 @_@
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.
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.
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
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?
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)