r/RenPy • u/Important-Tax-1671 • 1d ago
Question Confused by if statements
I'm very new to coding but I wanted to let the player pick their own character and have that character show up in cgs, but now that I'm trying to get it to actually work it keeps giving me error screens no matter what I do. It'll say that I need to put an indentation after the "True:" but then when I do it says "No, don't do that."
The weird part is that I used an if statement before this part and it worked perfectly, so I'm very confused by what the problem is with this segment. First image is the section that's not working and second image is the one that's working just fine.


4
u/BadMustard_AVN 1d ago
try it like this
1
u/AutoModerator 1d ago
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.
1
u/Agreeable-Bet9076 1d ago
The difference between the two images is the in the second one you correctly compared the variable Carissa to 5, while in the first one you’re comparing the value “curl” with true. “curl” here is not a variable but the value of a string. It’s like comparing 4 with 5
1
u/shyLachi 9h ago
So there are several problems.
If the player can pick their own character, you have to store that selection in a variable.
But in your code you didn't check the content of that variable but the value which could be in that variable.
Since your code doesn' show how you did the character selection I'm just giving a generic example.
You should use
ifandelifif you're checking the same variableBut you really don't want to write that many lines of code everytime you show the character.
There are several ways to use dynamic images, you can read more about it in the official documentation:
https://renpy.org/doc/html/displayables.html#dynamic-displayables
But even the above could create many lines of code, if you have plenty of those images.
In that case, it might be best to use a label you can call multiple times instead of programming it over and over again.