RenPy textbox positioning tool?

osanaiko

Engaged Member
Modder
Jul 4, 2017
2,553
4,639
By "textbox" do you mean the dialogue box?

If so, you should look into the `screens.rpy` file, and check the "Say Screen" (it has a huge comment so easy to find.)

Code:
screen say(who, what):
    style_prefix "say"

    window:
        id "window"

        if who is not None:

            window:
                style "namebox"
                text who id "who"

        text what id "what"
This is coded in "Screen" language, which is one of the three Renpy "domain specific languages" (the other two are "Renpy Script" and "Style" languages).

In this screen definition, at the top level there is a "style prefix" command and a "window" element. There is no specific "style" command on the window element.

So, this means that the engine will look for and use wither a "style window" and/or a "style say_window" definition.

Looking further down the same `screens.rpy` file, you'll find it:
Code:
style window:
    xalign 0.5
    xfill True
    yalign gui.textbox_yalign
    ysize gui.textbox_height

    background Image("gui/textbox.png", xalign=0.5, yalign=1.0)
These "style" commands control where the dialogue box is positioned:
`xalign 0.5`: this means the horizontal (x-axis) alignment of the dialogue box is centered around 0.5 of the width of the screen frame. (i.e. the center)
`yalign gui.textbox_yalign` : this means the value for vertical (y-axis) alignement) is controlled by variable `gui.textbox_yalign`

The "gui" is a hint to look in the gui.rpy file.

So, it looks like RenpyTom has mysteriously foreseen your desire to move the dialogue box away from the bottom of the page and made a convenient setting, rather than forcing you to find it and edit the style yourself!

In the gui.rpy file, look until you find this section:

Code:
## Dialogue ####################################################################
##
## These variables control how dialogue is displayed on the screen one line at a
## time.

## The height of the textbox containing dialogue.
define gui.textbox_height = 185

## The placement of the textbox vertically on the screen. 0.0 is the top, 0.5 is
## center, and 1.0 is the bottom.
define gui.textbox_yalign = 1.0
Here it explains exactly what the variables are and what they do.
To move the dialogue to the top, change the `textbox_yalign` from 1.0 to "0.0"
that is (0.0 x screen height).

Hope this helps! :love:
 

dp107

Newbie
Oct 28, 2021
18
6
By "textbox" do you mean the dialogue box?

If so, you should look into the `screens.rpy` file, and check the "Say Screen" (it has a huge comment so easy to find.)

Code:
screen say(who, what):
    style_prefix "say"

    window:
        id "window"

        if who is not None:

            window:
                style "namebox"
                text who id "who"

        text what id "what"
This is coded in "Screen" language, which is one of the three Renpy "domain specific languages" (the other two are "Renpy Script" and "Style" languages).

In this screen definition, at the top level there is a "style prefix" command and a "window" element. There is no specific "style" command on the window element.

So, this means that the engine will look for and use wither a "style window" and/or a "style say_window" definition.

Looking further down the same `screens.rpy` file, you'll find it:
Code:
style window:
    xalign 0.5
    xfill True
    yalign gui.textbox_yalign
    ysize gui.textbox_height

    background Image("gui/textbox.png", xalign=0.5, yalign=1.0)
These "style" commands control where the dialogue box is positioned:
`xalign 0.5`: this means the horizontal (x-axis) alignment of the dialogue box is centered around 0.5 of the width of the screen frame. (i.e. the center)
`yalign gui.textbox_yalign` : this means the value for vertical (y-axis) alignement) is controlled by variable `gui.textbox_yalign`

The "gui" is a hint to look in the gui.rpy file.

So, it looks like RenpyTom has mysteriously foreseen your desire to move the dialogue box away from the bottom of the page and made a convenient setting, rather than forcing you to find it and edit the style yourself!

In the gui.rpy file, look until you find this section:

Code:
## Dialogue ####################################################################
##
## These variables control how dialogue is displayed on the screen one line at a
## time.

## The height of the textbox containing dialogue.
define gui.textbox_height = 185

## The placement of the textbox vertically on the screen. 0.0 is the top, 0.5 is
## center, and 1.0 is the bottom.
define gui.textbox_yalign = 1.0
Here it explains exactly what the variables are and what they do.
To move the dialogue to the top, change the `textbox_yalign` from 1.0 to "0.0"
that is (0.0 x screen height).

Hope this helps! :love:
Thanks for the help, but it seems i cannot find the gui.rpy file anywhere n the game!!!
is there a way to override the textbox position to top with some commands in a text file?
 

osanaiko

Engaged Member
Modder
Jul 4, 2017
2,553
4,639
If "gui.rpy" is *not* present, i'm surprised you get it to work at all

What version of renpy are you using?

When you start a new project, you should get the gui.rpy file created in the "game" folder.