Main Menu Screen "return" button Not Working

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
JaredKHAce
Newbie
Posts: 22
Joined: Thu Oct 25, 2018 2:35 pm
Contact:

Main Menu Screen "return" button Not Working

#1 Post by JaredKHAce » Thu Jun 02, 2022 4:57 pm

Hello, everyone.

I have a problem that I've been able to find the source of but am not sure of a way past it. My visual novel has different main menu screens depending on the ending you get, and they all pretty much read out like the one below:

Code: Select all

screen main_menu_0():

    ## This ensures that any other menu screen is replaced.
    tag menu

    imagemap:
        ground "main_menu.png"

    style_prefix "main_menu"

    add gui.main_menu_background

    ## This empty frame darkens the main menu.
    frame:
        background "gui/overlay/main_menu.png"

    ## The use statement includes another screen inside this one. The actual
    ## contents of the main menu are in the navigation screen.
    textbutton _("{size=45}START GAME{/size}") action Start() yalign 0.45 xalign 0.05 text_outlines [ (2, "#202020", absolute (1), 1) ] activate_sound "bellclick.mp3" hover_sound "bellhover.mp3"
    textbutton _("{size=45}LOAD GAME{/size}") action ShowMenu("load") yalign 0.55 xalign 0.05 text_outlines [ (2, "#202020", absolute (1), 1) ]  activate_sound "bellclick.mp3" hover_sound "bellhover.mp3"
    textbutton _("{size=45}SETTINGS{/size}") action ShowMenu("preferences") yalign 0.65 xalign 0.05 text_outlines [ (2, "#202020", absolute (1), 1) ] activate_sound "bellclick.mp3" hover_sound "bellhover.mp3"
    textbutton _("{size=45}QUIT GAME{/size}") action Quit(confirm=not main_menu) yalign 0.75 xalign 0.05 text_outlines [ (2, "#202020", absolute (1), 1) ] activate_sound "bellclick.mp3" hover_sound "bellhover.mp3"

    if gui.show_name:

        vbox:
            text "[config.name!t]":
                style "main_menu_title"

            text "[config.version]":
                style "main_menu_version"

transform logoin:

style main_menu_frame is empty
style main_menu_vbox is vbox
style main_menu_text is gui_text
style main_menu_title is main_menu_text
style main_menu_version is main_menu_text

style main_menu_frame:
    xsize 420
    yfill True

    background "gui/overlay/main_menu.png"

style main_menu_vbox:
    xalign 1.0
    xoffset -30
    xmaximum 1200
    yalign 1.0
    yoffset -30

style main_menu_text:
    properties gui.text_properties("main_menu", accent=True)

style main_menu_title:
    properties gui.text_properties("title")

style main_menu_version:
    properties gui.text_properties("version")
The problem is that when I click on the settings, load, or anything that opens the game menu, the return button does not respond. Image
It will respond while playing the game, so I trial-and-errored the code editing, coming to the conclusion that the "screen" menu that calls the variations of the main menu screen is most likely the problem; however, I am not sure of a better alternative to call in the main menu screens and make the return button respond while in said main menu.

Code: Select all

## Main Menu screen ############################################################
##
## Used to display the main menu when Ren'Py starts.
##
## https://www.renpy.org/doc/html/screen_special.html#main-menu

style buttonz:
    color "#f7f7f7"
    hover_color "#357EC7"

screen main_menu:
    if persistent.Tau_GoodEnd == True and persistent.Ru_GoodEnd == False and persistent.Jen_GoodEnd == False and persistent.true_end_game == False:
        use main_menu_1t
    elif persistent.Tau_GoodEnd == False and persistent.Ru_GoodEnd == False and persistent.Jen_GoodEnd == True and persistent.true_end_game == False:
        use main_menu_1j
    elif persistent.Tau_GoodEnd == False and persistent.Ru_GoodEnd == True and persistent.Jen_GoodEnd == False and persistent.true_end_game == False:
        use main_menu_1r
    elif persistent.Tau_GoodEnd == True and persistent.Ru_GoodEnd == True and persistent.Jen_GoodEnd == False and persistent.true_end_game == False:
        use main_menu_2tr
    elif persistent.Tau_GoodEnd == True and persistent.Ru_GoodEnd == False and persistent.Jen_GoodEnd == True and persistent.true_end_game == False:
        use main_menu_2tj
    elif persistent.Tau_GoodEnd == False and persistent.Ru_GoodEnd == True and persistent.Jen_GoodEnd == True and persistent.true_end_game == False:
        use main_menu_2rj
    elif persistent.Tau_GoodEnd == True and persistent.Ru_GoodEnd == True and persistent.Jen_GoodEnd == True and persistent.true_end_game == False:
        use main_menu_3
    elif persistent.Tau_GoodEnd == False and persistent.Ru_GoodEnd == True and persistent.Jen_GoodEnd == True and persistent.true_end_game == True:
        use main_menu_4
    else:
        use main_menu_0

#Main Menu change after ending
screen main_menu_0():
Through my testing, this is almost certainly the problem, and any advice or help on the matter would be greatly appreciated. All of these ending screens have been tested to work, by the way, it's just the return button on the main menu that is unresponsive. Thank you for your time, and for your help!

User avatar
m_from_space
Veteran
Posts: 302
Joined: Sun Feb 21, 2021 3:36 am
Contact:

Re: Main Menu Screen "return" button Not Working

#2 Post by m_from_space » Fri Jun 03, 2022 6:11 am

The problem is the following: The game_menu screen checks whether you are in the main_menu and sets the "Return" button according to the variable "main_menu". This will not work, if your screen is not tagged as a "menu".

Solution should be:

Code: Select all

screen main_menu:
    tag menu
    if persistent.Tau_GoodEnd == True and persistent.Ru_GoodEnd == False and persistent.Jen_GoodEnd == False and persistent.true_end_game == False:
        use main_menu_1t
    ...

JaredKHAce
Newbie
Posts: 22
Joined: Thu Oct 25, 2018 2:35 pm
Contact:

Re: Main Menu Screen "return" button Not Working

#3 Post by JaredKHAce » Mon Jun 06, 2022 8:04 pm

Thank you very much for the help! I knew it was something small. Much appreciated. :)

Post Reply

Who is online

Users browsing this forum: Google [Bot]