[solved] ui.text align part of text at 0.0 and part at 1.0?

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
netravelr
Miko-Class Veteran
Posts: 504
Joined: Thu Jan 28, 2010 2:31 am
Completed: Culina: Hands in the Kitchen, Culina: The Spirit of Cooking, Saving Zoey
Projects: Love at the Laundromat
Organization: Lakeview Interactive
Deviantart: netravelr
Location: USA
Contact:

[solved] ui.text align part of text at 0.0 and part at 1.0?

#1 Post by netravelr »

No source code as it's more of a speculative question, but I was wondering if anyone knew of a way to have text similar to this:


Beginning of Text End of Text|

where | is the right aligned part of the message box. I tried doing something like

Code: Select all

ui.text(Beginning of Text{xalign=1.0}End of Text|{/xalign})
but of course that doesn't work.

I was thinking of a hacky way to do it by creating another line with the position in the previous line's Y pos but I don't know how to access that variable as well. Any ideas?
Last edited by netravelr on Wed Nov 23, 2011 1:12 am, edited 1 time in total.
Image
Technical Designer/Programmer
Game Design Portfolio - Project updates on my Twitter
Experienced in: C/C++/C#, Python, Unreal, Unity, and Flash
_________________
"Space can be very lonely. The greatest adventure is having someone share it with you."

User avatar
PyTom
Ren'Py Creator
Posts: 16096
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: ui.text align part of text at 0.0 and part at 1.0?

#2 Post by PyTom »

There isn't a way to do this with a single Text. You could do:

Code: Select all

hbox:
    xfill True
    text "Foo"
    text "Bar" xalign 1.0
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

User avatar
netravelr
Miko-Class Veteran
Posts: 504
Joined: Thu Jan 28, 2010 2:31 am
Completed: Culina: Hands in the Kitchen, Culina: The Spirit of Cooking, Saving Zoey
Projects: Love at the Laundromat
Organization: Lakeview Interactive
Deviantart: netravelr
Location: USA
Contact:

Re: ui.text align part of text at 0.0 and part at 1.0?

#3 Post by netravelr »

That's exactly what I was looking for. Thanks so much!
Image
Technical Designer/Programmer
Game Design Portfolio - Project updates on my Twitter
Experienced in: C/C++/C#, Python, Unreal, Unity, and Flash
_________________
"Space can be very lonely. The greatest adventure is having someone share it with you."

User avatar
Kazhuto
Newbie
Posts: 15
Joined: Thu Apr 24, 2014 10:31 am
Contact:

Re: [solved] ui.text align part of text at 0.0 and part at 1

#4 Post by Kazhuto »

where i should put this code in ? option ? screen ? script ?

User avatar
Alex
Lemma-Class Veteran
Posts: 3098
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: [solved] ui.text align part of text at 0.0 and part at 1

#5 Post by Alex »

It doesn't metter in which file you'll put it. And I suspect that this is a part of a screen, so try

Code: Select all

screen my_scr:
    hbox:
        yalign 0.1
        xfill True
        text "Foo"
        text "Bar" xalign 1.0

label start:
    show screen my_scr
    "?"
http://www.renpy.org/wiki/renpy/FAQ#How ... e_files.3F

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot]