Chapter - Scheduling
[ Some episodes are really multi-part affairs, where Progue first negotiates a meeting with the player at a certain time, and then, if the player shows, the scene commences. So as not to confuse things, we schedule the second part through a table that tracks (a maximum of 2) future appointments. If it's time or almost time for a scheduled episode, new scenes won't be triggered.
When the appointed time arrives, we begin the episode; if it's a rendezvous episode, Progue should go to the appropriate spot and begin conversation automatically; if the player misses the episode, after its defined expiration time its completion rule can do stuf.
This proves useful in other ways: we have Progue call out a reminder to the player about future appointments when conversations end, for example.]
Table of Progue's Appointment Book
date | event |
an interval | an episode |
with 2 blank rows. |
To decide whether Progue has free time:
if the number of blank rows in Table of Progue's Appointment Book > 0, yes;
no.
To decide whether Progue has pending appointments:
repeat through Table of Progue's Appointment Book begin;
let moment be date entry;
if ( current interval is moment or the interval before current interval is moment ) and the episodic status of event entry is unaired, decide yes;
end repeat;
decide no.
To decide whether Progue is booked for (int - an interval):
if there is a date of int in Table of Progue's Appointment Book, yes;
no.
To decide whether Progue is booked for (ev - an episode):
if there is an event of ev in Table of Progue's Appointment Book, yes;
no.
To schedule Progue for (ev - an episode) at (int - an interval):
if the number of blank rows in Table of Progue's Appointment Book > 0 begin;
choose a blank row in Table of Progue's Appointment Book;
now date entry is int;
now event entry is ev;
if Progue is being debugged, say "// Progue: scheduled [ev] for [int].";
otherwise;
if Progue is being debugged, say "// Progue ERROR: could not schedule [ev] for [int] because appointment book is full.";
end if.
Every turn when the number of filled rows in Table of Progue's Appointment Book > 0 (this is the check Progue's appointment book rule):
if Progue is being debugged, say "// Progue: checking appointment book.";
if there is a date of current interval in Table of Progue's Appointment Book begin;
choose row with a date of current interval in Table of Progue's Appointment Book;
begin event entry;
blank out the whole row;
end if.
To unbook Progue for (ev - an episode):
choose row with an event of ev in Table of Progue's Appointment Book;
blank out the whole row.