Page 1 of 1

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

Posted: Tue Nov 04, 2014 7:45 pm
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.)

Re: Go back to menu after choosing a choice?

Posted: Tue Nov 04, 2014 9:51 pm
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"

Re: Go back to menu after choosing a choice?

Posted: Tue Nov 04, 2014 10:43 pm
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!

Re: Go back to menu after choosing a choice?

Posted: Tue Nov 04, 2014 10:54 pm
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

Re: Go back to menu after choosing a choice?

Posted: Tue Nov 04, 2014 11:01 pm
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.