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.
-
Sakura02
- Regular
- Posts: 61
- Joined: Fri Aug 27, 2010 7:49 pm
- Projects: Ecchie Sketchy
-
Contact:
#1
Post
by Sakura02 » Sun Feb 27, 2011 8:50 pm
Ok so I have an image map which is a bulletin board with flyers on it that you can click on. I want it be so when you click on one, you get a menu item which asks if you want to confirm. However i keep getting errors with the if statements. Does thsi work or no
Code: Select all
elif result == "student":
show melonsurprised with vpunch:
xpos 150 ypos 50
hide melonnya
m "Huh student council for serious! Fer serious? Who the heck would want to do that??!"
menu:
"Yes":
jump Student_Club
"No wait ":
jump Bulletin_Board
elif result == "cook":
show melontalking with dissolve:
xpos 150 ypos 50
m "Yah! You picked my club! Awesome are you sure?"
menu:
"Yes":
jump Cooking_Club
"No wait ":
jump Bulletin_Board
What did I miss? Thnx
-
SusanTheCat
- Miko-Class Veteran
- Posts: 952
- Joined: Mon Dec 13, 2010 9:30 am
- Location: New Brunswick, Canada
-
Contact:
#2
Post
by SusanTheCat » Sun Feb 27, 2011 9:42 pm
Is that the whole snippet?
It should start with an if:
Code: Select all
if result == "student":
[blah blah blah]
elif result == "cook":
[blah blah blah]
[rest of code]
reference:
http://www.renpy.org/wiki/renpy/doc/ref ... _Statement
Susan
" It's not at all important to get it right the first time. It's vitally important to get it right the last time. "
— Andrew Hunt and David Thomas
-
SusanTheCat
- Miko-Class Veteran
- Posts: 952
- Joined: Mon Dec 13, 2010 9:30 am
- Location: New Brunswick, Canada
-
Contact:
#3
Post
by SusanTheCat » Sun Feb 27, 2011 9:42 pm
Is that the whole snippet?
It should start with an if:
Code: Select all
if result == "student":
[blah blah blah]
elif result == "cook":
[blah blah blah]
[rest of code]
reference:
http://www.renpy.org/wiki/renpy/doc/ref ... _Statement
Susan
" It's not at all important to get it right the first time. It's vitally important to get it right the last time. "
— Andrew Hunt and David Thomas
-
Sakura02
- Regular
- Posts: 61
- Joined: Fri Aug 27, 2010 7:49 pm
- Projects: Ecchie Sketchy
-
Contact:
#4
Post
by Sakura02 » Mon Feb 28, 2011 12:20 am
Thanks for the quick response. Yeah I do have an if statement at the beginning...sorry that was the ending. So what is the difference between 'if' and 'elif' ??
-
Aleema
- Lemma-Class Veteran
- Posts: 2677
- Joined: Fri May 23, 2008 2:11 pm
- Organization: happyB
- Tumblr: happybackwards
-
Contact:
#5
Post
by Aleema » Mon Feb 28, 2011 1:14 am
elif means "else if", so if the statement above it isn't true, then continue down the line until something is true.
If you want multiple things to appear if enabled, they need to all be Ifs and not Else Ifs. Because "elif" basically means "or".
Please post your errors next time, so we can find out what you're doing wrong.
-
Sakura02
- Regular
- Posts: 61
- Joined: Fri Aug 27, 2010 7:49 pm
- Projects: Ecchie Sketchy
-
Contact:
#6
Post
by Sakura02 » Mon Feb 28, 2011 8:41 pm
YES it works

Thanks. Sorry next time I'll post the whole error ^_^ I was confused about if and else statements, it's my first time using them.
Users browsing this forum: No registered users