Choices display issue [SOLVED]

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
Mistexpi
Newbie
Posts: 10
Joined: Fri Jan 19, 2018 3:03 pm
Completed: Glasses Quest, Selve, Subvenire Pluvia, Koumon no Hana
itch: mistexpi
Location: https://mistexpi.carrd.co/
Contact:

Choices display issue [SOLVED]

#1 Post by Mistexpi »

I have this weird thing going on, probably since I've updated Ren'Py to its latest version (6.99.14.3.3347).
Well, I've never encountered this before, and my games' choices were displaying perfectly.

But now after deleting a game's persistent data, the first time I'll launch that game, all choices will appear all condensed like this :
Image

Then, if I simply reload the game (through the dev' console) or relaunch it, they'll appear like they have to be :
Image

It's the same case for other people who have tried that game on their computers.

I also tried to launch some older games of mine after deleting their persistent data too, and the same thing happened :
Image

Image

After reload/relaunch :
Image

Image

The choices were displayed correctly at the time I released those games (around last year for the lastest one).
I wonder if it has to do with the new GUI thing ? I'm currently using the older code, I planned to switch to the new one later :o

Also, that problem only occurs when I've placed my choices in the textbox.
I've tried my older games where they are simply in the middle of the screen, and one where they are slighty positionned to the right, and everything is ok, even after deleting persistent data.
The rest of the text doesn't have this problem.


Here is the code I use to show choices in the textbox :

Code: Select all

screen choice:

    window:
        style "menu_window"
        xalign 0.77
        ypos 830

        vbox:
            style "menu"
            spacing 2

            for caption, action, chosen in items:

                if action:

                    button:
                        action action
                        style "menu_choice_button"

                        text caption style "menu_choice"

                else:
                    text caption style "menu_caption"

init -2 python:
    config.narrator_menu = True

    style.menu_window.set_parent(style.default)
    style.menu_choice.clear()
    style.menu_choice_button.set_parent(style.button)
    style.menu_choice_button.xminimum = int(config.screen_width * 0.52)
    style.menu_choice_button.xmaximum = int(config.screen_width * 0.52)
    #style.menu_choice.text_align = 0.0
    style.menu_choice.xpos = 20
    style.menu_choice.color = "#fbbdb6"
    
    style.menu_choice.hover_color = "#fff"
    style.menu_choice.hover_italic = True
    
    style.menu_choice_button.background = Frame("button_idle_choix.png", 5, 5, -30, -30)
    style.menu_choice_button.hover_background = Frame("button_hover_choix.png", 5, 5, -30, -30)
I have to say, the possible link between persistent data and choices' display really leave me perplexed :v
Thanks in advance for your attention !
Last edited by Mistexpi on Fri Nov 23, 2018 11:50 am, edited 1 time in total.
Image

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2397
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: Choices display issue

#2 Post by Ocelot »

Try to add style.rebuild() at init -1 python or higher.

Any reason you do not use style statements instead of manipulating style objects directly?
< < insert Rick Cook quote here > >

User avatar
Mistexpi
Newbie
Posts: 10
Joined: Fri Jan 19, 2018 3:03 pm
Completed: Glasses Quest, Selve, Subvenire Pluvia, Koumon no Hana
itch: mistexpi
Location: https://mistexpi.carrd.co/
Contact:

Re: Choices display issue

#3 Post by Mistexpi »

About style objects, I guess it's because I learned it that way and took the habit to always do it like this... D:
I'll make sure to look more into style statements, then, it seems practical !

I tried adding style.rebuild() but it didn't changed anything buuuttt I did solved my problem with the following steps... guess you sometimes need the right inspiration or something like this :roll:

So first, I tried to create a style for the menu window, to see what it would change, this is the previous code :

Code: Select all

    window:
        style "menu_window"
        xalign 0.77
        ypos 830
and the new one

Code: Select all

style choix_wind:
    xpos 700
    ypos 830

Code: Select all

    window:
        style "choix_wind"
After this, when deleting persistent data and launching the game, the choices would stay condensed but at least they were aligned were they had to be, and not to the right anymore, which was a good start.


Then, I remembered this part :

Code: Select all

    style.menu_choice_button.xminimum = int(config.screen_width * 0.52)
    style.menu_choice_button.xmaximum = int(config.screen_width * 0.52)
and tried replacing it by this :

Code: Select all

    style.menu_choice_button.xminimum = 1050
    style.menu_choice_button.xmaximum = 1050
and hurrah !!!
Now it's working, the choices aren't condensed anymore even after deleting persistent data !
I tried it on another computer to, and it works nicely.

I... honestly don't even remember why I used it like this instead of simply putting a precise size...
Thanks for the quick help and inspiration, I was becoming desperate with this situation :')
Image

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2397
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: Choices display issue

#4 Post by Ocelot »

BY the way, what is the prioryty of code which sets config.screen_width variable? If there is nothing stting it directly, it might be initialized by gui.init() call. IN any case, it seems that it is set after you use it to calculate minimum width. So it defaults to 0, resulting in 0 after calculation, which meant "determine automatically" which defaults to "maximum possible size". If you save and load, it will use saved variables to init button width, so it works properly.
< < insert Rick Cook quote here > >

User avatar
Mistexpi
Newbie
Posts: 10
Joined: Fri Jan 19, 2018 3:03 pm
Completed: Glasses Quest, Selve, Subvenire Pluvia, Koumon no Hana
itch: mistexpi
Location: https://mistexpi.carrd.co/
Contact:

Re: Choices display issue

#5 Post by Mistexpi »

Oooh yeah, I see ! :o
I understand better where all of this comes from, now, that's nice !

config.screen_width is declared under

Code: Select all

init -1 python hide
Image

Post Reply

Who is online

Users browsing this forum: Google [Bot]