Page 1 of 1

"Expected menuitem -> else:"?

Posted: Sun Dec 01, 2019 11:41 pm
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?

Re: "Expected menuitem -> else:"?

Posted: Mon Dec 02, 2019 12:36 am
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

Re: "Expected menuitem -> else:"?

Posted: Mon Dec 02, 2019 12:45 am
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.