[Solved] Say Text Window Has Inconsistent Width

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
majike
Regular
Posts: 34
Joined: Thu Feb 04, 2016 4:28 am
Contact:

[Solved] Say Text Window Has Inconsistent Width

#1 Post by majike »

I seem to have encountered a rather vexing situation. As attachments V1 and V2 show, I have carefully designed the say window for text to be positioned exactly 12 pixels (using integers) from each of the internal borders. However, if there is too much text (as V3 shows), the right side of the text ends up extending almost to the edge of the right border.

V1.png
(8.63 KiB) Not downloaded yet
V2.png
V3.png

I've tried extending window sizes, turning off Justify, adding margins, but nothing I do seems to work and it is starting to leave me really disheartened. Below is what I believe to be the relevant code. If anyone is able to solve this dilemma, I will be eternally grateful. <3

#########################################
## These settings let you customize the window containing the
## dialogue and narration, by replacing it with an image.

## The background of the window. In a Frame, the two numbers
## are the size of the left/right and top/bottom borders,
## respectively.

style.window.background = Frame("transparent.png", 0, 0)

## Margin is space surrounding the window, where the background
## is not drawn.

style.window.left_margin = 0
style.window.right_margin = 0
style.window.top_margin = 0
style.window.bottom_margin = 0

## Padding is space inside the window, where the background is
## drawn.

style.window.left_padding = 0
style.window.right_padding = 0
style.window.top_padding = 0
style.window.bottom_padding = 0

## This is the minimum height of the window, including the margins
## and padding.

style.window.xpos = 0.235
style.window.ypos = 0.136
style.window.xsize = 0.62
style.window.ysize = 0.3
style.window.xminimum = 0.621
style.window.xmaximum = 0.621
style.window.yminimum = 0.3
style.window.ymaximum = 0.3


##############################################################################
# Say
#
# Screen that's used to display adv-mode dialogue.
# http://www.renpy.org/doc/html/screen_special.html#say
screen say(who, what, side_image=None, two_window=False):

# Decide if we want to use the one-window or two-window variant.
if not two_window:

# The one window variant.
window:
id "window"

has vbox:
style "say_vbox"

if who:
text who id "who"

text what id "what"

else:

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

if who:
window:
style "say_who_window"

text who:
id "who"

window:
id "window"
pos 0.03
has vbox:
style "say_vbox"

text what id "what"

# If there's a side image, display it above the text.
if side_image:
add side_image
else:
add SideImage() xalign 0.5 yalign 0.5

# Use the quick menu.
use quick_menu

style nvl_dialogue:
justify True
xpos (0.07)

style say_dialogue:
justify True
xpos (0.07)
Last edited by majike on Tue Dec 18, 2018 2:04 pm, edited 1 time in total.

majike
Regular
Posts: 34
Joined: Thu Feb 04, 2016 4:28 am
Contact:

Re: Say Text Window Has Inconsistent Width

#2 Post by majike »

Does no-one have any solution? My entire project cannot advance without a solution to this problem. :(

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3791
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: Say Text Window Has Inconsistent Width

#3 Post by Imperf3kt »

What resolution is your game.?
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

majike
Regular
Posts: 34
Joined: Thu Feb 04, 2016 4:28 am
Contact:

Re: Say Text Window Has Inconsistent Width

#4 Post by majike »

Imperf3kt wrote: Thu Oct 25, 2018 8:57 pm What resolution is your game.?
1024x768.

majike
Regular
Posts: 34
Joined: Thu Feb 04, 2016 4:28 am
Contact:

Re: Say Text Window Has Inconsistent Width

#5 Post by majike »

Does anyone have any idea how to fix this? I've spent several hours at a time trying to fix it, but no matter what I try, I can't fix this issue. It's really driving me nuts, especially as every other engine I've experimented with just isn't right (TWINE might be okay if it wasn't for its interface and lack of undo functionality, various others require players to download an interpreter [which most wouldn't be bothered to do}, etc.).

majike
Regular
Posts: 34
Joined: Thu Feb 04, 2016 4:28 am
Contact:

Re: Say Text Window Has Inconsistent Width

#6 Post by majike »

I've uploaded a paired-down version of the game that highlights the text width discrepancies, in hopes that it might help someone figure out what is wrong with the coding, as I remain completely lost.

Hopefully, this will help. :|
Last edited by majike on Tue Dec 18, 2018 2:04 pm, edited 1 time in total.

philat
Eileen-Class Veteran
Posts: 1909
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Say Text Window Has Inconsistent Width

#7 Post by philat »

There are a lot of issues in general, but suffice it to say that, as you uploaded, the text window is actually nothing like what you think it is. (Add background Solid("#FFF5") to your window style if you don't believe me and look at where the window is.)

That said:

1. Delete ALL of your window styles in options. (Or comment them out, doesn't matter which.)

2. Use the following window style.

Code: Select all

style window:
    xsize 635
    ysize 420
    xalign 0.0
    yalign 0.0
    xoffset 40
    yoffset 40
    padding (0, 0)
    margin (0, 0)
3. Add min_width 633 to your text style. (The simplest option is to just hardcode it into the screen.)

Code: Select all

            text what id "what":
                min_width 633 # here. this is line 29 in the screens.rpy file you uploaded

majike
Regular
Posts: 34
Joined: Thu Feb 04, 2016 4:28 am
Contact:

Re: Say Text Window Has Inconsistent Width

#8 Post by majike »

philat wrote: Tue Dec 18, 2018 2:39 am There are a lot of issues in general, but suffice it to say that, as you uploaded, the text window is actually nothing like what you think it is. (Add background Solid("#FFF5") to your window style if you don't believe me and look at where the window is.)

That said:

1. Delete ALL of your window styles in options. (Or comment them out, doesn't matter which.)

2. Use the following window style.

Code: Select all

style window:
    xsize 635
    ysize 420
    xalign 0.0
    yalign 0.0
    xoffset 40
    yoffset 40
    padding (0, 0)
    margin (0, 0)
3. Add min_width 633 to your text style. (The simplest option is to just hardcode it into the screen.)

Code: Select all

            text what id "what":
                min_width 633 # here. this is line 29 in the screens.rpy file you uploaded
A thousand thank yous! This problem has been giving me SO much stress for months; no matter how many hours I spent trying to fix it, nothing worked, but this works like a dream!

Thank you SO so much! <3

Post Reply

Who is online

Users browsing this forum: No registered users