Inform 7 Home Page / Documentation
§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 use:
say "[(time) in words]"
This text substitution produces the given time written out in English sentence form. For example:
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 story played out against the clock:
When play begins: now the command prompt is "[time of day] >".
|Start of Chapter 9: Time|
|Back to §9.6. The time of day|
|Onward to §9.8. Approximate times, lengths of time|
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:
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 "[if H is less than 10]0[end if][H][if M is less than 10]0[end if][M]".