Hiding & Showing the Quick Menu

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
sasquatchii
Miko-Class Veteran
Posts: 551
Joined: Fri Jul 04, 2014 7:48 am
Completed: A Day in the Life of a Slice of Bread
Deviantart: sasquatchix
Soundcloud: sasquatchii
itch: sasquatchii
Location: South Carolina
Contact:

Hiding & Showing the Quick Menu

#1 Post by sasquatchii » Fri Apr 05, 2019 2:03 pm

There are certain parts in my game where I want to hide and show the quick menu. I've tried

Code: Select all

hide screen quick_menu
show screen quick_menu
But it's not working. What is the best way to hide and show the quick menu in my game?
ImageImage

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

Re: Hiding & Showing the Quick Menu

#2 Post by Imperf3kt » Sat Apr 06, 2019 3:06 am

The quick menu is shown via a variable

Code: Select all

#Hide the quick menu
    $ quick_menu = False

#Show the quick menu
    $ quick_menu = True
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Twitter
Imperf3kt Blackjack - a WIP blackjack game for Android made using Ren'Py
Free Android GUI - Updated occasionally

User avatar
sasquatchii
Miko-Class Veteran
Posts: 551
Joined: Fri Jul 04, 2014 7:48 am
Completed: A Day in the Life of a Slice of Bread
Deviantart: sasquatchix
Soundcloud: sasquatchii
itch: sasquatchii
Location: South Carolina
Contact:

Re: Hiding & Showing the Quick Menu

#3 Post by sasquatchii » Sat Apr 06, 2019 2:23 pm

Imperf3kt wrote:
Sat Apr 06, 2019 3:06 am
The quick menu is shown via a variable

Code: Select all

#Hide the quick menu
    $ quick_menu = False

#Show the quick menu
    $ quick_menu = True
