Namebox that is part of the textbox image

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
AERenoir
Veteran
Posts: 318
Joined: Fri May 27, 2011 8:23 pm
Contact:

Namebox that is part of the textbox image

#1 Post by AERenoir » Tue Apr 01, 2014 10:37 pm

MAybe this has been asked before, but I just didn't find it.

How should I go about positioning a name when the namebox is attached to the textbox instead of a separate image?

User avatar
saguaro
Miko-Class Veteran
Posts: 560
Joined: Sun Feb 12, 2012 9:17 am
Completed: Locked-In, Sunrise, The Censor
Organization: Lucky Special Games
itch: saguarofoo
Location: USA
Contact:

Re: Namebox that is part of the textbox image

#2 Post by saguaro » Wed Apr 02, 2014 7:12 am

Does this help? See 'styling the names'

http://lemmasoft.renai.us/forums/viewto ... =51&t=9233

User avatar
OokamiKasumi
Eileen-Class Veteran
Posts: 1779
Joined: Thu Oct 14, 2010 3:53 am
Completed: 14 games released -- and Counting.
Organization: DarkErotica Games
Deviantart: OokamiKasumi
Location: NC, USA
Contact:

Re: Namebox that is part of the textbox image

#3 Post by OokamiKasumi » Wed Apr 02, 2014 1:39 pm

AERenoir wrote:...How should I go about positioning a name when the namebox is attached to the textbox instead of a separate image?
What I would do is use the Two Window option and use a fully transparent image for the Name box, then adjust the padding and margins to make the name fit where I need it to go.

in Script.rpy:

Code: Select all

init:
    define e = Character('Eileen', 
        color = "#c8ffc8",
        show_two_window = True,
        )
in Options.rpy:

Code: Select all

        ###############################################
    ## ---------- Name Box  ---------------------

    style.say_label.font = "fo/LHFmisterkookyREG_0.TTF"    
    style.say_label.size =30
    style.say_label.bold = False
    style.say_label.outlines = [(1, "#330000", 0, 0)] 
    
    ## ----- Frame (expandable) ------------------------
    # style.say_who_window.background = Frame("ui/BlankWhoBox.png", 0, 0)
    
    ## ---- No Frame (Not expandable) ---------------
    style.say_who_window.background = "ui/BlankWhoBox.png"
    
    style.say_who_window.left_padding = 30
    style.say_who_window.right_padding = 30
    style.say_who_window.top_padding = 30
    style.say_who_window.bottom_padding = 3
    
    style.say_who_window.left_margin = 250
    style.say_who_window.right_margin = 0
    style.say_who_window.top_margin = 0
    style.say_who_window.bottom_margin = 0
    
    style.say_who_window.yminimum = 10
    style.say_who_window.xminimum = 10
Last edited by OokamiKasumi on Thu Apr 03, 2014 12:47 pm, edited 1 time in total.
Ookami Kasumi ~ Purveyor of fine Smut.
Most recent Games Completed: For ALL my completed games visit: DarkErotica Games

"No amount of great animation will save a bad story." -- John Lasseter of Pixar

User avatar
AERenoir
Veteran
Posts: 318
Joined: Fri May 27, 2011 8:23 pm
Contact:

Re: Namebox that is part of the textbox image

#4 Post by AERenoir » Wed Apr 02, 2014 5:03 pm

I saw this recently: http://lemmasoft.renai.us/forums/viewto ... =8&t=21677

What does THIS do?

Code: Select all

    $ style.say_who_window.background = None # To remove the say background
I'm also interested in the idea of having images as names, but I'm not understanding how the codes posted in the linked thread work. How do I call the person's name-image, again?

User avatar
amimajime
Newbie
Posts: 3
Joined: Wed Apr 02, 2014 7:04 pm
Contact:

Re: Namebox that is part of the textbox image

#5 Post by amimajime » Wed Apr 02, 2014 7:21 pm

