Is there a way to have a "flush" alignment for text?
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.
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.
- asatiir
- Regular
- Posts: 86
- Joined: Tue Oct 01, 2013 6:04 pm
- Completed: Within the Walls (Twine)
- Projects: Roses Will Rise
- Organization: Asatiir's Tales
- Skype: asatiir
- itch: asatiir
- Location: Dubai, UAE
- Contact:
Is there a way to have a "flush" alignment for text?
I've been searching for this for a few hours today and I can't seem to get the right term for it.
There are scenes in my game that involve reading pieces of text off paper and books, I wanted to align the text in a way where the text is centered on the screen but aligned to the left, mimicking the format of a book.
Example:
is there a possible way to do this? I already got the text in the center of the screen.
There are scenes in my game that involve reading pieces of text off paper and books, I wanted to align the text in a way where the text is centered on the screen but aligned to the left, mimicking the format of a book.
Example:
is there a possible way to do this? I already got the text in the center of the screen.
Re: Is there a way to have a "flush" alignment for text?
Then that means the text is still aligned left, just having offset padding on both side.
Put the textbox in a bigger container (like a window) and set thexoffset xpadding of the container; then set text_align of the textbox to the left.
edit: opps wrong property name
Put the textbox in a bigger container (like a window) and set the
edit: opps wrong property name
Last edited by Elmiwisa on Tue Oct 29, 2013 5:34 pm, edited 1 time in total.
- PyTom
- Ren'Py Creator
- Posts: 16088
- Joined: Mon Feb 02, 2004 10:58 am
- Completed: Moonlight Walks
- Projects: Ren'Py
- IRC Nick: renpytom
- Github: renpytom
- itch: renpytom
- Location: Kings Park, NY
- Contact:
Re: Is there a way to have a "flush" alignment for text?
Actually, you don't even need to do that. Just set text_align 0.0 xalign 0.5 and you're set.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
Software > Drama • https://www.patreon.com/renpytom
- asatiir
- Regular
- Posts: 86
- Joined: Tue Oct 01, 2013 6:04 pm
- Completed: Within the Walls (Twine)
- Projects: Roses Will Rise
- Organization: Asatiir's Tales
- Skype: asatiir
- itch: asatiir
- Location: Dubai, UAE
- Contact:
Re: Is there a way to have a "flush" alignment for text?
I am doing that, but is there a way to have the text be aligned to the right left (whoops) while being on the center of the screen?
Last edited by asatiir on Tue Oct 29, 2013 4:45 pm, edited 2 times in total.
- trooper6
- Lemma-Class Veteran
- Posts: 3712
- Joined: Sat Jul 09, 2011 10:33 pm
- Projects: A Close Shave
- Location: Medford, MA
- Contact:
Re: Is there a way to have a "flush" alignment for text?
how you want the text aligned in controlled by the text_align statement. If you want it aligned left, you make it text_align 0.0, if you want it aligned right, you make it text_align 1.0. Or anything in between.
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?) Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?) Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978
Re: Is there a way to have a "flush" alignment for text?
Eh I think PyTom's solution will do what you described, literally to the letter. Setting xalign 0.5 will indeed make your text to be at the center, and text_align 0.0 will indeed make your text left aligned.
But I think that's not what you are actually asking for. I think what you're asking for is to make the text aligned, but have equal empty space on left and right side. Hence the method I described above. Oh and I fixed it, it should be xpadding not xoffset.
But I think that's not what you are actually asking for. I think what you're asking for is to make the text aligned, but have equal empty space on left and right side. Hence the method I described above. Oh and I fixed it, it should be xpadding not xoffset.
- asatiir
- Regular
- Posts: 86
- Joined: Tue Oct 01, 2013 6:04 pm
- Completed: Within the Walls (Twine)
- Projects: Roses Will Rise
- Organization: Asatiir's Tales
- Skype: asatiir
- itch: asatiir
- Location: Dubai, UAE
- Contact:
Re: Is there a way to have a "flush" alignment for text?
Following some of your solutions, this is what I came up with:
Result:
Is there a way to place the text here?
Code: Select all
$ reading = Character(None,
what_size=35,
what_outlines=[(3, "#000000", 2, 2), (3, "#000000", 0, 0)],
what_layout="subtitle",
what_xalign=0.5,
what_text_align=0,
window_background=None,
window_yminimum=0,
window_xfill=True,
window_xalign=0.5)
Is there a way to place the text here?
- trooper6
- Lemma-Class Veteran
- Posts: 3712
- Joined: Sat Jul 09, 2011 10:33 pm
- Projects: A Close Shave
- Location: Medford, MA
- Contact:
Re: Is there a way to have a "flush" alignment for text?
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?) Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?) Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978
- asatiir
- Regular
- Posts: 86
- Joined: Tue Oct 01, 2013 6:04 pm
- Completed: Within the Walls (Twine)
- Projects: Roses Will Rise
- Organization: Asatiir's Tales
- Skype: asatiir
- itch: asatiir
- Location: Dubai, UAE
- Contact:
Re: Is there a way to have a "flush" alignment for text?
It seemed similar to what I have in mind, I'll try it out in a bit, thank you!
Re: Is there a way to have a "flush" alignment for text?
If you just want that happen in a few special instance, which I think is what you are trying to do, I think my method would be better. It's a more general method that work everywhere. The reason why it did not work when you try is because well, the say statement text box is already set to display text at the bottom of the screen by default, which you did not change. You should have show a Text instead, perhaps with a screen.
Here is an example of using screen:
Then to display those you do something like:
Here is an example of using screen:
Code: Select all
screen textbook:
frame:
style_group "textbook"
text content
init -2 python:
style.textbook_frame.background="#ffffff" #whatever background you want, perhaps something that look like a book page
style.textbook_frame.align=(0.5,0.0)
style.textbook_frame.xpadding=200 #size of empty space on each side
style.textbook_text.text_align=0.0 #left aligned
style.textbook_text.color="#000000"
#more customization...
Code: Select all
show screen textbook(content="HWÆT, WE GAR-DEna in geardagum, þeodcyninga þrym gefrunon,hu ða æþelingas ellen fremedon!")
"You found a page that appeared to be Beowulf's."
hide screen textbook
- asatiir
- Regular
- Posts: 86
- Joined: Tue Oct 01, 2013 6:04 pm
- Completed: Within the Walls (Twine)
- Projects: Roses Will Rise
- Organization: Asatiir's Tales
- Skype: asatiir
- itch: asatiir
- Location: Dubai, UAE
- Contact:
Re: Is there a way to have a "flush" alignment for text?
Elmiwisa: yes it is for certain instances, I tried your method and this is the error I got.
Code: Select all
While running game code:
File "game/withinthewalls1.rpy", line 354, in script
File "renpy/common/000statements.rpy", line 510, in python
SyntaxError: EOL while scanning string literal (game/withinthewalls1.rpy, line 354)
Re: Is there a way to have a "flush" alignment for text?
Eh, I'm guessing my example is a bit problematic, maybe your machine can't read these character. Just replace HWÆT, WE GAR-DEna in geardagum, þeodcyninga þrym gefrunon,hu ða æþelingas ellen fremedon! with whatever you want.
- asatiir
- Regular
- Posts: 86
- Joined: Tue Oct 01, 2013 6:04 pm
- Completed: Within the Walls (Twine)
- Projects: Roses Will Rise
- Organization: Asatiir's Tales
- Skype: asatiir
- itch: asatiir
- Location: Dubai, UAE
- Contact:
Re: Is there a way to have a "flush" alignment for text?
I used my own text instead of the example you gave, actually.
Re: Is there a way to have a "flush" alignment for text?
In that case, it's your text that cause problem. This is probably a good time to mention that Ren'Py don't consistently handle multi-line string well, and people have had trouble with that before. I'm guessing that's the cause of your problem. Instead of a new line, use "\n". For example:
Oh and there is another way too that don't need "\n":
Basically, open the quote using the u""" and end using """ and also make sure that starting from 2nd line you indent all the way to the left otherwise you will have some extra space in your text.
Code: Select all
show screen textbook(content="Line 1\nLine 2\nLine 3")
Code: Select all
show screen textbook(content=u"""Line1
Line 2
Line 3""")
- asatiir
- Regular
- Posts: 86
- Joined: Tue Oct 01, 2013 6:04 pm
- Completed: Within the Walls (Twine)
- Projects: Roses Will Rise
- Organization: Asatiir's Tales
- Skype: asatiir
- itch: asatiir
- Location: Dubai, UAE
- Contact:
Re: Is there a way to have a "flush" alignment for text?
Maybe that's why! I've been using {p}{/p} to make new lines! will try it now.
Edit: Okay, got it to work, but it didn't come out the way I had in mind, not completely anyway. I'll see if I can adjust it through the settings, thanks!
Edit: Okay, got it to work, but it didn't come out the way I had in mind, not completely anyway. I'll see if I can adjust it through the settings, thanks!
Who is online
Users browsing this forum: Bing [Bot]