RB §4.1. The Passage Of Time

A story that makes heavy use of time may want to give the player a hint that time is important - and an easy way to keep track of how it's going - by adding the current time to the status line, instead of the score. To do this, we would write

When play begins: change the right hand status line to "[time of day]".

All else being equal, time passes at a rate of one minute per turn. But this need not be so: we can imagine a story where turns take much less time, or much more; or a story in which the passage of time was sometimes suspended, or one in which different actions required different amounts of time to perform.

Situation Room provides a way to print 24-hour time, while Zqlran Era 8 ★★★ implements a completely new measurement of time, for a story set on an alien world.

Uptempo and The Hang of Thursdays ★★★ speed up time's passage: turns take fifteen minutes in the former, or a quarter day in the latter.

Timeless makes certain actions instant, so that they don't count against the clock; this is sometimes useful in timed situations where the player needs to review the situation before going on with a tricky puzzle. Endurance ★★ systematically extends this idea to allow us to assign different durations to any action in the story. The Big Sainsbury's goes the opposite direction, and meticulously adds a minute to the clock for all implicit take actions, just so that the player isn't allowed to economize on moves.

An alternative approach to time is not to tell the player specifically what hour of the day it is at all, but to move from one general time period to another as it becomes appropriate - when the player has solved enough puzzles, or worked his way through enough of the plot. To this end we might use scenes representing, say, Thursday afternoon and then Thursday evening; then our scene rules, rather than the clock, would determine when Thursday afternoon stopped and Thursday evening began:

Thursday afternoon is a scene. Thursday evening is a scene.

Thursday afternoon ends when the player carries the portfolio.

Thursday evening begins when Thursday afternoon ends.
When Thursday evening begins:
    say "The great clock over St. Margaret's begins to chime 6.";

Though this gives time a loose relation to the number of turns played, it feels surprisingly realistic: players tend to think of time in a story in terms of the number of significant moves they made, while the random wandering, taking inventory, and looking at room descriptions while stuck don't make as big an impression. So advancing the story clock alongside the player's puzzle solutions or plot progress can work just as well as any stricter calculation.

See also

Passers-By, Weather and Astronomical Events for cycles of day and night scenes
Waiting, Sleeping for commands to let the player wait until a specific time or for a specific number of minutes
Clocks and Scientific Instruments for clocks that can be set to times and that have analog or digital read-outs
Timed Input for discussion of extensions allowing real-time input

Examples

142. Situation Room

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:

paste.png "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 "[if H is less than 10]0[end if][H][if M is less than 10]0[end if][M]".

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

Test me with "z".

378. The Big Sainsbury's

Implicit takes are a convenience to players; in general, we would like to avoid asking players to type any more obvious commands than strictly necessary, while allowing the computer to guess as much as it safely can.

Occasionally, though, we have designed a timed puzzle in which the player has a limited number of moves in which to accomplish his objectives. In that case, the implicit take complicates matters, because it means that a player who types

>EAT GATEAU
(first taking the gateau...)

gets away with a spare move compared to the precise but naïf dupe who types

>TAKE GATEAU
>EAT GATEAU

...and really, that doesn't seem quite fair. The way to fix this problem is to fill in the extra minute on the clock during the implicit take; and that is indeed what we do in the following example.

paste.png "The Big Sainsbury's"

Sainsbury's is a room.

The crispy duck and the Guinness steak pie are edible things in Sainsbury's.

Rule for implicitly taking something:
    follow the advance time rule;
    continue the activity.

When play begins:
    now the right hand status line is "[time of day]".

Test me with "take crispy duck / eat crispy duck / eat steak pie".

393. Uptempo

Suppose a game in which all actions take a very long time. Here's a simple implementation:

paste.png "Uptempo"

The fast time rule is listed instead of the advance time rule in the turn sequence rules.

This is the fast time rule:
    increment the turn count;
    increase the time of day by 15 minutes.

When play begins: now the right hand status line is "[time of day]".

The Temporal Hot Spot is a room.

Test me with "z / z".

This works fine as it stands, but we may run into some difficulty with it if we add scheduled events:

paste.png At 9:30 AM:
    say "Two turtles run by, almost too fast to see."

At 9:37 AM:
    say "A snail blitzes past."

At 9:42 AM:
    say "The grass grows."

At 9:50 AM:
    say "Several flowers burst open."

Time is counted forward after the schedule has already been consulted, so that only the 9:30 AM event happens between 9:30 and 9:45; the next two appear to occur between 9:45 and 10:00 AM, and the 9:50 AM event is not reported until the 10:00 AM to 10:15 wait. To get around this, we might schedule events only on the fifteen-minute mark when we want them to occur. Alternatively, we might try instead

paste.png "Uptempo"

The fast time rule is listed before the timed events rule in the turn sequence rules.

The advance time rule is not listed in the turn sequence rules.

This is the fast time rule:
    increment the turn count;
    increase the time of day by 15 minutes.

When play begins: now the right hand status line is "[time of day]".

The Temporal Hot Spot is a room.

At 9:30 AM:
    say "Two turtles run by, almost too fast to see."

At 9:37 AM:
    say "A snail blitzes past."

At 9:42 AM:
    say "The grass grows."

At 9:50 AM:
    say "Several flowers burst open."

Test me with "z / z / z / z".

This time our revised time-advancing rule is listed just before the event scheduler, not just afterwards.

409. Timeless

In a game with tight timing, it is sometimes friendliest to the player to let him LOOK and EXAMINE as much as necessary without being penalized.

paste.png "Timeless"

Examining something is acting fast. Looking is acting fast.

Now we need a rule which, just at the right moment, stops the turn sequence rulebook in the cast of our new fast-acting actions:

The take visual actions out of world rule is listed before the every turn stage rule in the turn sequence rules.

This is the take visual actions out of world rule: if acting fast, rule succeeds.

Thus the rest of the turn sequence rulebook is omitted for looking or examining: in effect, they become out-of-world actions like "saving the game". If we wanted to add, say, taking inventory to the list of instant activities, we would just need to define it as acting fast, too.

Now the scenario for testing:

When play begins:
    say "You are cornered by a pack of zombie wolves, armed only with a torch and a pair of pinking shears. This may be your last moment on earth, unless you can think fast!"

Cleft is a room. "You're backed into a cleft in the granite: behind you are only steep, high faces of stone, and before you a narrow passage."

The plural of zombie wolf is zombie wolves. A zombie wolf is a kind of animal. Four zombie wolves are in Cleft.

Rule for writing a paragraph about zombie wolves:
    say "The good news is that there isn't much space in which for the zombie wolves to attack.";
    now every zombie wolf is mentioned.

A steep high face of stone is scenery in Cleft. Understand "rock" as the stone. The description is "Now that you look more closely, there appear to be pitons driven into the rock."

Some pitons are part of the stone. The description of the pitons is "It looks as though someone else has made this ascent before."

Instead of climbing the stone, try going up. Instead of climbing the pitons, try going up.

Above the Cleft is Clifftop.

Every turn when the location is Cleft:
    say "Alas, your time has run out. The alpha wolf springs--";
    end the story.

Every turn when the location is Clifftop:
    say "After a breathless climb, you emerge at last onto the open clifftop.";
    end the story finally.

Test me with "x me / x stone / x pitons / climb pitons".

410. Endurance ★★

Here we move to a systematic way of giving different durations to different actions, including even variations on the same act -- so that for instance climbing a steep hill might take several minutes more than other going actions. We do this by setting a number, "work duration", to represent the number of minutes consumed by a given action, and then consulting a rulebook to find out how long the past turn's action should take. By default, an action will take 1 minute.

We'll start by emulating the behavior of "Uptempo": each turn we'll set the clock forward most of the way, then check to see what has changed since the last turn, print any relevant events, and only then set the clock forward the final minute. The exception is when an action is set to take no time at all; in that case, we'll skip the rest of the turn sequence rules entirely.

paste.png "Endurance"

Work duration is a number that varies.

Every turn:
    now work duration is 0;
    increment the turn count;
    follow the time allotment rules;
    if work duration is 0, rule succeeds;
    increase the time of day by (work duration minutes - 1 minute).

The time allotment rules are a rulebook.

A time allotment rule for examining or looking:
    now work duration is 0;
    rule succeeds.

A time allotment rule for going:
    now work duration is 2;
    rule succeeds.

A time allotment rule for going up:
    now work duration is 5;
    rule succeeds.

A time allotment rule for waiting:
    now work duration is 10;
    rule succeeds.

The last time allotment rule:
    now work duration is 1.

When play begins: now the right hand status line is "[time of day]".

The Quai is a room. "An attractive park at the edge of the river Aude: here you can wander among palm trees, and watch cyclists go by on the bike path; in the water there are ducks. In the cafe to your north, patrons sip their pastis; and above you is the medieval walled city and its castle."

The Cafe is north of the Quai. "A charming collection of umbrella-shaded tables, from which one can watch the river and the walls of the city beyond. The noise of traffic is only a minor distraction."

The City is above the Quai.

After going to the City:
    say "You struggle uphill for some distance...";
    continue the action.

At 9:15 AM:
    say "The bells ring out from Place Carnot."

Test me with "z / n / s / u".

183. The Hang of Thursdays ★★★

paste.png "The Hang of Thursdays"

The Stage is a room. Rule for printing the name of the stage: say "[current weekday] [current time period]" instead.

A weekday is a kind of value. The weekdays are Saturday, Sunday, Monday, Tuesday, Wednesday, Thursday, Friday. The current weekday is a weekday that varies. The current weekday is Saturday.

A time period is a kind of value. The time periods are morning, afternoon, evening, night. The current time period is a time period that varies. The current time period is afternoon.

This is the new advance time rule:
    if the current time period is less than night:
        now the current time period is the time period after the current time period;
    otherwise:
        now the current time period is morning;
        now the current weekday is the weekday after the current weekday.

Now we need to borrow from a later chapter to make these instructions apply to the passage of time:

The new advance time rule is listed instead of the advance time rule in the turn sequence rules.

Test me with "z / z / z / z / z".

260. Zqlran Era 8 ★★★

Suppose that our game takes place on an alien planet that does not follow Earth time. On this planet, we want to track time with different units. We also want time to advance in those units, and we want to be able to set a schedule of timed events.

paste.png "Zqlran Era 8"

The Barren Lavender Surface of Zql is a room. "It is late twilight on Zql. Overhead, two crescent moons, both green, mark the sluggish passage of time. A cold wind is blowing over the pale purplish ground cover, but it does not penetrate your airtight suit."

A Zqlran date is a kind of value. 14-88 specifies a Zqlran date with parts zqls and frbs. Current zqlran date is a zqlran date that varies. The current zqlran date is 8-22. Previous zqlran date is a zqlran date that varies. The previous zqlran date is 8-20.

When play begins:
    now left hand status line is "[current zqlran date], or [current zqlran date in words]".

To say (Zqlra - a Zqlran date) in words:
    say "[zqls part of Zqlra] Z, [frbs part of Zqlra] f."

