Page 1 of 1

Character-specific Maximum Width for Textbox?

Posted: Thu Nov 09, 2017 7:58 pm
by noeinan
I'm using different textbox images for dialogue and thoughts compared to the narrator. However, my dialogue and thought boxes are shorter than the narration, which takes up the whole screen. Is there a way to set a different maximum textbox length in a defined "character" so that I don't have text running out of the lines? (Tried searching around for this, and all I found was the universal gui.dialogue_width variable.)

Code: Select all

define dialogue = Character(
    None,

    window_background = "gui/dialoguebox.png",

    who_font = "PoiretOne-Regular.ttf",
    who_outlines = [(3, "#FF6C03", 0, 0)],
    who_color="#FFD200",
    who_bold = True,
    who_xalign=0.5,
    who_textalign=0.5,

    what_color = "#000000",
    what_xalign=0.5,
    what_textalign=0.5,
    what_layout='subtitle')

define thoughts = Character(
    None,

    window_background = "gui/thoughtbox.png",

    who_font = "PoiretOne-Regular.ttf",
    who_outlines = [(3, "#FF6C03", 0, 0)],
    who_color="#FFD200",
    who_bold = True,
    who_xalign=0.5,
    who_textalign=0.5,

    what_color = "#FFFFFF",
    what_xalign=0.5,
    what_textalign=0.5,
    what_layout='subtitle')

define narrator = Character(None, what_color = "#000000", what_outlines=[( 0, "#A3A3A3", 2, 2 )])

Re: Character-specific Maximum Width for Textbox?

Posted: Thu Nov 09, 2017 9:21 pm
by philat
You can add what_xmaximum to a character definition.

Re: Character-specific Maximum Width for Textbox?

Posted: Thu Nov 09, 2017 9:24 pm
by noeinan
That works great, thanks! I wasn't having much success googling it on my own. ><

Re: Character-specific Maximum Width for Textbox?

Posted: Thu Nov 09, 2017 9:35 pm
by noeinan
Oh, I thought it was working, but after running a few more tests it seems that is only sometimes the case. For longer sentences, it breaks them up properly, but for sentences that are just a little bit too long it runs them outside the textbox. I tried removing "subtitle" (justification) from my code but it didn't fix the issue. If I add more junk text to the end of the line, suddenly it works again, so it seems to have something to do with the text length?

Image

Image

Code: Select all

define dialogue = Character(
    None,

    window_background = "gui/dialoguebox.png",

    who_font = "PoiretOne-Regular.ttf",
    who_outlines = [(3, "#FF6C03", 0, 0)],
    who_color="#FFD200",
    who_bold = True,
    who_xalign=0.5,
    who_textalign=0.5,

    what_color = "#000000",
    what_xmaximum = 950,
    what_xalign=0.5,
    what_textalign=0.5,
    what_layout='subtitle')

Re: Character-specific Maximum Width for Textbox?

Posted: Sat Nov 11, 2017 12:34 pm
by PyTom
It's hard to tell since the images you posted are scaled down. Is the text on the bottom wider than 950 pixels? Since that really shouldn't be possible in Ren'Py - if it is, it's a bug. (The one exception is when Ren'Py can't break the text, as if it's a long single word.)

Re: Character-specific Maximum Width for Textbox?

Posted: Sun Nov 12, 2017 1:03 am
by Imperf3kt
If dialogue is centered and you get tyat effect with Justified and the overlapping line when not using justified, I'd be inclined to check the width of the say window and make sure it is the same size as / smaller than the window background image.

Re: Character-specific Maximum Width for Textbox?

Posted: Sun Nov 12, 2017 10:23 pm
by noeinan
PyTom wrote: Sat Nov 11, 2017 12:34 pm It's hard to tell since the images you posted are scaled down. Is the text on the bottom wider than 950 pixels? Since that really shouldn't be possible in Ren'Py - if it is, it's a bug. (The one exception is when Ren'Py can't break the text, as if it's a long single word.)
Yeah, it's wider than 950px. Just pulled it up in my art program to check. Strangely, even some of the ones that are working are wider than 950px... I also ran some tests, and if I change 950 to, say, 900, then it *drastically* reduces the width of dialogue, down to the 500 pixel range. Not sure what is going on here, but it seems to be calculating width using some kind of ratio?

Image
Imperf3kt wrote: Sun Nov 12, 2017 1:03 am If dialogue is centered and you get tyat effect with Justified and the overlapping line when not using justified, I'd be inclined to check the width of the say window and make sure it is the same size as / smaller than the window background image.
Well, I actually am trying to make it so that I have different textboxes for when characters are speaking vs the narration. The narrator is supposed to take up more space, and then the dialogue boxes are shorter, and thus need to have the text cut shorter.

Re: Character-specific Maximum Width for Textbox?

Posted: Thu Nov 16, 2017 11:34 pm
by PyTom
Can you put together a short example of this problem, please? It's kind of hard to figure it out without context. (For example, it's possible the window is being scaled before you take the screenshot.)

Re: Character-specific Maximum Width for Textbox?

Posted: Sat Nov 18, 2017 12:19 am
by noeinan
PyTom wrote: Thu Nov 16, 2017 11:34 pm Can you put together a short example of this problem, please? It's kind of hard to figure it out without context. (For example, it's possible the window is being scaled before you take the screenshot.)
Sure, I went ahead and made a new game from scratch at 1280x720 resolution, then copied the code I am using to define characters, as well as a bit of the dialogue to help with testing. I'm seeing the same problem in the brand new game, and I've attached it below. (I wasn't 100% sure on what you meant by example, but I hope this is what you need. If not, let me know what I should do instead and I'll do that!)