How can I make another "Are you sure you want to quit?" 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
Nanahs
Veteran
Posts: 310
Joined: Wed Aug 22, 2018 5:50 pm
Contact:

How can I make another "Are you sure you want to quit?" screen?

#1 Post by Nanahs »

Apart from the main game, there are also "mini games" that you can play.

I wanted to add a texbutton, on the mini game label, saying "Quit".

But I wanted it to be like the "Are you sure you want to quit?". So the person can answer yes or no.

Image

I found this code on screens.

Code: Select all

screen confirm(message, yes_action, no_action):

    ## Ensure other screens do not get input while this screen is displayed.
    modal True

    zorder 200

    style_prefix "confirm"

    add "gui/overlay/confirm.png"

    frame:

        vbox:
            xalign .5
            yalign .5
            spacing 45

            label _(message):
                style "confirm_prompt"
                xalign 0.5

            hbox:
                xalign 0.5
                spacing 150

                textbutton _("Yes") action yes_action
                textbutton _("No") action no_action

    ## Right-click and escape answer "no".
    key "game_menu" action no_action
But I don't understand how I can edit this. Because I wanted to change the text (only for this textbutton) to something like "Do you want to quit your mini game?". The person wouldn't close the game totally. They'd go to main menu after chosing "yes".

Does anyone know how I can edit this?

Thanks :)

User avatar
Kia
Eileen-Class Veteran
Posts: 1040
Joined: Fri Aug 01, 2014 7:49 am
Deviantart: KiaAzad
Discord: Kia#6810
Contact:

Re: How can I make another "Are you sure you want to quit?" screen?

#2 Post by Kia »

try

Code: Select all

action Show("confirm", message="sdsdsd", yes_action=Return(), no_action=NullAction())

User avatar
Nanahs
Veteran
Posts: 310
Joined: Wed Aug 22, 2018 5:50 pm
Contact:

Re: How can I make another "Are you sure you want to quit?" screen?

#3 Post by Nanahs »

Kia wrote: Mon Dec 24, 2018 1:36 pm try

Code: Select all

action Show("confirm", message="sdsdsd", yes_action=Return(), no_action=NullAction())
Thank you so much! I'll try that! :)

Post Reply

Who is online

Users browsing this forum: No registered users