Inform automatically supplies a way to say a new unit, which will look similar to the format in which we defined that unit in the first place. But we can (as shown here) create our own alternative say phrases to express the units in other ways as well.

Next, we need to meddle with time advancement so that time is tracked in Zqlran date rather than in minutes. This requires borrowing a trick from a later chapter, to replace Inform's built-in time handling with an alternative time handling rule of our own:

The Zqlran time rule is listed instead of the advance time rule in the turn sequence rules.

This is the Zqlran time rule:
    increment turn count;
    now the previous zqlran date is current zqlran date;
    increase the current zqlran date by 0-02;
    repeat through the Table of Zql Schedule:
        if era entry is greater than previous zqlran date and era entry is not greater than current zqlran date:
            say event entry;
            say paragraph break;
            blank out the whole row.

Table of Zql Schedule

era

event

8-24

"A wisp-thin cloud blows rapidly across the face of Nepenthe, the lesser of the two green moons."

8-28

"The cloud across Nepenthe clears."

Note that we could if we wished use a different device for scheduling events: this one simply prints text at scheduled eras, but we might also (for instance) make the event entry be a rule for Inform to follow, and tell Inform to carry out that rule at the scheduled time.

RB §4.2. Scripted Scenes

Sometimes we want to arrange a scene in which something goes on in the background (as though it were a movie playing) while the player goes about his business; or where a series of things has to happen before the player gets to the end.

The simplest way to arrange background events for a scene is to write the sequence of events into a table and work our way through it, printing one line per turn, until the scene runs out. Day One ★★★ does exactly this.

At other times, we want a scene to last as long as it takes the player to do something. Entrapment ★★ lets the player poke around and explore as much as he likes, but ends as soon as he has accomplished the scene's goal - which, unfortunately for him, is to get into an embarrassing situation so that another character can walk in and make fun of him. The Prague Job has a scene that requires the player to do a more specific set of tasks, but nags him and hurries him along until he's done.

Bowler Hats and Baby Geese ★★★ assumes that our story is going to be assembled with a number of scenes, some of which will need to prevent the player from leaving the location until the scene is complete: it thus defines a "restricted" property for scenes, so that all such elements of the plot will work in the same way.

For more complex sorts of scripts and schedules, it may be worth consulting the extensions.

See also

Characters Following a Script for a character whose conversation with the player is scripted to follow a pattern and then conclude

Examples

162. The Prague Job

Suppose we want to remind the player that he doesn't have all the time in the world, by starting to nag him when he's nearly, but not entirely, done going over his inventory in preparation for a job.

paste.png "The Prague Job"

A thing can be seen or unseen. A thing is usually unseen. Carry out examining: now the noun is seen.

The player carries a lockpick, a smoke bomb, a grappling hook, and a pair of gloves. The description of the lockpick is "Effective on most kinds of key locks, it is a gift from your mentor in the discipline, old Wheezy." The description of the smoke bomb is "Your last of these, so you should rely on it only when other modes of escape have vanished. It takes effect when dropped, producing a cloud of purple haze sufficient to fill a medium-sized room." The description of the grappling hook is "Good for shooting at balconies and other sorts of overhang." The gloves are wearable. The description of the gloves is "Black and shiny, with gripping material on the palms. Batman would be jealous."

The Toilet is a room. "The walls are painted an unattractive green; the fixtures are a bit old. But it is the only place in the hostel with any privacy." The Long Hallway is outside from the Toilet.

Reviewing Possessions is a scene. Reviewing Possessions begins when play begins.

Escalating Danger is a scene. Reviewing Possessions ends when Escalating Danger begins. Escalating Danger begins when preparations near completion.

To decide whether preparations near completion:
    if at least two of the things which are carried by the player are seen, yes;
    no.

When Escalating Danger begins: say "Someone pounds on the door of your hideout and yells at you in Czech."

Instead of going from the Toilet during Reviewing Possessions: say "You need to go over your equipment first, and make sure you're ready here."

Instead of going from the Toilet during Escalating Danger: say "You're not done checking over your materials."

Instead of waiting during Escalating Danger: say "There's no time to waste."

Every turn during Escalating Danger: if the time since Escalating Danger began is greater than 1 minute, say "Impatient footsteps pass your door again."

Escalating Danger ends when every thing which is carried by the player is seen. When Escalating Danger ends, say "There -- nothing damaged or torn. You're ready to go."

Mission is a scene. Mission begins when the player is in the Long Hallway. When Mission begins: end the story saying "The game is afoot"

Test me with "i / x lockpick / out / x bomb / out / x hook / x gloves / out".

155. Entrapment ★★

The power of scenes lies in their ability to watch for general conditions and move the narrative along whenever these are fulfilled. Instead of waiting for the player to do one specific thing, the game waits for the world to be in a certain condition, before moving to the next stage of the plot.

For instance, suppose we have a story in which the player has been captured for doing something inappropriate at court and is brought in to await a meeting with a palace official. We want to give the player a few minutes to stew, and we want the scene to end with him doing something mildly peculiar or embarrassing, and the official catching him in the act. So we tempt him into trying any of a number of different kooky activities, and just wait until he falls into the trap...

paste.png "Entrapment"

Waiting Suite is a room. "You find yourself in a narrow room, more cozy than is really comfortable, with dark paneling on all the walls. Underfoot is a thick carpet the color of dried blood. The head of a dragon kit is mounted on the wall."

The wood paneling is scenery in the Waiting Suite. The description is "Just the sort of ornate panels that might conceal a carved switch. You've heard all sorts of rumors about secret rooms and passages in the palace, some of which have not been opened in centuries because no one remembers how to get at them." Understand "panels" or "panel" or "panelling" as the paneling.

Instead of switching on the paneling, say "First you'll have to locate any switches or catches with a careful search."

The thick carpet is scenery in the Waiting Suite. Understand "red" or "blood" or "rug" as the carpet. The description is "A dull, unwelcoming weave, only a touch redder than the wood around you. You discern that it does not lie perfectly flat."

Instead of touching the paneling for the first time: say "You run your hands over the paneling with a methodical touch, knowing exactly what you're looking for but never quite feeling anything that gives or twists; then thump lightly, looking for hollow spaces."

Instead of touching the paneling for the second time: say "With increased vigor, you run your fingers along the borders between panels, then smack each panel sharply at the center. No luck yet, but if you keep at it, you're bound to turn up anything that's there to find."

Instead of attacking the paneling: try touching the paneling. Instead of searching the paneling: try touching the paneling. Understand "knock on [something]" or "tap [something]" or "tap on [something]" as attacking.

After touching the paneling when the player is not confident:
    say "Having polished off all the panels within easy reach, you now have to contort yourself around furniture here and crawl along the floorboards there, hitting each panel three times quite solidly before moving on.";
now the player is embarrassed.

Instead of looking under the carpet for the first time:
    say "You take a corner of the carpet and tug. The floor is sticky, so it doesn't come up on the first try."

A small table is an enterable supporter in the Waiting Suite. On the table is a copy of Dragon Pursuit Today. The description of Dragon Pursuit Today is "Full of glossy illustrations of dragons in various stages of capture, captivity, and destruction. The back of the magazine contains small black-and-white advertisements for hunting kits and the like." Some advertisements and some illustrations are part of Dragon Pursuit Today. The description of the illustrations is "You have the misfortune to look first at the photographs accompanying 'Cleaning Dragon Splanchna', and feel quite unwell." The description of the advertisements is "Mostly terse ads and phone numbers."

After looking under the table:
    say "It's quite a low table and you have to get down on your knees and poke your head underneath in order to get a good look."

After looking under the carpet:
    say "You pull again at the carpet. There is a tug, then a tearing, as the ancient fabric struggles against the fabric glue. Some of the carpet winds up in your hand and some of it remains in patchy threads adhering to the floor."

After entering the table:
    say "You climb onto the small table, noticing belatedly that you are leaving muddy footprints on its polished surface. Oh well: you can wipe them away again when you get down."

The dragon head is scenery in the Waiting Suite. Understand "kit" or "mouth" as the dragon head. The description is "Its eyes are wide with bewildered surprise; its mouth gapes, its forked tongue protrudes indignantly. From down here it looks as though there's something shiny stuck in its mouth, though you can't tell for sure." The head contains a shiny thing. The description of the shiny thing is "Intriguing but impossible to see clearly." Instead of taking the shiny thing, try searching the dragon head.

Before searching the dragon head:
    if the player is not on the table, try entering the table;
    if the player is not on the table, stop the action.

After searching the dragon head: say "You have a good look inside the dragon's mouth. There's a ball of lucite inside, propping the jaw in display position."

A person can be confident, nervous, or embarrassed. The player is confident.

Touching the paneling is embarrassing behavior. Looking under the carpet is embarrassing behavior. Entering the table is embarrassing behavior. Looking under the table is embarrassing behavior.

Instead of embarrassing behavior:
    if the player is nervous, now the player is embarrassed;
    if the player is confident:
        say "Before you can act, you hear movement from the inner office. You freeze, not quite ready to be discovered in this situation. But no one comes out, and you begin to breathe more easily.";
        now the player is nervous;
    otherwise:
        continue the action.

Causing trouble is a scene. Causing trouble begins when play begins. Causing trouble ends when the player is embarrassed. When Causing trouble ends: say "Just at this inopportune moment, you hear a throat being cleared behind you. 'We can see you now within,' says a dry voice."; end the story saying "To be continued..."

Test me with "switch paneling / touch paneling / g / g / g".

Test more with "x dragon / x shiny / search head / g".

...and this scene might lead to another, and so on.

The purpose of an open-ended scene like this might be puzzly or narrative: we might be waiting for the player to get a puzzle solved, or we might be waiting for him to fulfil some plot condition that must be met before we can go on.

159. Day One ★★★

paste.png "Day One"

Lecture is a scene. Lecture begins when play begins.

Every turn during Lecture:
    repeat through Table of Lecture Events:
        say "[event entry][paragraph break]";
        blank out the whole row;
        rule succeeds.

Here we use a table (see subsequent chapters) to keep track of all the events we wish to have occur during the course of the scene.

Table of Lecture Events
event
"'Welcome to Precolumbian Archaeology 101,' thunders Dr Freitag from the front of the class. 'Miss-- yes, you in the back. If you can't find a free seat, how are you going to find Atlantis? Sit down or leave. Now. Thank you.'"
"Freitag stands behinds his desk and lines up the pile of books there more neatly. 'It has come to my attention over previous years that there are two sorts of person who enroll in my class,' he says.

'Some of you will be members of the swim team or women's lacrosse players who have a distribution requirement to fulfill and are under the mistaken impression that archaeology must be easier than psychology. If that description applies to you, I advise you to drop the class now rather than at the midterm break. Under absolutely no circumstances will I ever sign a withdrawal form for someone who is crying at the time. Make a note of that, please.'"
"'The second sort of person,' Dr Freitag says, getting another wind. 'Yes, the second sort of person takes this class because she imagines that it is going to lead to adventure or possibly to new age encounters with dolphins.'

His eye moves over the class, lingering an especially long time on a girl in a patchwork skirt.