Thanks, Imperf3kt! I tried implementing this in my game, but it still shows up unfortunately :(
Here's the script of my game:

Code: Select all

label start:
    stop music fadeout 5.6
    $ pcname = "Chelsea"
    $ quick_menu = False
    window hide
    centered "Three years ago, you and your parents were in a terrible car accident while on vacation. Miraculously, you survived - but your parents were not so lucky." with fade
    centered "With no other relatives to speak of, you spent a year getting your life back together." with fade
And here's the quick menu screen code itself:

Code: Select all

screen quick_menu():

    imagemap:

            ground "gui/quick-menu-inactive.png" 
            hover "gui/quick-menu-active.png"
            selected_idle "gui/quick-menu-active.png"
            

            hotspot (552, 720, 148, 59) action Rollback()
            hotspot (711, 720, 177, 59) action ShowMenu('history')
            hotspot (899, 720, 146, 59) action Skip()
            hotspot (1057, 720, 150, 59) action Preference("auto-forward", "toggle")
            hotspot (1217, 720, 160, 59) action ShowMenu('load')
            hotspot (1388, 720, 160, 59) action ShowMenu('save')
            hotspot (1558, 720, 174, 59) action ShowMenu('preferences')
            

    

## This code ensures that the quick_menu screen is displayed in-game, whenever
## the player has not explicitly hidden the interface.
init python:
    config.overlay_screens.append("quick_menu")

default quick_menu = False

style quick_button is default
style quick_button_text is button_text

style quick_button:
    properties gui.button_properties("quick_button")

style quick_button_text:
    properties gui.button_text_properties("quick_button")
I think it might have something to do with this bit, maybe?:

Code: Select all

init python:
    config.overlay_screens.append("quick_menu")
I got rid of that bit, but the entire screen was gone/wouldn't show up :(

So I'm pretty stumped!
ImageImage

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

Re: Hiding & Showing the Quick Menu

#4 Post by Imperf3kt » Sat Apr 06, 2019 3:13 pm

That's unusual. Not least to mention you have the quick menu set to False by default.


Im not sure why this would happen.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Twitter
Imperf3kt Blackjack - a WIP blackjack game for Android made using Ren'Py
Free Android GUI - Updated occasionally

User avatar
sasquatchii
Miko-Class Veteran
Posts: 551
Joined: Fri Jul 04, 2014 7:48 am
Completed: A Day in the Life of a Slice of Bread
Deviantart: sasquatchix
Soundcloud: sasquatchii
itch: sasquatchii
Location: South Carolina
Contact:

Re: Hiding & Showing the Quick Menu

#5 Post by sasquatchii » Sat Apr 06, 2019 3:36 pm

I thought so too, Imperf3kt!! I've definitely hidden quick menus & other screens before and have never encountered this kind of issue. I've tried a couple of other things but nothing seems to be working.

I will say that this is definitely a more complex game and has lots of code I've not dealt with before (like a wardrobe screen, a cellphone text type of menu, stats, a calendar, etc) - so it's possible that has something to do with it?

The file where the screens are located is the screens.rpy folder and the script folder where I'm trying to hide the quick menu screen is called ASEscript.rpy!

I should also add that the game is adult/NSFW! Just a warning.
Last edited by sasquatchii on Sat Apr 06, 2019 9:22 pm, edited 1 time in total.
ImageImage

User avatar
XxrenxX
Veteran
Posts: 267
Joined: Tue Oct 02, 2012 2:40 am
Projects: Chasing
Deviantart: bara-ettie
Location: Canada
Contact:

Re: Hiding & Showing the Quick Menu

#6 Post by XxrenxX » Sat Apr 06, 2019 5:24 pm

I'm not sure if this will change anything but I know the base NVL code (or mine at least) uses the quick menu. Could this possibly interfere with the variable?

User avatar
sasquatchii
Miko-Class Veteran
Posts: 551
Joined: Fri Jul 04, 2014 7:48 am
Completed: A Day in the Life of a Slice of Bread
Deviantart: sasquatchix
Soundcloud: sasquatchii
itch: sasquatchii
Location: South Carolina
Contact:

Re: Hiding & Showing the Quick Menu

#7 Post by sasquatchii » Sat Apr 06, 2019 5:28 pm

XxrenxX wrote:
Sat Apr 06, 2019 5:24 pm
I'm not sure if this will change anything but I know the base NVL code (or mine at least) uses the quick menu. Could this possibly interfere with the variable?
That was good thinking!! I checked the NVL screen and it doesn't seem to be using the quick menu. It shows up throughout the game even when I hide the textbox :(

Here is the code for my NVL screen though, it's possible I missed something but I don't think that's the case!

Code: Select all

## NVL screen ##################################################################
##
## This screen is used for NVL-mode dialogue and menus.
##
## https://www.renpy.org/doc/html/screen_special.html#nvl


screen nvl(dialogue, items=None):

    window:
        style "nvl_window"

        has vbox:
            spacing gui.nvl_spacing

        ## Displays dialogue in either a vpgrid or the vbox.
        if gui.nvl_height:

            vpgrid:
                cols 1
                yinitial 1.0

                use nvl_dialogue(dialogue)

        else:

            use nvl_dialogue(dialogue)

        ## Displays the menu, if given. The menu may be displayed incorrectly if
        ## config.narrator_menu is set to True, as it is above.
        for i in items:

            textbutton i.caption:
                action i.action
                style "nvl_button"

    add SideImage() xalign 0.0 yalign 1.0


screen nvl_dialogue(dialogue):

    for d in dialogue:

        window:
            id d.window_id

            fixed:
                yfit gui.nvl_height is None

                if d.who is not None:

                    text d.who:
                        id d.who_id

                text d.what:
                    id d.what_id


## This controls the maximum number of NVL-mode entries that can be displayed at
## once.
define config.nvl_list_length = gui.nvl_list_length

style nvl_window is default
style nvl_entry is default

style nvl_label is say_label
style nvl_dialogue is say_dialogue

style nvl_button is button
style nvl_button_text is button_text

style nvl_window:
    xfill True
    yfill True

    background "gui/nvl.png"
    padding gui.nvl_borders.padding

style nvl_entry:
    xfill True
    ysize gui.nvl_height

style nvl_label:
    xpos gui.nvl_name_xpos
    xanchor gui.nvl_name_xalign
    ypos gui.nvl_name_ypos
    yanchor 0.0
    xsize gui.nvl_name_width
    min_width gui.nvl_name_width
    text_align gui.nvl_name_xalign

style nvl_dialogue:
    xpos gui.nvl_text_xpos
    xanchor gui.nvl_text_xalign
    ypos gui.nvl_text_ypos
    xsize gui.nvl_text_width
    min_width gui.nvl_text_width
    text_align gui.nvl_text_xalign
    layout ("subtitle" if gui.nvl_text_xalign else "tex")

style nvl_thought:
    xpos gui.nvl_thought_xpos
    xanchor gui.nvl_thought_xalign
    ypos gui.nvl_thought_ypos
    xsize gui.nvl_thought_width
    min_width gui.nvl_thought_width
    text_align gui.nvl_thought_xalign
    layout ("subtitle" if gui.nvl_text_xalign else "tex")

style nvl_button:
    properties gui.button_properties("nvl_button")
    xpos gui.nvl_button_xpos
    xanchor gui.nvl_button_xalign

style nvl_button_text:
    properties gui.button_text_properties("nvl_button")
ImageImage

User avatar
XxrenxX
Veteran
Posts: 267
Joined: Tue Oct 02, 2012 2:40 am
Projects: Chasing
Deviantart: bara-ettie
Location: Canada
Contact:

Re: Hiding & Showing the Quick Menu

#8 Post by XxrenxX » Sat Apr 06, 2019 7:12 pm

sasquatchii wrote:
Sat Apr 06, 2019 5:28 pm
Nothing seems off, it was worth a shot. I wonder if there's a way to hide the imagemap instead of the whole screen. Kind of like a cheat? Something like this but I'm not sure how to go about editing or implementing it. Note that article is really old so It would probably need to be updated.

Just trying to think of ideas. Probably won't work but can be hopeful x.x

User avatar
Matalla
Veteran
Posts: 202
Joined: Wed Mar 06, 2019 6:22 pm
Completed: The Lost Smile
itch: matalla-interactive
Location: Spain
Contact:

Re: Hiding & Showing the Quick Menu

#9 Post by Matalla » Sat Apr 06, 2019 8:23 pm

I downloaded it and I see two problems that can actually be summarized in one: what you (and me) are watching, is not the quick menu. It's just part of the textbox.

First, edit your textbox image and delete that part.
Second, the inactive image on your imagemap is fully transparent. Substitute it for the image you want when the buttons are not hovered.
Comunidad Ren'Py en español (Discord)
Honest Critique

User avatar
sasquatchii
Miko-Class Veteran
Posts: 551
Joined: Fri Jul 04, 2014 7:48 am
Completed: A Day in the Life of a Slice of Bread
Deviantart: sasquatchix
Soundcloud: sasquatchii
itch: sasquatchii
Location: South Carolina
Contact:

Re: Hiding & Showing the Quick Menu

#10 Post by sasquatchii » Sat Apr 06, 2019 9:07 pm

Matalla wrote:
Sat Apr 06, 2019 8:23 pm
I downloaded it and I see two problems that can actually be summarized in one: what you (and me) are watching, is not the quick menu. It's just part of the textbox.

First, edit your textbox image and delete that part.
Second, the inactive image on your imagemap is fully transparent. Substitute it for the image you want when the buttons are not hovered.
I believe what we're seeing is part of the quick menu.... If what we were seeing was the textbox, wouldn't we be seeing the whole textbox?

The reason I ended up doing it the way it is is because I wanted the textbox + quick menu to look like they were seamlessly together/one unit.

I'm able to hide the textbox without any problems. It is the quick menu that stubbornly shows up. I don't really understand your advice here - how would editing the image map hide the quick menu?

I've tried what you are suggesting (before posting here) and I still saw the quick menu screen and was unable to hide it. I don't think the issue here is how the menus & screens have been done. Just that I am unable to successfully hide the quick menu.
ImageImage

User avatar
Matalla
Veteran
Posts: 202
Joined: Wed Mar 06, 2019 6:22 pm
Completed: The Lost Smile
itch: matalla-interactive
Location: Spain
Contact:

Re: Hiding & Showing the Quick Menu

#11 Post by Matalla » Sat Apr 06, 2019 9:36 pm

Hiding the quick menu is the next step, before you must know if the quick menu is indeed there. If the image of the textbox includes the image of the buttons, you can't really hide them. You could quite posible have been hiding the quick menu all the time, but you would still see the buttons in the textbox.

I just did a quick edit to your images and throw some "$ quick_menu = True" and "$ quick_menu = False" here and there and it works, believe me. Did you delete or coment these lines? Do it and try again.

Code: Select all

init python:
    config.overlay_screens.append("quick_menu")
    
Comunidad Ren'Py en español (Discord)
Honest Critique

User avatar
sasquatchii
Miko-Class Veteran
Posts: 551
Joined: Fri Jul 04, 2014 7:48 am
Completed: A Day in the Life of a Slice of Bread
Deviantart: sasquatchix
Soundcloud: sasquatchii
itch: sasquatchii
Location: South Carolina
Contact:

Re: Hiding & Showing the Quick Menu

#12 Post by sasquatchii » Sat Apr 06, 2019 9:55 pm

Matalla wrote:
Sat Apr 06, 2019 9:36 pm
Hiding the quick menu is the next step, before you must know if the quick menu is indeed there. If the image of the textbox includes the image of the buttons, you can't really hide them. You could quite posible have been hiding the quick menu all the time, but you would still see the buttons in the textbox.

I just did a quick edit to your images and throw some "$ quick_menu = True" and "$ quick_menu = False" here and there and it works, believe me. Did you delete or coment these lines? Do it and try again.

Code: Select all

init python:
    config.overlay_screens.append("quick_menu")
    
I'm just really confused and don't understand what I need to do. Any chance you could zip up & share the game file folder of my game that you tweaked so I could take a look to better understand how you edited the images & got it to work?
ImageImage

User avatar
Matalla
Veteran
Posts: 202
Joined: Wed Mar 06, 2019 6:22 pm
Completed: The Lost Smile
itch: matalla-interactive
Location: Spain
Contact:

Re: Hiding & Showing the Quick Menu

#13 Post by Matalla » Sat Apr 06, 2019 11:30 pm

Put this images in the gui folder (I just did a quick cut in the textbox, you'll have to do it properly, it's just for testing):
buttons_box.zip
The images
(69.1 KiB) Downloaded 7 times
Use this code for the quick menu screen:

Code: Select all

screen quick_menu():
    
    zorder 100

    imagemap:

            ground "gui/quick-menu-inactive.png" 
            hover "gui/quick-menu-active.png"
            selected_idle "gui/quick-menu-selected.png"
            

            hotspot (552, 720, 148, 59) action Rollback()
            hotspot (711, 720, 177, 59) action ShowMenu('history')
            hotspot (899, 720, 146, 59) action Skip()
            hotspot (1057, 720, 150, 59) action Preference("auto-forward", "toggle")
            hotspot (1217, 720, 160, 59) action ShowMenu('load')
            hotspot (1388, 720, 160, 59) action ShowMenu('save')
            hotspot (1558, 720, 174, 59) action ShowMenu('preferences')
            

    

## This code ensures that the quick_menu screen is displayed in-game, whenever
## the player has not explicitly hidden the interface.
#init python:
#    config.overlay_screens.append("quick_menu")

default quick_menu = False
I found that there are indeed some weird things happening when changing the quick_menu variable, sometimes it changes, sometimes not. Using show screen quick_menu (or hide) seems to work, however. I did the tests here (after chosing to play the intro):

Code: Select all

    scene bg Home with fade
    show screen quick_menu
    "You just finished putting the rest of your stuff away, and have decided to relax on the nice, warm, and comfy couch."
    show Relaxed Happy at right with moveinright
    hide screen quick_menu
    pcname "*Yawn*"
    show Relaxed Blank at right
    pcname "Ugh, I can't believe I start school tomorrow..."
    show screen quick_menu
    "Your phone vibrates."
Judging by your design, the best solution would be to show it only when the say screen is present, which can be done with this code in the say screen (just below the side image code, same indentation would work). I think you should also change the default state of the quick menu to true.

Code: Select all

    # Use the quick menu.
    if say:
        use quick_menu
The problem is the quick menu shows when you use the centered character (like in the splashscreen), and apparently can't be hidden even with the hide screen thing. If you change that for text images or some other mehod, I think it would work fine.
Comunidad Ren'Py en español (Discord)
Honest Critique

Post Reply

Who is online

Users browsing this forum: Bing [Bot]