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.
I have been trying to get this code to work, but it keeps telling me that it's an invalid syntax. I just needed an image to be different everytime the relationship changed between two characters. The variables zandra_relationship and blue_relationship are values that have been defined, but the code won't work.
I would really love the help. Here's the code I'm trying to use:
if zandra_relationship > blue_relationship:
scene schoolclass3d2morningpurple
elif zandra_relationship < blue_relationship:
scene schoolclass3d2morningblue
elif zandra_relationship = blue_relationship:
scene schoolclass3d2morningred
with dissolve
But also, in your situation, you don't even need to test the last condition, because the only possible remaining condition after you tested greater than and less than is equal to, so you can in fact do:
if zandra_relationship > blue_relationship:
scene schoolclass3d2morningpurple
elif zandra_relationship < blue_relationship:
scene schoolclass3d2morningblue
else:
scene schoolclass3d2morningred
with dissolve
Else captures all remaining possibilities, so in this scenario can be used. But also make sure you remember to use == for comparison, and = for assignment.
kivik wrote: ↑Sat May 19, 2018 6:19 am
What chocochino have said.
But also, in your situation, you don't even need to test the last condition, because the only possible remaining condition after you tested greater than and less than is equal to, so you can in fact do:
if zandra_relationship > blue_relationship:
scene schoolclass3d2morningpurple
elif zandra_relationship < blue_relationship:
scene schoolclass3d2morningblue
else:
scene schoolclass3d2morningred
with dissolve
Else captures all remaining possibilities, so in this scenario can be used. But also make sure you remember to use == for comparison, and = for assignment.
Thanks so much! It works perfectly! I can't thank you enough <3