The Historical Williamsburg Living Narrative depends on having an internal calendar so that days and dates may be tracked, thereby driving the narrative forward with some measure of historical accuracy. The story begins on April 20th, 1775, and what happens in the early hours of April 21st are key to the story. While Inform 7 has some built-in functionality to deal with the time of day, I haven’t found any functionality around tracking the days that pass. Specifically, I want to be assured that the day and date change when the time crosses midnight.
To deal with this, I developed a little bit of code logic to handle the passage of time from one day to the next. One of the key things I discovered about Inform 7 is that its day marker is at 4:00 AM rather than at 12:00 AM. Once that is understood, writing the code depends on a three-way conditional rather than a two-way version. The following code can be modified for your specific needs:
The code is generic, so you can alter to adjust for your needs. I’m using a version that’s only very slightly modified to meet my game needs.
If anyone has a more elegant solution (or knows of an existing Inform 7 command that might help), please drop me a line!
EDIT: I’m using time spans rather than a specific time (11:59 PM) to check the state because the player character may be asleep from before 11:59 PM to well after.