Go back to menu after choosing a choice? [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
yon
Regular
Posts: 174
Joined: Tue Sep 09, 2014 5:09 pm
Projects: YDSP
Soundcloud: tetra-yon
itch: v-ual
Location: United States
Contact:

Go back to menu after choosing a choice? [SOLVED]

#1 Post by yon »

Now, I'm sure this is possible. In fact, I'm pretty sure I've seen it done somewhere in the documentation or the tutorial or something, but for the life of me I can't find it.

What I'm trying to do is give you the option to go back and choose options until you've gone through them all or gotten the right one.

Say, this is the code:

Code: Select all

    menu:
        "Choice 1":
            "right choice"
        "Choice 2":
            "wrong choice."
           #lets you choose again now
How would I go about making it so you see the menu again after clicking Choice 2?
(Preferably, I'd like to make it so Choice 2 doesn't show up again in that playthrough, but making it persistent data so it NEVER shows up again isn't what I want to do. I think I'll just add $ choice_2 = True and tell the menu to not show Choice 2 if choice_2 == True.)
Last edited by yon on Tue Nov 04, 2014 10:45 pm, edited 1 time in total.

User avatar
TheChris
Regular
Posts: 47
Joined: Sat Oct 11, 2014 9:26 pm
Projects: Stickshooter
Deviantart: innocencecanceller
Location: United States
Contact:

Re: Go back to menu after choosing a choice?

#2 Post by TheChris »

Here's what you could do:

Code: Select all

label start:
    e "zz"
    $ choice2 = False
label decision:
    if choice2:
        menu:
            "Choice 1":
                "right choice"
    else:
        menu:
            "Choice 1":
                "right choice"
            "Choice 2":
                "wrong choice."
                $ choice2 = True
                jump decision
    e "xxx"

User avatar
yon
Regular
Posts: 174
Joined: Tue Sep 09, 2014 5:09 pm
Projects: YDSP
Soundcloud: tetra-yon
itch: v-ual
Location: United States
Contact:

Re: Go back to menu after choosing a choice?

#3 Post by yon »

Here's what I wound up doing:

Code: Select all

    $ choice01 = False
    $ choice03 = False
label an_end_good_decision:
    menu:
        "01" if choice01 == False:
            $ choice01 = True
            "Wrong choice"
            jump an_end_good_decision
       
        "02":
            "Right choice"
        
        "03" if choice03 == False:
            $ choice03 = True
            "Wrong choice"
            jump an_end_good_decision
This seems to work. Thank you for your help!

User avatar
meiri
Regular
Posts: 177
Joined: Wed Jun 25, 2014 6:21 pm
Projects: Tutor Tabitha, Movement
Organization: Blue Bottlecap Games
Location: East Coast, US
Contact:

Re: Go back to menu after choosing a choice?

#4 Post by meiri »

Just for your own knowledge, you can label menus.

Code: Select all

menu an_end_good_decision:
    "01" if choice01 == False:
        $ choice01 = True
        "Wrong choice"
        jump an_end_good_decision
       
    "02":
        "Right choice"
        
    "03" if choice03 == False:
        $ choice03 = True
        "Wrong choice"
        jump an_end_good_decision
What's in a loop? A loop iterated in any other way would output as sweet.
--
Have a look at my GxG kinetic novel, Movement, if you have the chance?

User avatar
TheChris
Regular
Posts: 47
Joined: Sat Oct 11, 2014 9:26 pm
Projects: Stickshooter
Deviantart: innocencecanceller
Location: United States
Contact:

Re: Go back to menu after choosing a choice?

#5 Post by TheChris »

meiri wrote:Just for your own knowledge, you can label menus.

Code: Select all

menu an_end_good_decision:
    "01" if choice01 == False:
        $ choice01 = True
        "Wrong choice"
        jump an_end_good_decision
       
    "02":
        "Right choice"
        
    "03" if choice03 == False:
        $ choice03 = True
        "Wrong choice"
        jump an_end_good_decision
Thank you. I never knew that.

Post Reply

Who is online

Users browsing this forum: Google [Bot]