[SOLVED] Trouble with "IF, ELIF, ELSE" Conditions - Error in Syntax
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.
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.
- cubierocks
- Newbie
- Posts: 19
- Joined: Sat Nov 03, 2012 11:12 am
- Projects: An Everyday Love
- itch: hollowrosestudios
- Contact:
[SOLVED] Trouble with "IF, ELIF, ELSE" Conditions - Error in Syntax
Hi all!
Right now I'm having difficulty with correctly using the if,elif,else, conditional coding for my game. I've tried referring to tutorials, but I still can't seem to input the code correctly. Attached I have pictures of my error message, the coding it references, and the current coding I have listed.
What I'm trying to do is have a character mention their favorite lazy day food (which the user chooses), and then later in the game, depending on what they chose earlier, the character will wake up to the scent of their selected favorite lazy day food.
I've listed the variables, adjusted the true/false coding for each, but I still get a syntax error. This error is exacerbated if I adjust the colon next to the "elif,else" statements (hence the space between elif and else and the colon) - I'll get an EOF error with that.
How can I code my conditional statement correctly?
Right now I'm having difficulty with correctly using the if,elif,else, conditional coding for my game. I've tried referring to tutorials, but I still can't seem to input the code correctly. Attached I have pictures of my error message, the coding it references, and the current coding I have listed.
What I'm trying to do is have a character mention their favorite lazy day food (which the user chooses), and then later in the game, depending on what they chose earlier, the character will wake up to the scent of their selected favorite lazy day food.
I've listed the variables, adjusted the true/false coding for each, but I still get a syntax error. This error is exacerbated if I adjust the colon next to the "elif,else" statements (hence the space between elif and else and the colon) - I'll get an EOF error with that.
How can I code my conditional statement correctly?
Last edited by cubierocks on Wed Apr 07, 2021 12:45 pm, edited 1 time in total.
- Ocelot
- Eileen-Class Veteran
- Posts: 1883
- Joined: Tue Aug 23, 2016 10:35 am
- Github: MiiNiPaa
- Discord: MiiNiPaa#4384
- Contact:
Re: Trouble with "IF, ELIF, ELSE" Conditions - Error in Syntax
= is for assignment, not for equality. You nee to use == to compare two values. And a second one: you almost never want to write something == True, you just need to write if something:
< < insert Rick Cook quote here > >
-
rayminator
- Miko-Class Veteran
- Posts: 754
- Joined: Fri Feb 09, 2018 12:05 am
- Location: Canada
- Contact:
Re: Trouble with "IF, ELIF, ELSE" Conditions - Error in Syntax
with this image here remove label and remove the space and put it above label start: or on it's own file like init.rpy

- cubierocks
- Newbie
- Posts: 19
- Joined: Sat Nov 03, 2012 11:12 am
- Projects: An Everyday Love
- itch: hollowrosestudios
- Contact:
Re: Trouble with "IF, ELIF, ELSE" Conditions - Error in Syntax
I changed the placement of the variables, however, I'm still receiving the same message.
Re: Trouble with "IF, ELIF, ELSE" Conditions - Error in Syntax
'Cause you still use single equal sign to check equality. Should becubierocks wrote: ↑Wed Apr 07, 2021 11:27 amI changed the placement of the variables, however, I'm still receiving the same message.
Code: Select all
if Burger: # the same as if Burger == True:- cubierocks
- Newbie
- Posts: 19
- Joined: Sat Nov 03, 2012 11:12 am
- Projects: An Everyday Love
- itch: hollowrosestudios
- Contact:
Re: Trouble with "IF, ELIF, ELSE" Conditions - Error in Syntax
Double equal signs result in an "unexpected EOF while parsing" message.
No equal sign (straight to colon) also results in the same error.
No equal sign (straight to colon) also results in the same error.
- Ocelot
- Eileen-Class Veteran
- Posts: 1883
- Joined: Tue Aug 23, 2016 10:35 am
- Github: MiiNiPaa
- Discord: MiiNiPaa#4384
- Contact:
Re: Trouble with "IF, ELIF, ELSE" Conditions - Error in Syntax
Also there is no condition in elif statement. You might want to fix that first and check if error persist.
< < insert Rick Cook quote here > >
- cubierocks
- Newbie
- Posts: 19
- Joined: Sat Nov 03, 2012 11:12 am
- Projects: An Everyday Love
- itch: hollowrosestudios
- Contact:
Re: Trouble with "IF, ELIF, ELSE" Conditions - Error in Syntax
Ah! That's what I was getting wrong. I just needed to go straight to 'if" statements. Thank you, it works fine now!
Who is online
Users browsing this forum: Bing [Bot], Google [Bot], Ocelot