This is not a recipe, but mostly a code snippet I'm using often. Is quite convenient.
Code: Select all
default day=0
default schedule=[3,7]
label start:
"Welcome to a looping game!"
label cycle:
$ day +=1
"It's day [day]."
if day in schedule:
$ lbl="event"+str(day)
call expression lbl
jump cycle
label event3:
"This is the event that happen at day 3!"
return
label event7:
"This is the event that happen at day 7!"
return
At first, we have a variable that store the actual day (turn, phase, whatever).
Then we have a list of days into wich an event will occurr (in my example, 3 and 7).
In the code, we check if the actual day value is present in that list of candidates. It's a very fast check. If the value is present, you create a string composed by the word "event" + the string version of the day number.
So, for example, day 23 will become "event23".
Now, thanks to call expression, we can call that label name we've composed.
!!NOTE: a simple 'call' doesn't work, in that given case it go search for the 'lbl' label, that doesn't exist.
'call expression' consider instead what follow as an expression to evaluate, not the actual label name.
The events have as labels the word "event" then the day into wich they happen.
Just remember to use return at the end of the event to jump back to the main routine.
EXTRA: you can have fun creating more than one schedule (maybe for night events), checks and kind of events. This could create quite a complex story.
So, for example, a list of nightly events:
Code: Select all
default nightly=[5,11]
Code: Select all
if day in nightly:
$ lbl="night"+str(day)
call expression lbl
Code: Select all
label night5:
"Before going to sleep, I want to play some more!"
return
label night11:
"A man in red ate all my cookies!"
return