"Expected menuitem -> else:"?

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
MelloCloud
Newbie
Posts: 10
Joined: Thu Dec 06, 2018 9:54 pm
Contact:

"Expected menuitem -> else:"?

#1 Post by MelloCloud »

I can't figure out how I goofed, and I couldn't find a similar answer online.

Code: Select all

label search_choice:

menu:
    "Shopping District" if searchsd == False:
        jump search_SD
    "Graveyard" if searchgy == False:
        jump search_GY
    "Park" if searchp == False:
        jump search_P
    else:
        "Deep sigh":
            jump search_Final
And everything else is fine except the "else" line. I get the error

Code: Select all

I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.


File "game/script.rpy", line 429: expected menuitem
    else:
    ^

Ren'Py Version: Ren'Py 7.0.0.196
Sun Dec 01 22:32:32 2019
Am I a dingus? Am I not using "else" correctly?

User avatar
Showsni
Miko-Class Veteran
Posts: 563
Joined: Tue Jul 24, 2007 12:58 pm
Contact:

Re: "Expected menuitem -> else:"?

#2 Post by Showsni »

The menu is expecting a choice for the player to click on; you can't just stick an else into it. If you want the option to only show if all the other options are true, you could do:

Code: Select all

menu:
    "Shopping District" if searchsd == False:
        jump search_SD
    "Graveyard" if searchgy == False:
        jump search_GY
    "Park" if searchp == False:
        jump search_P
    "Deep sigh" if searchp == True and searchsd == True and searchgy == True:
        jump search_Final

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3785
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: "Expected menuitem -> else:"?

#3 Post by Imperf3kt »

You need an 'if' before an else.

You also need to move everything (except the "label") over by four spaces, your indentation is incorrect.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

Post Reply

Who is online

Users browsing this forum: Google [Bot]