Centering Text in Namebox

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.
Message
Author
serene-artist
Regular
Posts: 32
Joined: Mon Mar 08, 2010 11:16 pm
Completed: Wolfram's Birthday Present
Projects: BL Academy
Contact:

Centering Text in Namebox

#1 Post by serene-artist »

I was reading the cookbook but couldn't really understand how to create a separate window for my character names. I don't think any instructions were given...just that it was recommended. I don't know if I posted in the right place, but please help! :(
And thanks in advance! A picture has been attached to clear up what I want. (SOLVED but NEW PROBLEM DOWN BELOW!)
Attachments
name - Copy.png
Last edited by serene-artist on Sun Jul 15, 2012 3:10 am, edited 2 times in total.

DragoonHP
Miko-Class Veteran
Posts: 758
Joined: Tue Jun 22, 2010 12:54 am
Completed: Christmas
IRC Nick: DragoonHP
Location: Zion Island, Solario
Contact:

Re: Creating a Namebox as a Separate File: Please help!

#2 Post by DragoonHP »

You have to put "show_two_window = True" when you define the character

Code: Select all

e = Character('Eileen'), show_two_window=True)

serene-artist
Regular
Posts: 32
Joined: Mon Mar 08, 2010 11:16 pm
Completed: Wolfram's Birthday Present
Projects: BL Academy
Contact:

Re: Creating a Namebox as a Separate File: Please help!

#3 Post by serene-artist »

DragoonHP wrote:You have to put "show_two_window = True" when you define the character

Code: Select all

e = Character('Eileen'), show_two_window=True)
Thank you so much. No jokes, I was stuck on this for an hour (;n; )
PLEASE except my gratitude!!! Thanks for answering so fast too! You are my savior \(0u0\)

serene-artist
Regular
Posts: 32
Joined: Mon Mar 08, 2010 11:16 pm
Completed: Wolfram's Birthday Present
Projects: BL Academy
Contact:

Re: Creating a Namebox as a Separate File: Please help!

#4 Post by serene-artist »

A new problem has arrived :(
Sorry, does anyone know how to CENTER the name?
I tried using
style.say_who_window.xalign = 0.10 under options.rpy but it only moved the namebox rather than the font inside!!

Please and thanks in advance again!

DragoonHP
Miko-Class Veteran
Posts: 758
Joined: Tue Jun 22, 2010 12:54 am
Completed: Christmas
IRC Nick: DragoonHP
Location: Zion Island, Solario
Contact:

Re: Centering Text in Namebox

#5 Post by DragoonHP »

Change

Code: Select all

id "who"
to

Code: Select all

id "who" xalign .5
in the else block in screen.rpy under screen say.

User avatar
FatUnicornGames
Miko-Class Veteran
Posts: 576
Joined: Sun Mar 25, 2012 7:54 pm
Projects: Club Shuffle
Contact:

Re: Centering Text in Namebox

#6 Post by FatUnicornGames »

DragoonHP wrote:Change

Code: Select all

id "who"
to

Code: Select all

id "who" xalign .5
in the else block in screen.rpy under screen say.
Huh, I tried this and it didn't change anything.
Image
Developer Blog for Club Shuffle - Follow and Share?
-Also! You can call me Crystal if you want.-

DragoonHP
Miko-Class Veteran
Posts: 758
Joined: Tue Jun 22, 2010 12:54 am
Completed: Christmas
IRC Nick: DragoonHP
Location: Zion Island, Solario
Contact:

Re: Centering Text in Namebox

#7 Post by DragoonHP »

I just tried it and it works for me

Code: Select all

    else:

        # The two window variant.
        vbox:
            style "say_two_window_vbox"

            if who:            
                window:
                    style "say_who_window"

                    text who:
                        id "who" xalign .5

User avatar
FatUnicornGames
Miko-Class Veteran
Posts: 576
Joined: Sun Mar 25, 2012 7:54 pm
Projects: Club Shuffle
Contact:

Re: Centering Text in Namebox

#8 Post by FatUnicornGames »

Image

This is what my code looks like, but it isn't working.
Image
Developer Blog for Club Shuffle - Follow and Share?
-Also! You can call me Crystal if you want.-

DragoonHP
Miko-Class Veteran
Posts: 758
Joined: Tue Jun 22, 2010 12:54 am
Completed: Christmas
IRC Nick: DragoonHP
Location: Zion Island, Solario
Contact:

Re: Centering Text in Namebox

#9 Post by DragoonHP »

This is how my output looks

And it might be a silly question, but you are using the show_two_window variant right?
Attachments
Untitled.png

User avatar
FatUnicornGames
Miko-Class Veteran
Posts: 576
Joined: Sun Mar 25, 2012 7:54 pm
Projects: Club Shuffle
Contact:

Re: Centering Text in Namebox

#10 Post by FatUnicornGames »

Well...that just made things worse. xD

Image
Image
Developer Blog for Club Shuffle - Follow and Share?
-Also! You can call me Crystal if you want.-

DragoonHP
Miko-Class Veteran
Posts: 758
Joined: Tue Jun 22, 2010 12:54 am
Completed: Christmas
IRC Nick: DragoonHP
Location: Zion Island, Solario
Contact:

Re: Centering Text in Namebox

#11 Post by DragoonHP »

(you aren't using the two_windows_variant, right?)

If yes, then

Code: Select all

background None
yoffset -10
xoffset 12
text who id "who" xalign .5
should work for you.

If it doesn't, then I have no idea where it is going wrong.

User avatar
FatUnicornGames
Miko-Class Veteran
Posts: 576
Joined: Sun Mar 25, 2012 7:54 pm
Projects: Club Shuffle
Contact:

Re: Centering Text in Namebox

#12 Post by FatUnicornGames »

Yeah, it just made things all crazy like the screen cap above. It isn't that big of a deal, so I won't use it.

Thanks for trying.
Image
Developer Blog for Club Shuffle - Follow and Share?
-Also! You can call me Crystal if you want.-

DragoonHP
Miko-Class Veteran
Posts: 758
Joined: Tue Jun 22, 2010 12:54 am
Completed: Christmas
IRC Nick: DragoonHP
Location: Zion Island, Solario
Contact:

Re: Centering Text in Namebox

#13 Post by DragoonHP »

Okay found out why it's not showing up correctly for you. (Because of frame; see the size of frame depends upon the space the text takes, so trying to center the text is all but futile in it.

So instead of trying to center (or reposition) the text, try to reposition the frame.

Code: Select all

            if who:
                frame:
                    background None
                    yoffset -10
                    xoffset 12
                    xalign 0.5 ?# Change it to fit your needs
                    text who id "who"

User avatar
FatUnicornGames
Miko-Class Veteran
Posts: 576
Joined: Sun Mar 25, 2012 7:54 pm
Projects: Club Shuffle
Contact:

Re: Centering Text in Namebox

#14 Post by FatUnicornGames »

Hmm...it is making the names jump around each time the screen changes.
Image
Developer Blog for Club Shuffle - Follow and Share?
-Also! You can call me Crystal if you want.-

DragoonHP
Miko-Class Veteran
Posts: 758
Joined: Tue Jun 22, 2010 12:54 am
Completed: Christmas
IRC Nick: DragoonHP
Location: Zion Island, Solario
Contact:

Re: Centering Text in Namebox

#15 Post by DragoonHP »

Jump around?

Post Reply

Who is online

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