Quit Menu on the Main Menu screen [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
Eirrir
Regular
Posts: 81
Joined: Mon Feb 27, 2017 7:16 pm
Projects: Operation: Future Domination
Tumblr: Eirrir
itch: eirrir
Contact:

Quit Menu on the Main Menu screen [solved]

#1 Post by Eirrir » Tue May 09, 2017 5:30 pm

Hi all,

I couldn't find this question answered on this forum, so I thought I would ask. Is it possible to have the quit menu ("Are you sure you want to quit?" "Yes" "No") appear when I press the "esc" button on the game menu screen (where to first start/load game, etc.)? As of now, the escape button doesn't do anything on this screen, and the reason I want this function to happen is to eliminate the need of a "quit" button on my game menu screen for visual purposes. Thank you in advance! :D

EDIT: Oops I'm sorry, I mean on the "main menu." It's usually the first screen you see in a game.
Last edited by Eirrir on Wed May 10, 2017 1:59 am, edited 1 time in total.
Current VN Project:
Image
Game Development Blog

User avatar
Divona
Miko-Class Veteran
Posts: 678
Joined: Sun Jun 05, 2016 8:29 pm
Completed: The Falconers: Moonlight
Organization: Bionic Penguin
itch: bionicpenguin
Contact:

Re: Quit Menu on the Main Menu screen

#2 Post by Divona » Tue May 09, 2017 11:22 pm

Add Key interface statement to "screen main_menu()" in "screens.rpy".

Code: Select all

screen main_menu():

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

    style_prefix "main_menu"

    add gui.main_menu_background

    ## This empty frame darkens the main menu.
    frame:
        pass

    ## The use statement includes another screen inside this one. The actual
    ## contents of the main menu are in the navigation screen.
    use navigation

    ## Show quit menu when pressed ESC.
    key "K_ESCAPE" action Quit(confirm=True)

    . . .
Completed:
Image

User avatar
Eirrir
Regular
Posts: 81
Joined: Mon Feb 27, 2017 7:16 pm
Projects: Operation: Future Domination
Tumblr: Eirrir
itch: eirrir
Contact:

Re: Quit Menu on the Main Menu screen

#3 Post by Eirrir » Wed May 10, 2017 1:59 am

Divona wrote:Add Key interface statement to "screen main_menu()" in "screens.rpy".

Code: Select all

screen main_menu():

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

    style_prefix "main_menu"

    add gui.main_menu_background

    ## This empty frame darkens the main menu.
    frame:
        pass

    ## The use statement includes another screen inside this one. The actual
    ## contents of the main menu are in the navigation screen.
    use navigation

    ## Show quit menu when pressed ESC.
    key "K_ESCAPE" action Quit(confirm=True)

    . . .
Great, it works perfectly! Thank you :D
Current VN Project:
Image
Game Development Blog

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot]