§6.11. Waiting, Sleeping

The standard WAIT command makes time pass at the same rate that it would anyway - one minute per turn. In a game where events happen at specific times of day, though, we might want to give the player more control. Nine AM Appointment shows how to give the player a WAIT 10 MINUTES command, while Delayed Gratification lets him WAIT UNTIL a specific time of day.

Ordinarily, Inform also refuses to allow the player to SLEEP and WAKE UP: the commands exist, but have no effect. Change of Basis lets the player put himself into a sleep state in which he cannot do anything. A somewhat more interesting expansion on this idea would be to let the player sleep and have dreams; there are no examples specifically of dream states, but we might consult the examples on scenes about how to disrupt one environment and move the player to another, entirely new one.

* See Scene Changes for ways to move the player to a new environment such as a dream state


arrow-up.pngStart of Chapter 6: Commands
arrow-left.pngBack to §6.10. Entering and Exiting, Sitting and Standing
arrow-right.pngOnward to §6.12. Other Built-In Actions

*ExampleNine AM Appointment
A WAIT [number] MINUTES command which advances through an arbitrary number of turns.

Suppose we want to allow the player to go to sleep some of the time:

paste.png "Change of Basis"

A person is either awake or asleep. A person is usually awake.

The important thing to note here is that it does not work to say "the player is either asleep or awake". This is because the player is not necessarily one specific person or thing during the game: the identity of the player can be changed, as we will see later.

So if we want to make rules about the properties of the player, we should attach these rules to the "person" kind (or, if they really need to belong only to the player, to the "player-character" kind). A player-character is a kind of person.

Linear Algebra Class is a room. "The blackboard is covered with square arrangements of numbers. These are supposed to convey something to you, but mostly you're finding them soporific."

Now a few rules about changing from one state to the other:

Instead of sleeping: now the player is asleep; say "You drop off."

Instead of doing something other than waking up, waiting or sleeping when the player is asleep:
    say "Ssh! You're sleeping!"

Instead of sleeping when the player is asleep:
    say "Zzzz."

Instead of waking up when the player is asleep:
    now the player is awake;
    say "You come to suddenly, wiping drool from your lips."

Instead of doing something other than looking or sleeping when the player is awake:
    say "You'd really rather just sleep through this."

Test me with "wake up / sleep / look / z / sleep / wake up / look".

**ExampleChange of Basis
Implementing sleeping and wakeful states.

Suppose we want to allow the player to go to sleep some of the time:

paste.png "Change of Basis"

A person is either awake or asleep. A person is usually awake.

The important thing to note here is that it does not work to say "the player is either asleep or awake". This is because the player is not necessarily one specific person or thing during the game: the identity of the player can be changed, as we will see later.

So if we want to make rules about the properties of the player, we should attach these rules to the "person" kind (or, if they really need to belong only to the player, to the "player-character" kind). A player-character is a kind of person.

Linear Algebra Class is a room. "The blackboard is covered with square arrangements of numbers. These are supposed to convey something to you, but mostly you're finding them soporific."

Now a few rules about changing from one state to the other:

Instead of sleeping: now the player is asleep; say "You drop off."

Instead of doing something other than waking up, waiting or sleeping when the player is asleep:
    say "Ssh! You're sleeping!"

Instead of sleeping when the player is asleep:
    say "Zzzz."

Instead of waking up when the player is asleep:
    now the player is awake;
    say "You come to suddenly, wiping drool from your lips."

Instead of doing something other than looking or sleeping when the player is awake:
    say "You'd really rather just sleep through this."

Test me with "wake up / sleep / look / z / sleep / wake up / look".

**ExampleDelayed Gratification
A WAIT UNTIL [time] command which advances until the game clock reaches the correct hour.