[SOLVED] $ quick_menu = False doesn't work within a screen

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
chesarty
Regular
Posts: 116
Joined: Sat Aug 25, 2018 3:07 am
Completed: 0
Contact:

[SOLVED] $ quick_menu = False doesn't work within a screen

#1 Post by chesarty »

I have a problem where the quick menu doesn't disappear when I'm on my dressup/customization screen, whereas in-game the $ quick_menu = False command works fine... What could be the issue there?
Last edited by chesarty on Fri Jan 08, 2021 1:46 pm, edited 1 time in total.

User avatar
RicharDann
Veteran
Posts: 286
Joined: Thu Aug 31, 2017 11:47 am
Contact:

Re: $ quick_menu = False doesn't work within a screen

#2 Post by RicharDann »

Since quick_menu is a global variable already created in the default files, you're supposed to run that statement from a label in script, to change it's value.

If you write that line on a screen, it doesn't modify the existing global variable, but instead creates a new screen variable, scoped locally to the screen, with the same name but different from the default one. So if you want to disable quick menu when your screen appears, you can either:

Code: Select all

label start:
    $ quick_menu = False
    call screen my_screen
Or add an on statement to your screen (I haven't tested this but it should probably work):

Code: Select all

screen my_screen():
    on 'show':
        action SetVariable('quick_menu', False)
    on 'hide':
        action SetVariable('quick_menu', True) # so it reappears when screen is hidden
The most important step is always the next one.

User avatar
chesarty
Regular
Posts: 116
Joined: Sat Aug 25, 2018 3:07 am
Completed: 0
Contact:

Re: $ quick_menu = False doesn't work within a screen

#3 Post by chesarty »

RicharDann wrote: Fri Jan 08, 2021 1:40 pm Since quick_menu is a global variable already created in the default files, you're supposed to run that statement from a label in script, to change it's value.

If you write that line on a screen, it doesn't modify the existing global variable, but instead creates a new screen variable, scoped locally to the screen, with the same name but different from the default one. So if you want to disable quick menu when your screen appears, you can either:

Code: Select all

label start:
    $ quick_menu = False
    call screen my_screen
Or add an on statement to your screen (I haven't tested this but it should probably work):

Code: Select all

screen my_screen():
    on 'show':
        action SetVariable('quick_menu', False)
    on 'hide':
        action SetVariable('quick_menu', True) # so it reappears when screen is hidden
Thanks man, the on statement worked flawlessly!

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

Re: [SOLVED] $ quick_menu = False doesn't work within a screen

#4 Post by Imperf3kt »

There's more "on" states too that you may find needed, such as on replaced, which i find necessary sometimes.
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

Post Reply

Who is online

Users browsing this forum: Google [Bot], henne