'You should also leave now, but since you are probably lying to yourself about the reasons you're here, you will probably not heed my warning and we will be doomed to a semester of one another's company nonetheless.'"
"'Whatever you may tell yourself, you are not here to gain a deeper understanding of the world or get in touch with yourself or experience another culture.'

He paces before the first row of desks, hammering on them one at a time. 'I know you probably wrote an admissions statement saying that that is what you hoped to do. Well, too bad. It is not inconceivable that some of you, somehow, will muddle towards a deeper understanding of something thanks to this class, but I am not holding my breath, and neither should you.'"
"Freitag takes a breath. 'No, my dear freshwomen, what you are here to do is learn facts. FACTS. Facts are unpopular in this university and, I am unhappily aware, at most of the institutions of inferior preparation from which you have come. Nonetheless, facts it will be. I will expect you to learn names. I will expect you to learn dates. I will expect you to study maps and I will expect you to produce evidence of exacting geographical knowledge on the exams. I will expect you to learn shapes of pottery and memorize masonry designs. There are no principles you can learn which are more important or more useful than a truly colossal bank of facts right there in your own head.'"
"'I do not ever want to hear that you do not need to learn things because you will be able to look them up. This is the greatest fallacy of your computer-semi-literate generation, that you can get anything out of Google if you need it. Not only is this demonstrably false, but it overlooks something phenomenally important: you only know to look for something if you already know it EXISTS. In short there is no way to fake knowledge, and I am not going to pretend there is.' He smiles in lupine fashion.

'This class is likely to be the most miserable experience of your four years in university. Clear?'"
"Everyone is silent."
"The lecture is interrupted by the shrill of a bell."

And then we define the scene so that it ends when the table runs out.

Lecture ends when the number of filled rows in the Table of Lecture Events is 0.

One advantage of this is that we can then edit the events in the scene by changing just the table; the scene will always run the right length and end on the turn when the last event occurs.

And to add a few additional details:

Instead of doing something other than waiting, looking, listening or examining during Lecture:
    say "Dr Freitag glares at you so fiercely that you are frozen into inaction."

Notice the careful phrasing of "doing something other than..." so that we do not mention the objects; if we had written "something other than listening to something...", the instead rule would match only action patterns which involved a noun. We state the rule more generally so that it will also match nounless commands such as JUMP and SING, since Freitag will probably take a dim view of those as well.

When Lecture ends:
    now Freitag is nowhere;
    say "There is a flurry of movement as your fellow students begin to put away their books. Dr Freitag makes his way to the door and is gone before anyone can ask him anything."

The Classroom is a room. Dr Freitag is a man in the Classroom. "Dr Freitag paces before the blackboard."

Test me with "listen / x dr / x me / jump / z / z / z / z / z / x dr".

160. Bowler Hats and Baby Geese ★★★

Scenes can have properties -- a fact that is very useful when it comes to writing a series of scenes that all need to act alike in some respect.

Suppose we have a plot that features a number of scripted scenes, where we need the player to stand still and wait while the events of the scene play out. One way to set this up is to create a property for such scenes -- let's call them "restricted" -- and then write a rule that keeps the player in place while the scene happens:

paste.png "Bowler Hats and Baby Geese"

Section 1 - The Procedure

A scene can be restricted or free.

Instead of going somewhere during a restricted scene:
    say "Better to stay here for the moment and find out what is going to happen next."

And now let's set up our restricted scene. In it, a clown is going to turn up wherever the player is (it doesn't matter where on the map he's gotten to at this point) and do a performance; the player will not be able to leave the area until the performance completes. We'll start with the setting:

Section 2 - The Stage and Props

The Broad Lawn is a room. "A sort of fun fair has been set up on this broad lawn, with the House as a backdrop: it's an attempt to give local children something to do during the bank holiday. In typical fashion, everyone is doing a very good job of ignoring the House itself, despite its swarthy roofline and dozens of blacked-out windows."

The House is scenery in the Broad Lawn. The description is "A cautious vagueness about the nature of the inhabitants is generally considered a good idea. They might be gods, or minor demons, or they might be aliens from space, or possibly they are embodiments of physical principles, or expressions of universal human experience, or... at any rate they can run time backward and forward so it warbles like an old cassette. And they're always about when somebody dies. Other than that, they're very good neighbors and no one has a word to say against."

Instead of entering the House:
    say "You can't go in, of course. It's not a house for people."

The Gazebo is north of the Broad Lawn. "The gazebo is sometimes used for bands, but at the moment has been appropriated for the distribution of lemonade."

The clown is a man. "A clown wearing [a list of things worn by the clown] stands nearby." The description is "He winks back at you."

The clown wears a purple polka-dot bowler hat. He carries a supply of baby geese. The description of the supply of baby geese is "Three or four. Or five. It's hard to count." Understand "goose" or "gosling" or "goslings" as the supply of baby geese.

There are some eggs. The description of the eggs is "A blur, really."

There is a Spanish omelet. The description of the Spanish omelet is "Exquisitely prepared."

...And now the scene itself:

Section 3 - The Scenes

The Clown Performance is a restricted scene. Clown Performance begins when the turn count is 3.

When Clown Performance begins:
    move the clown to the location.

Every turn during Clown Performance:
    repeat through the Table of Clowning:
        say "[event description entry][paragraph break]";
        blank out the whole row;
        stop.

When Clown Performance ends:
    now the eggs are nowhere;
    now the clown carries the omelet.

Clown Performance ends when the number of filled rows in the Table of Clowning is 0.

Table of Clowning
event description
"A clown with a purple polka-dot bowler hat strides into the vicinity and begins to juggle baby geese."
"While the clown juggles, the baby geese visibly grow older and larger. The clown becomes unnerved."
"In an attempt to resolve the problem, the clown reverses the direction of his juggling. The geese revert to goslings."
"The goslings become smaller and smaller until the clown is juggling goose eggs[replace eggs]."
"The clown throws all the eggs into the air at once and catches them in the bowler hat. He takes a bow; the audience applauds. As a final gesture, he upends his hat to release a perfectly cooked omelet."

To say replace eggs:
    now the supply of baby geese is nowhere;
    now the clown carries the eggs.

Free Time is a scene. Free Time begins when Clown Performance Ends.

Test me with "scenes / n / z/ z / look / x geese / s / x geese / x eggs / z / s".

RB §4.3. Event Scheduling

We can use a schedule of events to give some life to our environment: if we have a town setting, for instance, it makes sense for shops and libraries to open and close at set times; this is just what we find in IPA ★★.

Air Conditioning Is Standard ★★★★ has characters who follow a timed schedule of events to interact with each other, while the player mostly wanders around missing out on the action. (Sometimes life is like that.) The same effects could have been achieved with scenes instead of clock times, but there are occasions when we do want to plan our characters' behavior to the minute rather than waiting for the player to be in the right place to observe it: in a murder mystery or a time-travel story, the exact timings might be quite significant.

We may also want to add events to the schedule during play, as in

Instead of pushing the egg-timer: say "It begins to mark time."; the egg-timer clucks in four turns from now.

At the time when the egg-timer clucks: say "Cluck! Cluck! Cluck! says the egg-timer."

Similarly, we can schedule things during play to happen at a specific time of day, as shown in Hour of the Wren ★★★.

See also

Scene Changes for more things that arrive at pre-determined times
Ships, Trains and Elevators for a train that follows a schedule, carrying the player along if he is aboard

Examples

141. IPA ★★

Suppose we wanted a game set in a living town, with locations opening and closing at different times of day, and business carrying on as usual. The point might be to force the player to plan his itinerary carefully to hit the right spots at the right times; or we might be writing a more contemplative piece, where part of the enjoyment came from just watching the characters wander around doing their daily business...

paste.png "IPA"

When play begins: now the right hand status line is "[time of day]".

The time of day is 9:50 AM.

A shop is a kind of room. A shop has a time called the opening hour. The opening hour of the shop is usually 8 AM. A shop has a time called the closing hour. A shop usually has closing hour 6 PM.

Check going to a shop (called the target):
    if the time of day is before the opening hour of the target,
        say "[The target] is locked up until [the opening hour of the target]." instead.

Check going to a shop (called the target):
    if the time of day is after the closing hour of the target,
        say "[The target] has been closed since [the closing hour of the target]." instead.

Every turn when the location is a shop:
    let deadline be the closing hour of the location;
    if the deadline is before the time of day:
        let target be a random adjacent room which is not a shop;
        say "You are gently but firmly ushered out, since [the location] is closing.";
        move the player to the target.

The Strip-mall Parking Lot is a room. "Dead Christmas trees are heaped outside the bagel shop. Strips of dirty ice survive along the curb, and in the shadows of the lamp-posts. A wet, almost illegible sheet of algebra homework is plastered to the asphalt.

Pinewood Brewing Supply is at the east end of the lot."

Pinewood Brewing Supply is a shop. It is east of Parking Lot. The opening hour of Pinewood Brewing Supply is 10:00 AM. The closing hour of Pinewood Brewing Supply is 3:30 PM. "Shelves and shelves of malt and hops; large glass carboys, and plastic tubing; empty bottles; bottle-caps; bottle-labeling kits; starters for vinegar, sourdough, root beer.

A sweet malty smell hangs in the air."

Instead of going to Brewing Supply when the time of day is before the opening hour of Brewing Supply for the second time:
    say "You rattle at the door again. 'Hold your horses, for crying out loud,' yells a voice from within."

Noah's Bagels is a shop. It is north of the Parking Lot. The opening hour of Noah's Bagels is 6:00 AM. The closing hour of Noah's Bagels is 11:00 AM. "The selection has been somewhat picked over, leaving you with your choice of Pumpernickel, Asiago, or Everything."

Test me with "e / e / n / z / s / e / z / e / z / z / e".

146. Hour of the Wren ★★★

Here we allow the player to set the time at which some future event is going to happen, rather than letting the game decide. We'll need to borrow the syntax for defining new actions from a later chapter:

paste.png "Hour of the Wren"

When play begins:
    say "You more or less stumble across them in Central Park: a disparate group of people, all of different ages, sitting in a circle. They aren't talking to one another -- in fact, they seem to be trying very hard to ignore one another, like people in the waiting room of an especially embarrassing kind of doctor. You are about to go around when a woman in a grey pressed suit comes up to you. Her suit-skirt is trimmed in lavender cord, and she looks as though she might have been extremely sharp-dressed in 1944. She hands you a card."

The Circle in the Grass is a room. "No one is looking at you, except for the secretary, if that is what she is."

The player carries a card. The description of the card is "Typed: 'Active astrology - dislike your fortunes? change your stars! - make an appointment now - hour of the wren STILL AVAILABLE.'".

The time of day is 1:55 PM.

Understand "pick [time]" or "choose [time]" or "make appointment for [time]" or "make an appointment for [time]" as making an appointment for. Making an appointment for is an action applying to one time.

Carry out making an appointment for:
    say "Fate cannot be commanded more than once."

Instead of making an appointment for the time understood for the first time:
    say "You settle on [the time understood] for your appointment. The woman makes a note of it in an appointment book, which she carries in a brown paper bag. 'Excellent choice, ma'am,' she says in a low, urgent voice. 'You'll be very satisfied.'";
    stars shift at the time understood.

Understand "hour of the wren" as 2:00 PM.

At the time when stars shift:
    end the story saying "insert cataclysm here".

Test me with "x card / make appointment for hour of the wren / z / z / z / z".

354. Air Conditioning is Standard ★★★★

paste.png "Air Conditioning is Standard"

Section 1 - The Garage

A person has some text called current occupation. The current occupation of a person is usually "None".

Mood is a kind of value. The moods are bemused, bored, attentive, rapt, and blushing. A person has a mood. A person is usually attentive.

Instead of examining a person:
    now every thing is unmentioned;
    carry out the writing a paragraph about activity with the noun.

Rule for writing a paragraph about a person (called X):
    let the subsequent mention be "Name";
    if the current occupation of X is not "None":
        say "[current occupation of X]. ";
        let the subsequent mention be "He";
        if X is female, let the subsequent mention be "She";
    if X wears something unmentioned:
        if the subsequent mention is "Name", say "[The X] ";
        otherwise say "[subsequent mention] ";
        say "is wearing [a list of unmentioned things worn by X]";
        if X carries something unmentioned, say " and carrying [a list of unmentioned things carried by X]";
        say ".";
    otherwise:
        if X carries something unmentioned:
            if the subsequent mention is "Name", say "[The X] ";
            otherwise say "[subsequent mention] ";
            say " is carrying [a list of unmentioned things carried by X]."

The Garage is a room. "Above the street door is a spectacular art nouveau fanlight, wherein a stained-glass Spirit of Progress bestows the gift of Transportation on mankind.

The sun, gleaming through the hair of Progress, throws amber curls on the macadam floor."

The fanlight is scenery in the Garage. The description is "A semi-circle of stained glass as wide as the garage door, designed by Louis Comfort Tiffany himself. No expense has been spared."

The gift of Transportation is part of the fanlight. The description is "The gift of Transportation is envisioned as a cornucopia disgorging a steam locomotive. And that blue bit of glass might be the Montgolfier balloon."

The Spirit of Progress is part of the fanlight. The description is "It is part of her character to have bare shoulders like that."

The machinist is a bored man. He is in the Garage. He is wearing a grimy pair of overalls. He carries a wrench and a screwdriver. The current occupation of the machinist is "[The machinist] is making some adjustments to [the random thing which is part of the Victorian Car] with his [random thing carried by the machinist]"

The Victorian Car is a device in the Garage. A cast-iron steering wheel, a leather bucket seat, a horn, and a combustion engine are part of the Victorian Car. The seat is an enterable supporter.

Rule for writing a paragraph about a device (called X):
    let the subsequent mention be "Name";
    if the X is unmentioned:
        say "[The X] is here. ";
        let the subsequent mention be "It";
    if something is part of X:
        if the subsequent mention is "Name", say "[The X] ";
        otherwise say "[subsequent mention] ";
        say "[if a mentioned thing is part of X]also [end if]features[if a mentioned thing is part of X], in addition to [the list of mentioned things which are part of X],[end if] [a list of unmentioned things which are part of X]";
        say ".".

Rule for printing the name of the steering wheel while writing a paragraph about a person:
    say "steering wheel".

A supporter has some text called position. The position of a supporter is usually "None".

The Office is west of the Garage. The Office contains a desk. The desk has the position "A [desk] with several dozen drawers stands in the center of the room". On the desk are some papers.

After printing the name of a supporter (called X) which supports an unmentioned thing:
    now X is unmentioned.

Rule for writing a paragraph about a supporter (called X):
    let the subsequent mention be "Name";
    if the position of X is not "None":
        say "[position of X]. ";
        let the subsequent mention be "It";
    if a mentioned thing is on X:
        say "Besides [the list of mentioned things which are on X], ";
        let the subsequent mention be "it";
    if the subsequent mention is "Name", say "[The X] ";
    otherwise say "[subsequent mention] ";
    say "holds [a list of unmentioned things which are on X]."

Section 2 - Schedule

The time of day is 4:38 PM.

At 4:42 PM:
    move the machinist to the Office;
    say "The machinist wanders into the Office to get some paperwork.";
    now every thing carried by the machinist is on the desk;
    now the current occupation of the machinist is "[The machinist] rifles through [the papers] on [the desk]".

At 4:43 PM:
    move the young lady to the Garage;
    if the young lady can be seen by the player,
        say "An attractive young lady walks in from the street, and glances around as though she has never been here before."

At 4:45 PM:
    if the young lady can be seen by the player,
        say "With a not-quite-convincing air of innocence, [the young lady] happens to lean upon [the horn], which bleats loudly.";
    otherwise say "There is a honk from the Garage[if the machinist can be seen by the player]. The machinist looks up with a frown[end if].";
    now the horn is mentioned.

At 4:46 PM:
    move the machinist to the Garage;
    say "The machinist strolls from the Office into the Garage to find out what is going on.";
    now the current occupation of the machinist is "[The machinist] is chatting with [the young lady]. He seems to be demonstrating the various features of [the car], including [the random thing which is part of the car]";
    now the current occupation of the young lady is "[The young lady] is asking [the machinist] a number of questions about [the car]".

At 4:49 PM:
    if the young lady can be seen by the player, say "[The machinist] gives [the young lady] his arm to climb into [the seat].";
    move the young lady to the seat;
    now the young lady is rapt;
    now the current occupation of the young lady is "[The young lady] is turning [the steering wheel] from side to side";
    now the current occupation of the machinist is "[The machinist] is leaning on the door of [the car], pointing out features to [the young lady]";
    move the besotted expression to the machinist;
    now the machinist is wearing the besotted expression.

At 4:52 PM:
    now the sober grey gown is unbuttoned at the neck;
    if the young lady can be seen by the player, say "[The young lady] murmurs something about the wilting heat, and undoes a button or two of her gown. The machinist's expression is comical, or would be, if you weren't annoyed."

Every turn when the player is in the Garage and young lady is on the seat:
    say "You are beginning to feel a little unnecessary in this scene."

Every turn when the player is in the Office and the young lady is on the seat:
    say "There's no sound at all from the other room, not even conversation."

Before going to the Garage when the young lady is on the seat:
    now the sober grey gown is tellingly dishevelled;
    move the young lady to the Garage;
    now the young lady is blushing;
    say "There is a flurry of movement as you enter the room.";
    now the current occupation of the young lady is "[The young lady] stands near the door, tapping her foot nervously";
    now the besotted expression is nowhere;
    now the current occupation of the machinist is "[The machinist] is leaning against [the car], looking smug".

Section 3 - Initially Out of Play

The besotted expression is a wearable thing. The description is "It looks foolish, doesn't it?"

The young lady is a bemused woman. She is wearing a sober grey gown and a pair of black boots. The current occupation of the young lady is "[The young lady] is running a gloved finger along the chassis of [the victorian car]"

Before printing the name of the young lady while writing a paragraph about a person:
    say "[mood of the young lady] "

The description of the grey gown is "Something about the perfect row of tiny buttons has the wrong effect -- at any rate, it is natural to wonder how long they take to undo." The gown can be buttoned almost to the chin, unbuttoned at the neck, or tellingly dishevelled.

Rule for printing the name of the gown when writing a paragraph about a person:
    say "sober grey gown ([sober grey gown condition])"

Test me with "z / look / look / z / look / west / east / z / look / z / look / z / look / west / east".

RB §4.4. Scene Changes

In a plot that takes place over multiple locations or has several distinct scenes, we may want to move the player or change the scenery around him. Age of Steam brings a train on and off-stage as the plot requires. Meteoric ★★ similarly brings a meteor into view at a certain time of day, showing off several implementations depending on whether or not the player is supposed to be able to refer to the meteor after it has gone.

Entrevaux ★★★ constructs an organized system such that all scenes have their own lists of props and associated locations, and props are moved on and off automatically. Scene changes are also announced with a pause and a new title, such as "Chapter 2: Abduction".

Space Patrol - Stranded on Jupiter ★★ inserts an interlude in which the player's possessions and clothes are switched for new ones and the player moved to a new location - and then put back where he started from.

See also

Flashbacks for more ways to move the player from one level of reality to another

Examples

156. Age of Steam

The following source is very short and simple, yet it already feels surprisingly interesting in play, because something is going on which the player does not control but must observe. The single scene both starts and finishes.

paste.png "Age of Steam"

The Station is a room. "Eynforme Halt is a raised platform fringed with cowslip: a whistle-stop with no more than a signal and a water-tank."

The Flying Scotsman is fixed in place. "The Flying Scotsman, fastest train in the world, is now at a dead standstill."

Train Stop is a scene. Train Stop begins when the player is in the Station for the third turn. Train Stop ends when the time since Train Stop began is 3 minutes.

When Train Stop begins:
    now the Flying Scotsman is in the Station;
    say "The Flying Scotsman pulls up at the platform, to a billow of steam and hammering."

When Train Stop ends:
    now the Flying Scotsman is nowhere;
    say "The Flying Scotsman inches away, with a squeal of released brakes, gathering speed invincibly until it disappears around the hill. All is abruptly still once more."

Instead of entering the Flying Scotsman, say "Alas, the [time when Train Stop began] arrival is only to take on water, not to set down or pick up."

Test me with "z / z / z / enter flying scotsman / z / z".

119. Meteoric I and II ★★

The game below begins at half past eleven, and one turn later, it's meteor time:

paste.png "Meteoric I"

The time of day is 11:30 PM.

At 11:31 PM:
    now the meteor is in the great outdoors;
    say "A meteor streaks across the sky.".

The great outdoors is a region. The Spanish Balcony is east of the Inner Court. The Court and Balcony are in the great outdoors. Inside from the Court is the Swimming Pool.

The meteor is a backdrop. Instead of doing something to the meteor, say "The meteor is no longer visible, now nothing more than a memory."

Test me with "wait / wait / examine meteor / west / examine meteor / in / examine meteor".

Or for something a little slower-moving and with no after-image:

paste.png "Meteoric II"

The time of day is 4:30 PM.

At 4:31 PM:
    now Phobos is in the great outdoors;
    say "Phobos rises from the western horizon."
At 10:06 PM:
    now Phobos is nowhere;
    say "Phobos sets over the eastern horizon."

The great outdoors is a region. The Martian Balcony is east of the Inner Court. The Court and Balcony are in the great outdoors. Inside from the Court is the Heavy Water Swimming Pool.

Phobos is a backdrop. Instead of doing something to Phobos, say "Phobos orbits a mere 6000km above you, which is practically touching range for astronomy. On the other hand, astronomy isn't all that practical."

Test me with "wait / wait / examine phobos / west / examine phobos / in / examine phobos".

Though we should not really use Earthly time-keeping, since the Martian day is about half an hour longer than ours.

158. Space Patrol - Stranded on Jupiter! ★★

American radio adventure series of the 1950s were unobtrusively sponsored by breakfast cereals, as the following modest example demonstrates. Note that the scene-changing for the commercial break needs to know nothing about the actual programme it breaks into: if Part I were replaced with a different Space Patrol episode, Part II need not be changed at all.

paste.png "Space Patrol #57 - 1953-10-31 - Stranded on Jupiter!"

Use scoring.

Part I - Serial

Red Spot is a room. "You are in the middle of a vast red oval plain. Overhead, the thick Jovian clouds swirl menacingly, and a fine acrid dust falls instead of rain." Some acrid dust is scenery in the Red Spot. The description of the dust is "The rust-colored dust coats every surface. You've no idea how deep it goes."

Instead of going in Red Spot, say "As you once told Cadet Lucky, Jupiter's a mighty big planet, maybe bigger than Iowa. Why, the Red Spot alone stretches out almost to the horizon."

The player wears a silver uniform and rubber boots. The player carries a shovel and an Analscope. The description of the Analscope is "As you recall from Space Patrol #9 - 1952-11-29 - The Electronic Burglar, the Analscope is a device for locating buried metals. That's what guided you all the way from the orbit of Uranus. (Oh, all right, Neptune.) If only you hadn't crashed!"

The metal plate is a fixed in place container. It is openable and closed. In the metal plate is some water. The description of the metal plate is "Stamped with the distinctive logo of the previous mission."

Instead of examining the player, say "Your hair clumps together stickily, thanks to the dustfall."

Digging is an action applying to one thing. Understand "dig [something]" or "dig in [something]" as digging.

Instead of digging the dust, try looking under the dust. Instead of looking under the dust when the metal plate is not visible: move the metal plate to the location; say "You brush aside the dust underfoot and -- what were the odds? -- it turns out that you landed just where the previous landing party did, thirteen ill-fated years ago. Here is the metal plate that covers their original well.

But wait! Called by the clanging of your shovel on the plate, a band of Jovian pterodactyls swoop down to attack! You're totally defenceless! You don't have a hope! You're absolutely finished!"; increase the score by 10; move K-Klak to Red Spot.

K-Klak the Pterodactyl is an animal. "K-Klak, leader of the Jupiter Pterodactyls, menaces you. A terrifying creature of scaly wings, with a dragon's tail, K-Klak stands... about 1/8th of an inch tall." Instead of doing something to K-Klak, say "K-Klak makes a frankly panicky noise and leaps backwards, out of your way."

After opening the metal plate: increase the score by 10; say "You have found water! You're saved! K-Klak makes a (very cautiously) pleased noise. Now to find the stolen Brainograph, and track down the crook with the thick Jewish accent and his henchmen with their thick Polish accents..."; end the story finally.

The maximum score is 20.

Part II - Cereal

When play begins, say "Instant Ralstons and Regular Ralstons, the hot whole-wheat cereals in the red and white checkerboard packages present... SPACE PATROL... High adventure in the wild vast reaches of space... Missions of daring in the name of interplanetary justice... Travel into the future as Buzz Corey, Commander-in-Chief of the..."

Last score is a number that varies. Every turn: now the last score is the score.

Ralstons Ad is a scene. Ralstons Ad begins when score is not the last score. Ralstons Ad ends when the Ricechex is consumed.

Include Basic Screen Effects by Emily Short.

When Ralstons Ad begins:
    center "*** We'll be back in just a moment! ***";
    pause the game;
    strip the player;
    move the player to the Kitchen.

When Ralstons Ad ends:
    center "*** And now, back to today's exciting adventure ***";
    pause the game;
    restore the player.

Saved location is a room that varies. Locker is a container. Wardrobe is a container.

To strip the player:
    now every thing carried by the player is in the locker;
    now every thing worn by the player is in the wardrobe;
    now saved location is location.

To restore the player:
    now every thing carried by the player is in the Kitchen;
    now every thing in the locker is carried by the player;
    now every thing in the wardrobe is worn by the player;
    move the player to saved location.

The Space Patrol Kitchen is a room. "The nerve center of the Space Patrol! This is where cadets fill up with their SUPER-FUEL. North leads to the astro control room, while back south is the cargo hold." A breakfast bowl is in the Kitchen. In the bowl is Ricechex. Ricechex is edible. The Ricechex can be consumed or uneaten. The Ricechex is uneaten.

Instead of going north in Kitchen: say "[refusal to leave]". Instead of going south in Kitchen: say "[refusal to leave]".

Instead of examining the player when Ralstons Ad is happening: say "You are currently being played by a generically attractive person of about 30, with very good teeth and well-kept nails."

After eating the Ricechex: say "That's right folks, always start your day the SPACE PATROL way with a tasty bowl of Ricechex, Wheatchex or good hot Ralstons. Mmmm Mmmm. You just can't get enough of the sugary goodness in Ricechex, Wheatchex and good hot Ralstons."; now the ricechex is consumed.

Instead of tasting the Ricechex:
    say "Wow! *wolf-whistle* Man oh man oh man! Yumm-y!"

To say refusal to leave:
    repeat through Table of Refusals:
        say "[nope entry][paragraph break]";
        blank out the whole row;
        rule succeeds;
    say "You can't. Eat your Ricechex."

Table of Refusals
nope
"You can't go that way in the limited universe of this sponsored message."
"Or that way."
"You've already tried that!"
"Why would you want to walk away when you have an alluring bowl of Ricechex right here?"

Test me with "n / i / x me / x dust / dig dust".

Test ad with "n / s / n / s / n / i / x me / get bowl / taste ricechex / eat ricechex".

Test ending with "x plate / x k-klak / open plate".

Episode 57 of "Space Patrol" was actually called "Iron Eaters Of Planet X", just in case the reader feels that any of the foregoing unfairly traduces a work of thoughtful science fiction.

163. Entrevaux ★★★

For some games, it makes sense to organize the entire game around scenes rather than around locations, moving the player when a new scene begins and laying out new props.

To this end, we might extend Inform's default handling of scenes so that each scene has properties to indicate prop lists and locations, and move objects in and out of play automatically as the scenes change. For instance:

paste.png "Entrevaux"

Part 1 - Procedure

A scene has a room called the starting location.

A scene has a list of objects called the scenery props.

A scene has a list of objects called the inventory props.

The starting location is the room to which the player should be moved; scenery props are things that need to be put there when the scene begins; inventory props, things that are given to the player when the scene begins; and the description some printed text to introduce the new scene. We may still occasionally need to have recourse to special "When the Dancing-Lesson begins..." rules for individual scenes, but for the most part this allows us to set scenes up in a consistent and predictable way.

Another point that might be slightly less obvious: sometimes we want to announce a change of location to the player when the scene starts, and sometimes we don't. In particular any scene that starts "when play begins" should probably not explicitly describe the entered room, since that would duplicate the description automatically produced on the first turn of play. So we add a property to track whether any given scene should be announcing its location:

A scene can be location-silent or location-loud.

And let's say that we also want to announce each new scene as another "chapter" of the game in play, with a pause before the scene begins.

Here we include "Basic Screen Effects" because it will allow us to pause the game for a keypress, then clear the screen before each new chapter:

Include Basic Screen Effects by Emily Short.

The chapter counter is a number that varies.

First when a scene (called the current scene) which is not the Entire Game begins:
    if chapter counter is greater than 0:
        pause the game;
    increment chapter counter;
    say "[bold type]Chapter [chapter counter]: [current scene][roman type]";

Last when a scene (called the current scene) which is not the Entire Game begins:
    repeat with item running through the scenery props of the current scene:
        move the item to the starting location of the current scene;
    repeat with item running through the inventory props of the current scene:
        move the item to the player;
    if the location is not the starting location of the current scene:
        if the current scene is location-loud:
            move the player to the starting location of the current scene;
        otherwise:
            move the player to the starting location of the current scene, without printing a room description.

At the end of each scene, we strike the set and remove all the loose objects from play.

When a scene (called the current scene) ends:
    repeat with item running through things which are not fixed in place:
        if the item is not the player:
            now the item is nowhere.

Part 2 - Scenario

Entrevaux Station is a room. "The station building consists of a waiting room and a ticket-selling office so small that only one person can buy a ticket at a time. On the outside wall is a clock that runs twelve minutes late; but since the trains also run twelve minutes, give or take, behind their published schedule, this clock is helpful in establishing reasonable expectations. [paragraph break]Painted on the door is the logo of the Chemin de Fer de Provence, the only railway in France that is not part of the SNCF."

The Hillside Tower is a room. "It's very dark in here, lacking artificial lighting, but from the rough rectangular window you can see a slice of hillside and a little of the river Var."

The window is scenery in the Hillside Tower. The description is "Through it can be seen a slice of wooded hillside and exposed grey-brown cliff. You are in the southern French foothills of the Alps, and the territory is dry. The only respite is the river Var, a milky blue at this time of year, running shallowly over mud and large stones far below your window." Understand "view" or "slice of hillside" or "hillside" or "hill" or "river" or "var" or "mud" or "stones" or "large stones" as the window.

A used ticket is a thing. The description is "A piece of receipt paper indicating that you have paid the one-way fare of 9 euros from Nice. There is a hole punched through it."

A one-euro coin is a thing. The description is "It's a bimetal coin, brassy around the rim and silvery in the center. One side shows western Europe, with unusual prominence given to the UK, and the other side Leonardo da Vinci's four-armed, four-legged man having a nice stretch. It's dated 2002."

Some re-enactors are a person. "Milling about one end of the station is a crowd of medieval re-enactors." The description is "They're dressed in a somewhat aimless range of styles roughly honoring the period of 900-1500 AD. One gentleman is wearing a knobby leather cap; which is a good thing, because there is a rooster standing on his head." Understand "men" or "man" or "gentleman" or "rooster" or "reenactors" or "crowd" or "medieval" or "woman" or "women" as the re-enactors.

A kidnapper is a person. "Your kidnapper is watching you from the corner with his arms folded. You have the impression he's just marking time until someone more important arrives." The description is "He does not look at all like the kidnapping sort, but more like a sommelier at a superior restaurant: he wears a black pinstriped suit and has nicely-manicured hands."

The trolley is an enterable fixed in place container. "The 'train' on which you arrived is really just a single car, more like a trolley than a proper train." Understand "car" or "train" as the trolley. The description is "It has a glass front, so you can see ahead while riding: an innovation among trains."

Arrival is a location-silent scene. "After many days['] journey, you have arrived at last in Entrevaux, a walled medieval town now chiefly of interest to tourists and crusade re-enactors."
    The starting location of Arrival is the Entrevaux Station.
    The scenery props of Arrival are { re-enactors, trolley }.
    The inventory props of Arrival are { the used ticket, one-euro coin }.

Arrival begins when play begins. Arrival ends when the time since Arrival began is 2 minutes.

Abduction is a location-loud scene. "You check into the Hotel Vauban and sleep deeply enough; it was a long and sticky trip to get here.

Then in the middle of the night something confusing happens. You have the impression of strangers in your room, and then a searing pain, and you don't come back to yourself until midmorning of the following day..."
    The starting location of Abduction is the Hillside Tower.
    The scenery props of Abduction are { kidnapper }.

Abduction begins when Arrival ends.

Test me with "i / x re-enactors / z / z / i / x him".

