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.
-
MelloCloud
- Newbie
- Posts: 8
- Joined: Thu Dec 06, 2018 9:54 pm
-
Contact:
#1
Post
by MelloCloud » Sun Dec 01, 2019 11:41 pm
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?
-
Showsni
- Miko-Class Veteran
- Posts: 563
- Joined: Tue Jul 24, 2007 12:58 pm
-
Contact:
#2
Post
by Showsni » Mon Dec 02, 2019 12:36 am
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
-
Imperf3kt
- Lemma-Class Veteran
- Posts: 3636
- Joined: Mon Dec 14, 2015 5:05 am
- Location: Your monitor
-
Contact:
#3
Post
by Imperf3kt » Mon Dec 02, 2019 12:45 am
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
Free Android GUI - Updated occasionally
Twitter
Imperf3kt Blackjack - a WIP blackjack game for Android made using Ren'Py
Users browsing this forum: Bing [Bot], Majestic-12 [Bot]