IF the scene is leaving

I’m having trouble with conditions on how to end scenes:

Just kidding.

[code]A scene can be leaving or staying.

IF is a leaving scene.

It is recurring.

Every turn:
if IF is leaving:
now IF is staying;
say “Just kidding!”;
now IF is leaving;
say “Just kidding again!”

IF begins when IF is staying. IF ends when IF is leaving.[/code]

[sub]surprisingly, this code actually works![/sub]

I just realized that I meant to call the post “IF leaving the scene.” Oh well.