Welcome!
The problem here is that an image statement isn't allowed to have an if-else structure within it. I can't think of a really simple way around this myself, though I'm not too experienced with ATL.
Here's a sort of roundabout way. I encourage anyone to give better suggestions:
Code:
init:
python:
def ChooseIfTrue(condition):
if condition:
return 1.0
else:
return 0.0
def ChooseIfFalse(condition):
if condition:
return 0.0
else:
return 1.0
Code:
image cast animated:
"Character images/Mika/Mika_001.png" with fade
pause 1.5
"Character images/April/April_001.png" with fade
pause 1.5
"Character images/Ashley/Ashley_001.png" with fade
pause 1.5
"Character images/Ciel/Ciel_001.png" with fade
pause 1.5
choice ChooseIfTrue(persistent.Michelle_open):
"Character images/Michelle/Michelle_001.png" with fade
pause 1.5
choice ChooseIfFalse(persistent.Michelle_open):
pass
repeat
This makes use of the
choice statement, which is the nearest thing to if-else that I could find in ATL syntax. A series of choice blocks defines a number of choices that Ren'Py can
randomly choose from when those choice blocks are reached. You can specify a number to apply different weights to each choice. So if you have "choice 2.0" followed by "choice 1.0", then the first choice will have a 2/3 chance of being picked, and the second choice will have a 1/3 chance of being picked.
Now my idea was this: have choice 1.0 followed by choice 0.0 if persistent.Michelle_open is True, and have choice 0.0 followed by choice 1.0 is persistent.Michelle_open is False. Though choice is supposed to be a construct for randomness, a weight of 0.0 should guarantee that the other option is picked, which effectively makes this equivalent to if-else. ChooseIfTrue and ChooseIfFalse are Python functions that implement this behavior.
Also, ChooseIfTrue and ChooseIfFalse can be defined in any init-python block.