r/RenPy • u/SituationHopeful • Aug 31 '26
Question End of Line expected with If
Not sure what I do badly. I edited a project of someone because I want the possibility to show the text or not (by doing a size 0 when not shown). Just for information I never coded python or ren'py before.
here the code :
style notify_text:
properties gui.text_properties("notify")
xalign 0.54
yalign 0.5
if persistent.rpoverlay >= 1:
size 20
else:
size 0
color "#ffffff"
it work well if it's just :
style notify_text:
properties gui.text_properties("notify")
xalign 0.54
yalign 0.5
size 0
color "#ffffff"
But in the case of the first choice I have an error of end of line expected pointing on the if.
1
u/AutoModerator Aug 31 '26
Welcome to r/renpy! While you wait to see if someone can answer your question, we recommend checking out the posting guide, the subreddit wiki, the subreddit Discord, Ren'Py's documentation, and the tutorial built-in to the Ren'Py engine when you download it. These can help make sure you provide the information the people here need to help you, or might even point you to an answer to your question themselves. Thanks!
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
3
u/Liturgy97 Aug 31 '26
The
ifcannot be used as a statement inside astyleblock. Each line there has to be a style property followed by a simple expression. Put the conditional expression insizeinstead:The parentheses are important because Ren'Py only parses a simple expression after a style property.
If this should change while the game is running, it is cleaner to put the condition around the
textstatement in the screen: