How do I create a multiple outcome menu?

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
zeo1fan
Newbie
Posts: 18
Joined: Mon Aug 01, 2011 9:35 pm
Contact:

How do I create a multiple outcome menu?

#1 Post by zeo1fan » Tue Aug 02, 2011 6:12 pm

How do I do it? I already tried to make one, and it didn't work out.
Attachments
Screen shot 2011-08-02 at 6.10.39 PM.png

User avatar
babyfish
Veteran
Posts: 203
Joined: Mon Mar 07, 2011 3:57 pm
Projects: Maid of Midsummer (LifeSim)
Location: (' )< Swimming in your fishbowl, nomming on flakes.
Contact:

Re: How do I create a multiple outcome menu?

#2 Post by babyfish » Tue Aug 02, 2011 6:36 pm

The main problem I can see is your placement of labels. Your labels should be outside of the menus. Anywhere is fine, jump 'label' will find that label no matter where it is.

Furthermore, anything underneath that label should be indented.

I'm not sure if 'return' is appropriate here, unless you used call 'label' earlier in the script somewhere.
Image
(Work in progress)

(' )< -babyfish

zeo1fan
Newbie
Posts: 18
Joined: Mon Aug 01, 2011 9:35 pm
Contact:

Re: How do I create a multiple outcome menu?

#3 Post by zeo1fan » Tue Aug 02, 2011 7:15 pm

It says it can't find either label. D:

User avatar
babyfish
Veteran
Posts: 203
Joined: Mon Mar 07, 2011 3:57 pm
Projects: Maid of Midsummer (LifeSim)
Location: (' )< Swimming in your fishbowl, nomming on flakes.
Contact:

Re: How do I create a multiple outcome menu?

#4 Post by babyfish » Tue Aug 02, 2011 7:47 pm

Ah, I just noticed now that your jump 'label's, you don't refer to the right label.

try changing it to

jump choice1_yes

and

jump choice2_no
Image
(Work in progress)

(' )< -babyfish

zeo1fan
Newbie
Posts: 18
Joined: Mon Aug 01, 2011 9:35 pm
Contact:

Re: How do I create a multiple outcome menu?

#5 Post by zeo1fan » Tue Aug 02, 2011 8:14 pm

Like this?
Attachments
Screen shot 2011-08-02 at 8.14.14 PM.png

User avatar
babyfish
Veteran
Posts: 203
Joined: Mon Mar 07, 2011 3:57 pm
Projects: Maid of Midsummer (LifeSim)
Location: (' )< Swimming in your fishbowl, nomming on flakes.
Contact:

Re: How do I create a multiple outcome menu?

#6 Post by babyfish » Tue Aug 02, 2011 10:15 pm

Uh... not quite.

Code: Select all


menu:
    "Yes":
        jump choice1_yes

    "No":
        jump choice2_no
just this by itself is enough for a menu. However, you need to set up your labels somewhere. For example, you could do it like this this:

Code: Select all

menu:
    "Yes":
        jump choice1_yes

    "No":
        jump choice2_no

label choice1_yes:
    "Your choice was yes."

label choice2_no:
    "Your choice was no."

However, if you do it this way, after jumping to label choice1_yes, it will automatically go to label choice2_no, simply because the two labels are right next to eachother, unless under label choice1_yes you have a jump to another label elsewhere. Alternatively, here's a better way of doing this.

Code: Select all


label start:
    menu:
        "Yes":
            "You chose Yes."
            pass

        "No":
            "You chose No."
            pass

    "15 minutes later..."
 
Is this what you were trying to go for?
Image
(Work in progress)

(' )< -babyfish

Post Reply

Who is online

Users browsing this forum: Google [Bot], Nagibator