Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

For some reason the code doesn't think that my {if} tag exists when it Very Clearly Does?? This isn't in an extend statement, just normal narration within a label.

^ code with text tags. doesn't work with or without the {/if}, i tried


^ error i am getting

Hello! Definitely remove the {/if}, as it's automatically added internally if you have an {else} tag. Can you show the error you get if the {/if} is removed? Is it just this line in particular/does commenting out this line remove the error? Do you have other inline conditions with if/else working? Which Ren'Py version? When does the error message appear?

It's the same error without the if close tag, and seemingly just this one line (line 20 of the common route .rpy file) line is broken? (the other if-tag line I have a little bit later in the same file works perfectly)

on ren'py 8.3.2

(2 edits)

In the conditions, try using ’ ’ instead of “ “

"... [producerHomecountry], {if producerHomeContry == 'Japan'}Like most other OPhtori students {else}everything else in your text{/else}"

You technically don’t need to use the {/if} since it will work without it. However, the “ “ may be making it unclear to Ren’Py which the terminating “ is. By using single quotes (you have to use it when [somedict[‘somekey’]] or it will give a syntax error), it is clear to Ren’Py and the code which is the dialogue and which is the text tag.

The best I can guess, Ren’Py is seeing it like this:

"... [producerHomeCountry], {If producerHomeCountry == " (new line) Japan"} {else}Something{/else}"

So, the error is correct that there is no {if} for the {else} because of the double quote for Japan. By changing it to a single quote, it doesn’t interrupt that and Ren’Py sees it as one line, which then will see the {if} for the {else}.

(+1)

Oh that works. I'm a lot more used to using doublequotes in all my code so that never crossed my mind... Thanks for the help! :)

(+1)

Not a problem. :)

For example.

lw "[aidam["significantother"]]" (8.2 or 8.3 allows this)

would cause Ren’Py to give an “End of line expected” syntax error. Similar to what happening because it cannot determine where one thing begins and one thing ends. So, for anything in dialogue “ “, use single quotes. :)

(+1)

Great catch! Thanks for the help :)

Not a problem. :)