Ren'Py Having a lot of trouble with a custom screen in renpy.

Jun 11, 2020
59
130
In the game I'm making I want there to be a persistent screen that occupies the bottom 30% of the screen. The screen will have 2 parts. The left will contain a list of choices you can scroll through and the right will contain a textbox that shows a description of a choice when you hover over it. The left part needs to occupy 40% of total screen width and the right should occupy the other other 60%. But I'm having so much trouble getting this textbox on the right to work. No matter what I try, the text it contains seems to escape from the container and slide off the screen. This is the current code:
```
screen fixed_corner_menu():
style_group "choice"
vpgrid:

cols 2
rows 1
spacing 5
ysize 0.3
xsize 0.95

xalign 0.0
yalign 0.95

vpgrid:
cols 1
spacing 5
draggable True
mousewheel True
xsize 0.8
scrollbars "vertical"
# Since we have scrollbars, this positions the side, rather than
# the vpgrid.
# xalign 0.1
# yalign 0.9
# Add your menu items here using 'textbutton' or other UI elements
buttons

frame:
xsize 1400
ysize 1.0
xalign 0.0
xpadding 40
ypadding 30
text "content"
```

No matter what configuration of xsize and xalign I try on the frame the problem with the text going out of the container remains. And I have 2 wider problems with the screen itself. I use the show screen command to show the screen persistently, it appears behind the background image of my nvl dialogue. That background image is just pure black for now so it looks much darker. Also, when I show the screen you can still click on other areas of the screen to move forward without making a choice which crashes the game because the areas after the choice depend on variables set by the choice. So I also need a way to block those interactions.

Edit:
Ok I got the issue fixed by changing the formatting of the screen to this:

screen choice_menu():
style_group "choice"
frame background Solid('#2222'): #mostly transparent background. change to taste
xcenter 0.5 xsize 0.99
yanchor 1.0 ysize 0.3 ypos 1.0 yoffset -32
vpgrid:
cols 1
spacing 5
draggable True
mousewheel True
xsize 0.53
scrollbars "vertical"
# Add your menu items here using 'textbutton' or other UI elements
content.
frame: #right text desctiption
ycenter 0.5 ysize 1.0
xalign 1.0 xoffset -16 xsize 0.45
text '[tt]'
But the problems with the show screen thing yet remain.
 
Last edited:

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,979
16,236
Code:
screen fixed_corner_menu():
    style_group "choice"
    vpgrid:
Why do you use vpgrid here ?
" "

What you need is to size your screen with frames, then to use either a viewport or vpgrid for the scrollable part only.

Something like
Python:
screen fixed_corner_menu():
    style_group "choice"

    frame:
        ysize 0.3
        xfill True
        ypos 0.7

        frame:
            xsize 0.4
            xpos 0
            xfill True
            vpgrid:
                [the choices]

        frame:
            xsize 0.6
            xpos 0.4
            xfill True
            [whatever]

I use the show screen command to show the screen persistently, [...] Also, when I show the screen you can still click on other areas of the screen to move forward without making a choice which crashes the game because the areas after the choice depend on variables set by the choice.
On one hand you want the screen to be persistent, therefore to be always available whatever the moment in the game. And on the other hand, the screen contain choices that make it totally incompatible with this persistence... :/

So which one of the two are you trying to do ?
 
Jun 11, 2020
59
130
Why do you use vpgrid here ?
" "

What you need is to size your screen with frames, then to use either a viewport or vpgrid for the scrollable part only.

Something like
Python:
screen fixed_corner_menu():
    style_group "choice"

    frame:
        ysize 0.3
        xfill True
        ypos 0.7

        frame:
            xsize 0.4
            xpos 0
            xfill True
            vpgrid:
                [the choices]

        frame:
            xsize 0.6
            xpos 0.4
            xfill True
            [whatever]



On one hand you want the screen to be persistent, therefore to be always available whatever the moment in the game. And on the other hand, the screen contain choices that make it totally incompatible with this persistence... :/

So which one of the two are you trying to do ?
I want it to be persistent. To be blank when there are no choices to be made, and to contain the choices when there are. And someone else helped out with the frame thing and it's working for now but no progress on the whole "persistent screen" thing yet.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,979
16,236
I want it to be persistent. To be blank when there are no choices to be made, and to contain the choices when there are.
So you don't want it to be persistent...

What you want is for the User Interface canvas to be always seen, and for the choices to only appear on demand.
This mean that the whole vpgrid part have nothing to do in the screen. It should be in the "choice" screen, or a custom screen menu.

It's where reading the documentation (available in your computer where Ren'Py is located) help a lot...