Chapter 9: Time
9.7. Telling the time

Now that we have the time of day, we can of course use this value in room descriptions and the like:

The Clock Chamber is a room. "The dark chamber behind the clock face, a mill-room of gears which grind down the seconds. Through the glass you can see the reversed hands reading [the time of day]."

It seems odd, though, to read a precise numerical description of the time here: after all, it isn't a digital clock. A friendlier version would be:

The Clock Chamber is a room. "The dark chamber behind the clock face, a mill-room of gears which grind down the seconds. Through the glass you can see the reversed hands reading [the time of day in words]."

And this would produce more natural text such as "... reading twenty to nine" rather than "... reading 8:40 pm".

To reiterate an example which came up earlier, we could even work the time of day into the command prompt, which would lend the proper sense of urgency to a game played out against the clock:

When play begins: change the command prompt to "[time of day] >".


130
* Example  Situation Room
Printing the time of day in 24-hour time, as in military situations.

RB

Though Inform normally prints times in AM/PM terms, it stores the hours and minutes as 24-hour time; so, if we like, we can easily extract that information again thus:

"Situation Room"

The Situation Room is a room.

To say (relevant time - a time) as 24h time:
    let H be the hours part of relevant time;
    let M be the minutes part of relevant time;
    say "[H]:[if M is less than 10]0[end if][M]".

When play begins:
    change the time of day to 6:09 PM;
    change the right hand status line to "[time of day as 24h time]".

Test me with "z".


PreviousContentsNext