RB §4.5. Flashbacks

The viewpoint character may often need to remember events long past. The easiest way to do this is with a cut-scene, in which at some relevant point we pause the story and print a long passage of text describing the memory. Because large amounts of text can be hard for the player to take in, we may want to include some pauses in the presentation of this material; this facility is provided by the Basic Screen Effects extension by Emily Short, and might work something like this:

Include Basic Screen Effects by Emily Short.

Instead of examining the photograph for the first time:
    say "This reminds you of the summer of '69...";
    wait for any key;
    say "... flashback content...";
    wait for any key.

The "pause the game" phrase in the same extension offers a more dramatic pause that also clears the screen before printing new text.

Cut-scenes are easy to implement but should be used sparingly, since players often get impatient with long uninteractive passages. A slightly more deluxe implementation might insert an interactive scene that simply happens to be set in the past, before going on with another scene set "now"; and, indeed, some IF abandons the idea of "now" entirely, presenting pieces in a non-chronological order and letting the player work out how the sequence works together.

The most challenging case to implement (though still not very hard) is the one where we remove the player from one scenario, let him play through a flashback with past possessions and clothing, and then restore him to the same situation he left, with all of the same possessions and clothing. Pine 3 ★★★ shows how to do this: the code to change the player's status is isolated at the end of the example, and might fruitfully be reused. Pine 4 ★★★ expands on the same idea by adding another flashback scene, demonstrating one that can be visited repeatedly and one that can be seen only once.

See also

Scene Changes for more uses of stripping and restoring the player
Background for other ways of introducing information that the player character already knows
Alternate Default Messages for comments on how to change the tense of an interactive scene

Examples

165. Pine 3 ★★★

paste.png "Pine"

Part 1 - The Set-up

This is mostly a repeat of what we have already seen, but for the sake of producing a playable scenario, we include it. The new material appears at Part 2.

A person can be asleep or awake. A person can be active or passive.

The Spinning Tower is a room. "A remote corner of the old castle, reserved for spinning and weaving tasks."

Sleeping Beauty is an asleep woman in the Spinning Tower. "[if asleep]Sleeping Beauty lies here, oblivious to your presence[otherwise]Sleeping Beauty stands beside you, looking [attitude][end if]." The description is "She is even more magnificent than the rumors suggested." Understand "woman" or "girl" or "princess" or "lady" as Sleeping Beauty.

Discovery is a scene. Discovery begins when play begins. Discovery ends when Sleeping Beauty is awake. Marriage Proposal is a scene. Marriage Proposal begins when Discovery ends.

When Discovery ends: say "Throughout the palace you can hear the other sounds of stirring and movement as the spell of centuries is broken."; now Beauty is passive.

Instead of waking an awake person: say "Redundant."

Instead of waking an asleep person: say "Yes, but how?"

Instead of attacking an asleep person:
now the noun is awake;
    say "[The noun] sits bolt upright. 'Hey! Ow!' So much for that true love's kiss nonsense."

Instead of kissing an asleep person:
    now the noun is awake;
    say "[The noun] slowly stirs to wakefulness!"

Instead of throwing water at an asleep person:
    now the second noun is awake;
    now the noun is nowhere;
    say "You pour out [the noun] on [the second noun].

[The second noun] wakes, shuddering. 'Agh! I had a terrible dream about drowning and then-- Hey!'"

The player carries a jug of water. Understand "pour [something] on [something]" or "splash [something] at/on [something]" as throwing it at.

Table of Conversation

topic

reply

quip

"dream/dreams/nightmare/nightmares/sleep"

"'Sleep well?' you ask solicitously.

'Not really,' she replies, edging away from you. So much for that angle."

"'Ghastly nightmares,' she remarks. You nod politely."

"marriage/love/wedding/boyfriend/beau/lover"

"'So,' you say. 'This is a little weird since we just met, but, um. Would you like to get married?'

She looks at you nervously. 'Do I have to?'"

"'I, er,' she says. 'I hope I'm not supposed to marry you or something.'"

"marriage/love/wedding/boyfriend/beau/lover"

"'I was told I was going to marry you and inherit the kingdom,' you say, apologetically. 'Would that be very bad?' This could be awkward, considering your family circumstances -- you did promise your mother that everything would be better, after this --

'Oh, it's not you -- I'm seeing someone,' she says, smiling quickly.

You try to think how to point out that it's been a hundred years since she last saw her boyfriend."

"'Do you think I could go look for someone? I'm seeing him, you see, and I think I've been... sick... for a while, so he might be worried.'

You try to think how to point out that it's been a hundred years since she last saw her boyfriend. And try not to think how awkward things would be in your family if she refuses to marry you."

"marriage/love/wedding/boyfriend/beau/lover"

"'You've been up here for a hundred years,' you say. An unpleasant thought occurs to you. 'Was your young man in the castle somewhere?'

She shakes her head mutely."

"She goes to the window and looks out at the now-fading thicket of briar. 'That took a while to grow,' she observes. 'I've been up here longer than I thought.'

You shrug, uncomfortable."

Instead of asking an awake beauty about a topic listed in the Table of Conversation:
    now Beauty is passive;
    say "[reply entry][paragraph break]";
    blank out the whole row.

Instead of telling an awake beauty about something: try asking the noun about it.

Instead of asking an asleep person about something:
    say "[The noun] snores."

Marriage Proposal ends when the number of filled rows in the Table of Conversation is 0.

Every turn during Marriage Proposal:
    if Beauty is active and Beauty is visible:
        repeat through Table of Conversation:
            say "[quip entry][paragraph break]";
            blank out the whole row;
            make no decision.

Every turn: now Beauty is active.

When Marriage Proposal ends: end the story saying "This is going to take some explaining."

So far we haven't much of a chance to affect matters and make them better. Suppose we'd like to add an element to the conversation where we're allowed to tell Beauty about past events -- and explore them a bit; and if the first retelling doesn't go quite as planned, we're allowed to revisit these scenes to hit them with a bit more emphasis.

Part 2 - Flashbacks

Instead of asking an awake beauty about a topic listed in the Table of Flashback Material:
    now Beauty is passive;
    say "[reply entry][paragraph break]".

A fact is a kind of thing. The family circumstances is a fact. A fact can be known or unknown. A fact can be current or past.

Once known, a fact remains known permanently -- this could be useful if we wanted to make some rules about how Beauty acts when she knows different information. By contrast, a fact is only "current" if it is the last thing discussed. Since a player can mention a fact over and over, he can make it "current" again and again, and thus reactivate the flashback.

Table of Flashback Material

topic

reply

"poor/poverty/family/money/mother/circumstances" or "family circumstances" or "my family/mother"

"[if family circumstances is unknown]'I wish you'd give some thought to marrying me. You see,' you say, your jaw tensing. 'I wouldn't ask if it weren't for my [family circumstances]...'[otherwise]'I don't think you fully understand the [family circumstances],' you say.[end if]"

After printing the name of a fact (called target): now the target is current; now the target is known.

This "After printing the name..." rule will be explained later in the chapter on activities; for now, it is enough to know that whenever family circumstances is mentioned in the table of flashback material, this rule will automatically be called. Now the terms under which the flashback happens:

Poverty flashback is a recurring scene. Poverty flashback begins when family circumstances is current. When poverty flashback begins: strip the player; move the player to the Woodcutter's Shack.

Note the "recurring" here: we want the player to be able to revisit this scene as needed.

The Woodcutter's Shack is a room. "Your family lives in a shack in the forest. There are holes in the roof, and in the winter the snow comes in -- rain, too, for that matter. The walls aren't very well-boarded, and don't keep out the wind, and even though you live in the middle of dense woods, you can never gather enough fuel to keep this place fully heated. And then there's the stench. Pigs wander freely in and out, and your three youngest brothers play on the floor."

Pigs are an animal in the shack. The pigs are scenery. The description is "They really are very grubby, dirty animals, but what's worse than that, the value of pigs has declined a lot over the last few decades. This is hard to explain to someone who has been out of touch with the world for a while, but keeping pigs for meat is a dubious prospect when there's less and less for them to forage on." Instead of smelling the pigs: say "They smell the way animals do, when they live among their own refuse."; increase the pity of Beauty by 2.

The brothers are a man. The description of brothers is "Hans, Franz, and Lukas. Twins and then the baby. So young, and growing up fatherless; and soon to be orphaned entirely, if your mother's health does not improve." Understand "brother" or "twin" or "twins" or "baby" or "franz" or "hans" or "lukas" as the brothers.

The untidy bed is scenery in the Shack. Mother is a woman on the untidy bed. The description of mother is "She is wasting away of a slow disease, her skin stretched tautly over bone. She hasn't been the same since your father left." On the bed is a folded letter.

The description of the letter is "Many times read over and creased, the letter explains how your father has gone away with a wealthy countess and will not return. Your mother was not able to read it herself, of course, and had to have it explained to her by the parish priest. Now she keeps it by the bed and crumples it in her fits of delirium."

Instead of kissing or touching Mother for the first time:
    say "You place a gentle kiss on her feverish brow. She looks up at you, her oldest -- yes, never mind that bit -- with a look of sincere trust and admiration.

'You'll find a way through this for us,' she says, squeezing your fingers. 'I know you will.'"; increase the pity of Beauty by 3.

Instead of kissing Mother: say "You have no more heart-rending memories of affection to recount; that one incident will have to serve, for rhetorical purposes."

Instead of waiting in the Shack: say "The wind blows sharply through the walls."

Instead of attacking someone in the Shack:
    say "Though sometimes the conditions of your life make you grouchy and impatient, you would never dream of striking a member of your own family. But from time to time you do feel the temptation."

Beauty has a number called pity. After examining something in the Woodcutter's Shack, increment the pity of Beauty. After examining mother, increase the pity of Beauty by 2. After examining the letter, increase the pity of Beauty by 3.

Poverty flashback ends when waiting or the time since poverty flashback began is five minutes.

When Poverty flashback ends:
    now family circumstances is past;
    say "...you finish describing the miserable circumstances of your home life, and allow your attention to return to the present.";
    restore the player;
    now Beauty is passive;
    if Beauty is sympathetic, say "'Oh dear!' she says. 'What a dreadful life!' She wrings her hands. 'No wonder you are eager to improve your lot...! But --' Her brow clears, a new thought occurring. 'You needn't marry me, you know! We could arrange it differently! I am certain that my father would give you a large reward, instead, and then I would not be separated from my current boyfriend!'";
    otherwise say "She makes a disgusted face, but she doesn't seem nearly so heart-wrung as you had hoped to make her. Tough audience, these modern princesses."

Definition: Beauty is sympathetic if the pity of Beauty is greater than 4.

To say attitude:
    if Beauty is sympathetic, say "distressed on your behalf";
    otherwise say "a little confused".

And the following is the same as in the Space Patrol example as well: we need a systematic way to remove the player's possessions, then put everything back when the flashback is over:

Saved location is a room that varies. Locker is a container. Wardrobe is a container.

To strip the player:
     now every thing carried by the player is in the locker;
    now every thing worn by the player is in the wardrobe;
    now saved location is location.