There's only one problem with this method that I'm experiencing, and that's that the name that I'm putting in the 'attached text box' is being covered up by it. I have the text box set to 50% transparency, so I can still see the name, but I'd rather that the name appears in front of it. I'm also wondering how I can center each different name within the box. I'm sure there's some sort of code that's simple that I'm missing (I just started using ren'py a week ago or so but have been learning quickly so far) that can do this, but I'm not sure. Please help!!

User avatar
SinnyROM
Regular
Posts: 166
Joined: Mon Jul 08, 2013 12:25 am
Projects: Blue Birth
Organization: Cosmic Static Games
Contact:

Re: Namebox that is part of the textbox image

#6 Post by SinnyROM » Thu Apr 03, 2014 12:08 am

AERenoir wrote:
That line allows no background image to display behind the sayer's name. It's a transparent namebox in a way, as if the name of the sayer is floating by itself.

In the link, they had individual image files for each sayer's name with the file name being identical to the character's name. The second post has their say screen in screen.rpy code following that convention, with all their image files in PNG format located in the game folder.

amimajime wrote:
I had the same issue with the two-window variant and it was a matter of placing the who elements after the window/what elements.

Code: Select all

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

                has vbox:
                    style "say_vbox"

                text what id "what"

                if who:            
                    window:
                        style "say_who_window"

                        text who:
                            id "who"
For centring text, if your sayer's name label hasn't changed, use the following code:

Code: Select all

    style.say_label.text_align = 0.5	#0.0 left-align, 0.5 centre, 1.0 right-align
Last edited by SinnyROM on Thu Apr 03, 2014 1:33 am, edited 1 time in total.

User avatar
amimajime
Newbie
Posts: 3
Joined: Wed Apr 02, 2014 7:04 pm
Contact:

Re: Namebox that is part of the textbox image

#7 Post by amimajime » Thu Apr 03, 2014 1:09 am

That's great! I'm actually able to layer it on top of the dialogue window! I did some adjustments, and voila! It's in the box.

But actually… there's still one more problem. It's not in the box "all" the time.

Since the dialogue sometimes has 1,2, or 3 lines - the name gets moved down every time there's more than 1 line of dialogue. So at one point, it'll look fine. But then when there's a long dialogue (over 1 line of text) the name moves down and goes outside the box. How do we fix this?

(And I'm also going to try centering things too. I want to get this fixed first though : ) thank you!)

User avatar
SinnyROM
Regular
Posts: 166
Joined: Mon Jul 08, 2013 12:25 am
Projects: Blue Birth
Organization: Cosmic Static Games
Contact:

Re: Namebox that is part of the textbox image

#8 Post by SinnyROM » Thu Apr 03, 2014 1:53 am

I would guess the who is directly below the what element, and on the same level. If what they're saying becomes longer, it'll push their name down as well. Try removing an indent from the who part, or placing it inside its own vbox/hbox to contain it.

User avatar
amimajime
Newbie
Posts: 3
Joined: Wed Apr 02, 2014 7:04 pm
Contact:

Re: Namebox that is part of the textbox image

#9 Post by amimajime » Thu Apr 03, 2014 3:37 am

It worked!!! I did as you said and I was able to do it! (Just had to readjust the parameters again. Thanks a bunch!!!

Now for the centering… this is where I put the code to implement the name to be centered. Am I doing it right? Because it's not centering at all : (

Code: Select all

## ---------- Name Box  ---------------------

    style.say_label.font = "comicbd.ttf"
    style.say_label.xcenter = 0.5
    style.say_label.text_align = 0.5   #0.0 left-align, 0.5 centre, 1.0 right-align
    style.say_label.size =18
    style.say_label.bold = False
    style.say_label.outlines = [(1, "#000000", 0, 0)] 

    
    ## ----- Frame (expandable) ------------------------
    # style.say_who_window.background = Frame("whobox.png", 0, 0)
    
    ## ---- No Frame (Not expandable) ---------------
    style.say_who_window.background = "whoboxi.png"
    
    style.say_who_window.left_padding = 00
    style.say_who_window.right_padding = 00
    style.say_who_window.top_padding = 00
    style.say_who_window.bottom_padding = 0
    
    style.say_who_window.left_margin = 90
    style.say_who_window.right_margin = 750
    style.say_who_window.top_margin = -188
    style.say_who_window.bottom_margin = 0
    
    style.say_who_window.yminimum = 10
    style.say_who_window.xminimum = 10
    
    

User avatar
SinnyROM
Regular
Posts: 166
Joined: Mon Jul 08, 2013 12:25 am
Projects: Blue Birth
Organization: Cosmic Static Games
Contact:

Re: Namebox that is part of the textbox image

#10 Post by SinnyROM » Fri Apr 04, 2014 10:01 am

A few things are apparent now, and I figured out how to get centring to work after some fiddling.

Instead of using the margin property to position the namebox, use xpos/ypos, or xalign/yalign. Negative margin doesn't really make sense. Then you can properly use Frame for the namebox background, like you have in your commented code. I'm afraid you'll have to go through repositioning it again!

I couldn't get text_align to work either, but you had xcenter there already which should work.

Code: Select all

## ---------- Name Box  ---------------------

    style.say_label.font = "comicbd.ttf"
    style.say_label.xcenter = 0.5
    #style.say_label.text_align = 0.5   #0.0 left-align, 0.5 centre, 1.0 right-align
    style.say_label.size =18
    style.say_label.bold = False
    style.say_label.outlines = [(1, "#000000", 0, 0)] 

    
    ## ----- Frame (expandable) ------------------------
    style.say_who_window.background = Frame("ui/namebox.png", 0, 0)
    
    ## ---- No Frame (Not expandable) ---------------
    #style.say_who_window.background = "ui/namebox.png"
    
    style.say_who_window.left_padding = 00
    style.say_who_window.right_padding = 00
    style.say_who_window.top_padding = 00
    style.say_who_window.bottom_padding = 0
    
    #style.say_who_window.left_margin = 90
    #style.say_who_window.right_margin = 750
    #style.say_who_window.top_margin = -188
    #style.say_who_window.bottom_margin = 0

    style.say_who_window.xalign = 100	# or xpos
    style.say_who_window.yalign = 50	# or ypos
    
    style.say_who_window.yminimum = 10
    style.say_who_window.xminimum = 10

Post Reply

Who is online

Users browsing this forum: Ocelot