Chapter 9: Time

§9.1. When play begins; §9.2. Awarding points; §9.3. Introducing tables: rankings; §9.4. When play ends; §9.5. Every turn; §9.6. The time of day; §9.7. Telling the time; §9.8. Approximate times, lengths of time; §9.9. Comparing and shifting times; §9.10. Calculating times; §9.11. Future events; §9.12. Actions as conditions; §9.13. The past and perfect tenses; §9.14. How many times?; §9.15. How many turns?

arrow-up-left.pngContents of Writing with Inform
arrow-left.pngChapter 8: Change
arrow-right.pngChapter 10: Scenes
arrow-down-right.pngIndexes of the examples

§9.1. When play begins

With the material from previous chapters, we are now able to set up a simulated world, to respond to the player's actions within it, and to make it change in perhaps unexpected ways.

The resulting experience can be as lively as we want to make it, but so far we have no very good ways to give it any structure: a beginning and an end, for instance, or a sense of plot. This next chapter is all about the passage of time, and it begins at the beginning.

We have already seen an example of how to write a rule which applies just once, at the start of the story:

When play begins: say "Welcome to Old Marston Grange, a country house cut off by fog."

The "when play begins" rules are checked only at the start of a story, not when a saved session is restored from disc. What happens is that these rules are followed, then the story's banner is printed, then the initial room description is printed up, and then the player is asked for a first command.


arrow-up.pngStart of Chapter 9: Time
arrow-left.pngBack to Chapter 8: Change: §8.19. Random choices of things
arrow-right.pngOnward to §9.2. Awarding points

"When play begins" is the best point to initialize any aspects of the game that are meant to change between playings. For instance, in this scenario, we would randomly select one of the other characters to be guilty of murder:

paste.png "Clueless"

The murderer is a person that varies.

When play begins:
    now the murderer is a random person who is not the player.

The Billiards Room is a room. Colonel Mustard and Professor Plum are men in the Billiards Room. Miss Scarlet and Mrs White are women in the Billiards Room.

Instead of examining the murderer:
    say "[The noun] certainly looks fiendish!"

Test me with "x mustard / x plum / x scarlet / x white".

*ExampleClueless
A murderer for the mystery is selected randomly at the beginning of the game.

"When play begins" is the best point to initialize any aspects of the game that are meant to change between playings. For instance, in this scenario, we would randomly select one of the other characters to be guilty of murder:

paste.png "Clueless"

The murderer is a person that varies.

When play begins:
    now the murderer is a random person who is not the player.

The Billiards Room is a room. Colonel Mustard and Professor Plum are men in the Billiards Room. Miss Scarlet and Mrs White are women in the Billiards Room.

Instead of examining the murderer:
    say "[The noun] certainly looks fiendish!"

Test me with "x mustard / x plum / x scarlet / x white".

"When play begins" is the best point to initialize any aspects of the game that are meant to change between playings. For instance, in this scenario, we would randomly select one of the other characters to be guilty of murder:

paste.png "Clueless"

The murderer is a person that varies.

When play begins:
    now the murderer is a random person who is not the player.

The Billiards Room is a room. Colonel Mustard and Professor Plum are men in the Billiards Room. Miss Scarlet and Mrs White are women in the Billiards Room.

Instead of examining the murderer:
    say "[The noun] certainly looks fiendish!"

Test me with "x mustard / x plum / x scarlet / x white".