To restore the player:
    now every thing carried by the player is in the location;
    now every thing in the locker is carried by the player;
    now every thing in the wardrobe is worn by the player;
    move the player to saved location.

Test me with "x beauty / wake beauty / pour water on beauty / ask beauty about sleep / tell beauty about poverty / smell pigs / x mother / x letter / kiss mother / ask beauty about marriage / z / z".

Because we haven't changed the endings of the "Marriage Proposal" scene, there is still only one way for this scenario to work out; but at least now the player has the opportunity to alter Beauty's attitude a bit (or not) before the game is done.

167. Pine 4 ★★★

Suppose in addition to our pathetic little family history, we have another secret to convey to the Princess, this one a little more peculiar. She either gets it or she doesn't; once she gets it, we do not revisit that flashback, though it is still possible to keep visiting the poverty flashback.

paste.png "Pine"

Part 1 - The Set-up

A person can be asleep or awake. A person can be active or passive.

The Spinning Tower is a room. "A remote corner of the old castle, reserved for spinning and weaving tasks."

Sleeping Beauty is an asleep woman in the Spinning Tower. "[if asleep]Sleeping Beauty lies here, oblivious to your presence[otherwise]Sleeping Beauty stands beside you, looking [attitude][end if]." The description is "She is even more magnificent than the rumors suggested." Understand "woman" or "girl" or "princess" or "lady" as Sleeping Beauty.

Discovery is a scene. Discovery begins when play begins. Discovery ends when Sleeping Beauty is awake. Marriage Proposal is a scene. Marriage Proposal begins when Discovery ends.

When Discovery ends: say "Throughout the palace you can hear the other sounds of stirring and movement as the spell of centuries is broken."; now Beauty is passive.

Instead of waking an awake person: say "Redundant."

Instead of waking an asleep person: say "Yes, but how?"

Instead of waiting in the presence of an asleep person (called snorer): say "You are alone with the sound of [the snorer] snoring sonorously."

Instead of attacking an asleep person:
    now the noun is awake;
    say "[The noun] sits bolt upright. 'Hey! Ow!' So much for that true love's kiss nonsense."

Instead of kissing an asleep person:
    now the noun is awake;
    say "[The noun] slowly stirs to wakefulness!"

Instead of throwing water at an asleep person:
    now the second noun is awake;
    now the noun is nowhere;
    say "You pour out [the noun] on [the second noun].

[The second noun] wakes, shuddering. 'Agh! I had a terrible dream about drowning and then-- Hey!'"

The player carries a jug of water. Understand "pour [something] on [something]" or "splash [something] at/on [something]" as throwing it at.

Table of Conversation

topic

reply

quip

"dream/dreams/nightmare/nightmares/sleep"

"'Sleep well?' you ask solicitously.

'Not really,' she replies, edging away from you. So much for that angle."

"'Ghastly nightmares,' she remarks. You nod politely."

"marriage/love/wedding/boyfriend/beau/lover"

"'So,' you say. 'This is a little weird since we just met, but, um. Would you like to get married?'

She looks at you nervously. 'Do I have to? I mean, I'd rather not.'

Well, this could get prickly fast."

"'I, er,' she says. 'I hope I'm not supposed to marry you or something.' Uh oh."

"marriage/love/wedding/boyfriend/beau/lover"

"'I was told I was going to marry you and inherit the kingdom,' you say, apologetically. 'Would that be very bad?' This could be awkward, considering your family circumstances -- you did promise your mother that everything would be better, after this --

'Oh, it's not you -- I'm seeing someone,' she says, smiling quickly.

You try to think how to point out that it's been a hundred years since she last saw her boyfriend."

"'Do you think I could go look for someone? I'm seeing him, you see, and I think I've been... sick... for a while, so he might be worried.'

You try to think how to point out that it's been a hundred years since she last saw her boyfriend. And try not to think how awkward things would be in your family if she refuses to marry you."

"marriage/love/wedding/boyfriend/beau/lover"

"'Do you think you could consider alternatives if he's no longer interested in you?' you suggest.

She gives you the look of a wounded squirrel. 'My father might not approve of my love for the kitchen boy, but his heart is faithful and true!' she exclaims.

'Right; supposing that he's still around, I'm sure that his love won't have faded,' you say, considering your fingernails. Maybe you'd better come clean with her about your identity, after all: she might be more favorably inclined if she understood that you won't interfere in her base-born romances."

"'I don't expect you to understand,' she says in a low whisper. 'I know it is not considered proper for a princess to love -- and such a one as my William, who works in the kitchen --' Her glance dares you to laugh. '-- but I cannot marry you without telling you this truth.'

Right then. Perhaps you'd better tell her your secret, in exchange?"

"marriage/love/wedding/boyfriend/beau/lover"

"'You've been up here for a hundred years,' you say. An unpleasant thought occurs to you. 'Was your young man in the castle somewhere?'

She shakes her head mutely."

"She goes to the window and looks out at the now-fading thicket of briar. 'That took a while to grow,' she observes. 'I've been up here longer than I thought.'

You shrug, uncomfortable."

Instead of asking an awake beauty about a topic listed in the Table of Conversation when Marriage Proposal is happening:
    now Beauty is passive;
    say "[reply entry][paragraph break]";
    blank out the whole row.

Instead of telling an awake beauty about something: try asking the noun about it.

Instead of asking an asleep person about something:
    say "[The noun] snores."

Marriage Proposal ends in failure when the number of filled rows in the Table of Conversation is 0.

Every turn during Marriage Proposal:
    if Beauty is active and Beauty is visible:
        repeat through Table of Conversation:
            say "[quip entry][paragraph break]";
            blank out the whole row;
            make no decision.

When Marriage Proposal ends in failure: end the story saying "This is going to take some explaining."

Part 2 - Flashbacks

Instead of asking an awake beauty about a topic listed in the Table of Flashback Material:
    now Beauty is passive;
    say "[reply entry][paragraph break]".

A fact is a kind of thing. A fact can be known or unknown. A fact can be current or past.

The family circumstances is a fact. The secret identity is a fact. The printed name of secret identity is "secret".

Table of Flashback Material

topic

reply

"poor/poverty/family/money/mother/circumstances" or "family circumstances" or "my family/mother"

"[if family circumstances is unknown]'I wish you'd give some thought to marrying me. You see,' you say, your jaw tensing. 'I wouldn't ask if it weren't for my [family circumstances]...'[otherwise]'I don't think you fully understand the [family circumstances],' you say.[end if]"

"secret/identity/gender/girl/female/woman" or "secret identity" or "my secret" or "my secret identity" or "my gender"

"[if dramatic revelation ended in failure]'Look,' you say, trying again. 'Pay attention: I need you to understand my [secret identity].'[otherwise]You clear your throat and allow your voice to stray upward, into its natural register and out of this husky false tenor you've been affecting. 'There's, er, something you should know about my [secret identity],' you say...[end if][if dramatic revelation ended in success] She looks impatient. 'I get it, you know,' she says. 'I'm not stupid.'"

After printing the name of a fact (called target): now the target is current; now the target is known.

Poverty flashback is a recurring scene. Poverty flashback begins when family circumstances is current. When poverty flashback begins: strip the player; move the player to the Woodcutter's Shack.

The Woodcutter's Shack is a room. "Your family lives in a shack in the forest. There are holes in the roof, and in the winter the snow comes in -- rain, too, for that matter. The walls aren't very well-boarded, and don't keep out the wind, and even though you live in the middle of dense woods, you can never gather enough fuel to keep this place fully heated. And then there's the stench. Pigs wander freely in and out, and your three youngest brothers play on the floor."

Pigs are an animal in the shack. The pigs are scenery. The description is "They really are very grubby, dirty animals, but what's worse than that, the value of pigs has declined a lot over the last few decades. This is hard to explain to someone who has been out of touch with the world for a while, but keeping pigs for meat is a dubious prospect when there's less and less for them to forage on." Instead of smelling the pigs: say "They smell the way animals do, when they live among their own refuse."; increase the pity of Beauty by 2.

The brothers are a man in the shack. The brothers are scenery. The description of brothers is "Hans, Franz, and Lukas. Twins and then the baby. So young, and growing up fatherless; and soon to be orphaned entirely, if your mother's health does not improve." Understand "brother" or "twin" or "twins" or "baby" or "franz" or "hans" or "lukas" as the brothers.

The untidy bed is scenery in the Shack. Mother is a woman on the untidy bed. The description of mother is "She is wasting away of a slow disease, her skin stretched tautly over bone. She hasn't been the same since your father left." On the bed is a folded letter.

The description of the letter is "Many times read over and creased, the letter explains how your father has gone away with a wealthy countess and will not return. Your mother was not able to read it herself, of course, and had to have it explained to her by the parish priest. Now she keeps it by the bed and crumples it in her fits of delirium."

Instead of kissing or touching Mother for the first time:
    say "You place a gentle kiss on her feverish brow. She looks up at you, her oldest -- yes, never mind that bit -- with a look of sincere trust and admiration.

'You'll find a way through this for us,' she says, squeezing your fingers. 'I know you will.'"; increase the pity of Beauty by 3.

Instead of kissing Mother: say "You have no more heart-rending memories of affection to recount; that one incident will have to serve, for rhetorical purposes."

Instead of waiting in the Shack: say "The wind blows sharply through the walls."

Instead of attacking someone in the Shack:
    say "Though sometimes the conditions of your life make you grouchy and impatient, you would never dream of striking a member of your own family. But from time to time you do feel the temptation."

Beauty has a number called pity. After examining something in the Woodcutter's Shack, increment the pity of Beauty. After examining mother, increase the pity of Beauty by 2. After examining the letter, increase the pity of Beauty by 3.

Poverty flashback ends when waiting or the time since poverty flashback began is five minutes.

When Poverty flashback ends:
    now family circumstances is past;
    say "...you finish describing the miserable circumstances of your home life, and allow your attention to return to the present.";
    restore the player;
    now Beauty is passive;
    if Beauty is clever and Beauty is sympathetic:
        say "'I understand,' she says slowly. 'Yes, I do. I'll do it.' She takes a deep breath and looks at you. 'We will be king together! and your family will be royalty!'";
        end the story finally;
    otherwise:
        if Beauty is sympathetic, say "'Oh dear!' she says. 'What a dreadful life!' She wrings her hands. 'No wonder you are eager to improve your lot...! But --' Her brow clears, a new thought occurring. 'You needn't marry me, you know! We could arrange it differently! I am certain that my father would give you a large reward, instead, and then I would not be separated from my current boyfriend!'";
        otherwise say "She makes a disgusted face, but she doesn't seem nearly so heart-wrung as you had hoped to make her. Tough audience, these modern princesses."

Definition: Beauty is sympathetic if the pity of Beauty is greater than 4.

To say attitude:
    if Beauty is sympathetic, say "distressed on your behalf";
    otherwise say "a little confused".

Saved location is a room that varies. Locker is a container. Wardrobe is a container.

To strip the player:
     now every thing carried by the player is in the locker;
    now every thing worn by the player is in the wardrobe;
    now saved location is location.

To restore the player:
    now every thing carried by the player is in the location;
    now every thing in the locker is carried by the player;
    now every thing in the wardrobe is worn by the player;
    move the player to saved location.

Part 3 - The Other Secret

This time, we're waiting for the princess either to understand or not understand -- so we don't want to rerun the scene once it has happened successfully.

Beauty has a number called clue count.

Dramatic revelation is a recurring scene. Dramatic revelation begins when attempting confidence.

To decide whether attempting confidence:
    if dramatic revelation ended in success, no;
    if secret identity is current, yes;
    no.

When dramatic revelation begins:
    strip the player;
    say "You reminisce about one of the many stops on the way here: you had a long journey from your homeland, and it wasn't made any easier by your poverty, the inability to afford decent inns or plentiful food or any kind of ride along the way.";
    move the player to the Forest Clearing;
    move the pack to the player; now the player wears the trousers; now the player wears the shirt.

Forest Clearing is a room. "It's mid-autumn in your memory, the pool clear and cold, gold and red leaves floating on the surface."

The pool is scenery in the Clearing. Understand "reflection" or "surface" or "water" as the pool. "The pool is cold but beautiful, and the stopping place a welcome rest." The leaves are scenery in the clearing. The description is "Bright gold and orange and red: it's been a sharply chilly autumn, as you have reason to know in detail."

The trousers and the shirt are wearable things. The pack is a container. The pack contains ale, food, and skirt. A distraction is a kind of thing. The ale, the food, the pair of trousers, and the shirt are distractions. The description of a distraction is usually "[The item described] is not the point of this story." The shirt and the trousers are wearable. The description of the trousers is "Borrowed from your oldest brother, who is only a year younger than you. They are too long for your legs and overly snug at the hip, but no one around here pays much attention to fashion, and you're getting away with it, more or less." After examining the trousers, increment the clue count of Beauty.

Instead of examining the player during dramatic revelation:
    increment the clue count of Beauty;
    say "You cannot see yourself without reflection, but you can feel your hair loose and unbound over your shoulders."

Rule for printing the name of the skirt while taking inventory: say "one skirt you have not been able to bring yourself to part with". The description of the skirt is "Made for you by your mother, and it looks quite pretty on you. If your primary plan does not work, you may be forced to wear it again, and hope to catch a male eye... but with luck that will not be necessary." After taking inventory: increment clue count of Beauty.

Swimming is an action applying to nothing. Understand "swim" or "dive" as swimming.

Instead of swimming in the presence of the pool:
    increment clue count of Beauty;
    say "You consider going for a swim, but don't dare be caught unclad and unarmed, not here. There are too many men around, and any of them discovering you here would surely take advantage."

Instead of searching or drinking the pool:
    increment clue count of Beauty;
    say "You lean over the pool and look carefully at your reflection, your hair loose and unbound, falling around your face in waves. (That should surely give it away!)"

Instead of waiting during dramatic revelation: say "You wait for the penny to drop, for her to understand."

Dramatic revelation ends in failure when waiting or the time since dramatic revelation began is five minutes. When dramatic revelation ends in failure:
    now secret identity is past;
    restore the player;
    now Beauty is passive;
    say "She wrinkles her nose. 'I don't understand!' she says. 'What are you trying to tell me?'

    You could weep for womankind. But you don't quite dare spell it out in so many words, not when someone might come up the stair and overhear a chance revelation."

Dramatic revelation ends in success when Beauty is clever. When dramatic revelation ends in success:
    restore the player;
    now Beauty is passive;
    say "'You're -- a girl? Like me?'

'Not much like you,' you say, glancing over her petite frame and pert nose. 'But female, at any rate.'"

Definition: Beauty is clever if the clue count of Beauty is greater than 2.

And now, since we don't really want to return to the rest of the 'marriage proposal' scene once she has learned our ID:

Marriage proposal ends in distraction when Dramatic Revelation ends in success.

Compromise proposal is a scene. Compromise proposal begins when Dramatic Revelation ends in success. When Compromise Proposal begins: now Beauty is passive.

Instead of asking an awake beauty about a topic listed in the Table of Secondary Conversation when Compromise Proposal is happening:
    now Beauty is passive;
    say "[reply entry][paragraph break]";
    blank out the whole row.

Every turn during Compromise Proposal:
    if Beauty is active and Beauty is visible:
        repeat through Table of Secondary Conversation:
            say "[quip entry][paragraph break]";
            if the number of filled rows in the Table of Secondary Conversation is greater than 1, blank out the whole row;
            make no decision.

Every turn: now Beauty is active.

Notice that we moved the re-activation rule down here so that the Compromise Proposal rule would fire first. There are other more complicated ways of handling order of every turn rules than by relying on text sequence alone; but we will save that for a later chapter. For now it is sufficient to depend on the order in which the rules are declared.

Table of Secondary Conversation

topic

reply

quip

"girls/me/women/female/truth/identity"

"'Marrying me would be no interference,' you go on. 'You could carry on whatever romances you wished, without your father noticing.' (Probably. You'll let the pragmatic details of this work themselves out later, and hope that any children she has will look vaguely like you.)"

"'Girls can't rescue people.'

'Wrong,' you say, feeling a little annoyed. 'But you see why marrying me wouldn't be an interference. You could carry on whatever romances you wished, without your father even noticing.'"

"king/man"

"'If you're thinking that a woman can't be the prince -- and then king -- well, there was a woman Pope, once.'

She looks awed."

"The crease in her forehead does not go away. 'But if everyone thinks you are a man... later you would be king!'

Before she can go on, you say, 'There was a woman Pope, once. Compared to that, a woman king is nothing.'"

"decision/proposal/marriage/choice"

"'So,' you say. 'What do you think?'

[final decision]"

"Her pretty nose twitches again, which you are coming to recognize as a sign of hard mental labor. 'I think I see,' she says. [final decision]"

To say final decision:
    if Beauty is sympathetic:
        say "She considers the matter silently for some minutes, then says: 'I will do it. My beloved William will be so glad!' You imagine that William's feelings on the matter will be a tad more complex than that, but do not bother quashing her exuberance...";
        end the story finally;
    otherwise:
        say "'I still don't quite understand why you would want this so badly as to go to all that trouble,' she admits uneasily. Evidently you have not explained enough to her about the poverty of your home life."

Test me with "x beauty / pour water on beauty / ask beauty about sleep / tell beauty about poverty / smell pigs / x mother / x letter / kiss mother / ask beauty about marriage / tell beauty about identity / x me / look in water / i / z / ask beauty about marriage".

RB §4.6. Plot Management

A plot manager (sometimes called a drama manager) is a piece of the program whose job it is to plan out events so that, whatever the player does, the story advances and an interesting narrative results. The plot manager might, for instance, decide that the player has wandered around for too many scenes without making any progress, and might compensate by making something happen that gives him a new hint on his current problem. It might trigger characters to act when it thinks the story should be reaching a crisis point. It might introduce new complications when it determines that the player is running out of problems to solve.

This is a theoretically challenging field. Sophisticated plot management requires that the story make difficult guesses, such as whether the player is "stuck" and what the player is working on right now. The advantage of using such a system is that (done very well) it makes the story extremely responsive to the player's behavior, which means that he is a real agent in the unwinding of the plot. It also contributes to the replayability, since trying the story a second or third time will produce quite different outcomes. But it is procedurally difficult to design a good plot management system and it requires a huge amount of content, as well: in order for the plot manager to give the player hints, change the course of events to suit his focus, and so on, the story has to have available many, many more scenes than will ever occur in any single playing.

Fate Steps In ★★★ is only a very brief sketch in this direction, one in which the "fate" entity is trying to accomplish an end goal and, every turn, looks for ways to push the story towards that conclusion, whatever the player does.

See also

Goal-Seeking Characters for alternate ways to make characters act on their own

Examples

209. Fate Steps In ★★★

One of the nice things about before rules for actions is that they allow us to express some planning for characters other than the player: we've already seen how this works, a bit. But we could also use before rules to write plans for an abstract story-driving entity, rather than for other individual characters. This story-driver could be in charge of all the non-player characters, as well as spontaneous or natural changes in the environment, shaping the narrative around the player's behavior.

The following example is a very simple one, but the same concept could be worked out in a great deal more complexity, with all sorts of alternative procedures available to our story-manager:

paste.png "Fate Steps In"

Fate is a woman. After deciding the scope of the player: place Fate in scope. The description of Fate is "Not smiling." Instead of doing something other than examining to fate: say "As if."

Every turn: try fate tripping.

Tripping is an action applying to nothing.

Carry out someone tripping:
    if something dangerous (called the trap) is in the location:
        say "Lise chooses this moment to lick her fingers -- it's not gross, it's natural, you decide -- stand up, and head for the door. Unfortunately, her path crosses directly over [the trap]. There is a vaudevillesque moment where you try to warn or catch her; the next moment she's on the floor, looking shocked and also in quite a lot of pain. 'I'm not sure,' she says to you steadily but with unfocused gaze, 'but I think I might have broken my tailbone.'";
        end the story saying "Well, she's paying attention to you now".

Before someone tripping when the location does not contain a dangerous thing: try the person asked making a mess instead.

Making a mess is an action applying to nothing.

Carry out someone making a mess:
    let calamitous object be a random visible supporter which supports at least three things;
    if calamitous object is a supporter:
        say "[The calamitous object] tips over, spilling [the list of things on calamitous object] all over the place.";
        move the calamitous object to the location;
        now every thing on the calamitous object is in the location.

Definition: a thing is dangerous if it is not the carton and it is not the table and it is not a person.

Before someone making a mess when a safe supporter (called target) is visible:
    if Lise carries something, try Lise putting a random thing carried by Lise on the target instead.

Instead of someone making a mess when the tray is on the table:
    say "Just at that moment, a large blond man-thing in a red jacket walks more or less through you, and you come into violent contact with the table, knocking [the list of the things on the table] onto the floor.";
    now every thing on the table is in the location;
    now every thing on the tray is in the location instead.

Definition: a supporter is safe if the number of things on it is less than two.

McQuerry Dining Hall is a room.

The table is scenery in the dining hall. The table is a supporter.

Lise Fitzwallace is a woman in the Dining Hall. "Lise is at the nearest table, not apparently paying any attention to you." The description of Lise is "A capella singer, women's rugby champion, general object of attention from all genders. Unlikely to notice you unless fate smiles broadly." Lise carries a fork, a napkin, an empty glass, and a plate of half-eaten eggplant parmesan.

Report Lise putting something on something:
    say "Lise, still deep in thought, absently puts [the noun] on [the second noun]." instead.

The carrying capacity of the player is 2. The carton of chocolate milk is in the Hall. "There's a carton of milk beside you, which you set down for a moment -- but you do want it."

Instead of taking something when the player carries the tray:
    say "You've got both hands full with this tray."

The player carries the tray. On the tray is some macaroni and some overdone chicken. The macaroni and the chicken are edible. The tray is portable.

Test me with "get milk / put tray on table / get milk".

Test again with "drop tray".