8. Change

Writing with Inform

WI §8.1 Change of values that vary

So far, what we have done in response to the player's commands amounts to little more than a few ripostes. The simulated world does change during play, as the player moves from room to room or picks up things, but all of this is happening automatically, not at our direct instruction. How then can we make the world change?

Recall that the world consists of rooms, in which are things, and that all of these have properties appropriate to their kinds. Some properties are either/or ("open" or "closed" but not both and not neither), while others have values (the "matching key" of a lockable door, for instance). Finally, we may also have created some free-standing values or "variables".

We take the last example first, as it is the simplest. Suppose we have:

"Winds of Change"
The prevailing wind is a direction that varies. The prevailing wind is northwest.
The Blasted Heath is a room. "Merely an arena for the play of witches and kings, my dear, where the [prevailing wind] wind blows."
Instead of waiting when the prevailing wind is northwest:
   say "A fresh gust of wind bowls you over.";
   now the prevailing wind is east.

The new phrase here is "now". This automatically checks that the new value is one which makes sense in the given context, so for instance it would not allow either of these:

now the prevailing wind is 25;
now the prevailing wind is the Heath;

the former being a number, and the latter a room, so that neither is a direction. Similarly, "now" will not allow constant values to be changed. So

Colour is a kind of value. The colours are blue, red and mauve.
After pulling the psychedelic lever:
   now blue is mauve.

…will result in a problem message; it's like writing "now 1 is 2". The difference between "the prevailing wind" and "blue" is that the wind was declared to be a "direction that varies", whereas blue wasn't.

WI §8.2 Changing the command prompt

The command prompt is the text printed by Inform to ask the player for another command. Ordinarily this is simply a greater-than-sign, ">", so we tend not to notice it as text at all. Internally, though, it is a variable value called "command prompt", which means we can change it.

For example, this will be a more conversational sort of prompt:

When play begins: now the command prompt is "What now? ".

Whereas this will be more up-to-the-minute and demanding:

When play begins: now the command prompt is "[time of day] >".

("Time of day" is another variable value, which is fairly self-explanatory, but will be covered in detail later on.) The prompt can be changed at any point, so can be used to indicate the current situation, or even as a sly way to introduce a sort of conversation between computer and player.

Example

113.
Combat scenario in which the player's footing and position changes from move to move, and the command prompt also changes to reflect that.

WI §8.3 Changing the status line

The status line is the black bar along the top of a story being played, which ordinarily displays the current position; in a story with scoring, it also usually shows the score and number of moves taken. Like the command prompt, it is not fixed but results from values which can be changed: the "left hand status line" and "right hand status line".

The default values are "[the player's surroundings]" for the left hand status line and "[score]/[turn count]" for the right hand status line (if there's scoring; it's blank otherwise). Score and turn count are numbers which vary in play (more about scoring later); "[the player's surroundings]" is a text substitution really intended for just this purpose:

say "[the/-- player's surroundings]"

This text substitution produces a succinct description of where the player is, be this in darkness, in a lighted room or inside an opaque container such as a large packing case. Example:

now the left hand status line is "You: [the player's surroundings]";

These make useful elements to juggle in redesigning the status line, as in the following example:

When play begins:
   now the left hand status line is
      "[the player's surroundings] / [turn count] / [score]";
   now the right hand status line is "Time: [time of day]".

The text in the right hand status line should be kept no more than 14 letters long, including any spaces. The left hand status line has more leeway, but should still be kept brief.

See Also

Awarding points for scoring.

Examples

Have the status line indicate the current region of the map.
115.
Centered ★★★
Replacing the two-part status line with one that centers only the room name at the top of the screen.

WI §8.4 Change of either/or properties

When we have an either/or property, we can set it like so:

Instead of waiting when the oaken door is closed:
   say "There is a slow, creaky click! sort of noise as the door swings open, apparently all by itself.";
   now the oaken door is open.

If it is open already, nothing changes: in any case nothing is said to the player unless we give explicit instructions to that effect, as we've done here.

Inform protects its model world from accidental damage in several ways, one of which is to ensure that things are not given properties which they are not allowed to have. So this, for instance, will not be accepted:

now the oaken door is unvisited

More subtle problems arise if it is not possible to tell, when the story is being constructed, what the object in question will be: for instance, if we try to change a randomly chosen object to be "unvisited". Inform therefore makes additional checks during play, printing up a suitable message only if the rules are violated. The net effect is that it is impossible for the oaken door ever to have the "unvisited" property.

Example

116.
An electrochromic window that becomes transparent or opaque depending on whether it is currently turned on.

WI §8.5 Change of properties with values

Changing properties with values is very similar:

now the printed name of the Closet is "Suddenly Spooky Closet"

Inform checks three different things to ensure that this change is safe to perform. Firstly, the value must be the right kind for the property in question, so this for instance would be rejected:

now the printed name of the Closet is 7

Secondly, the object in question has to be allowed to have the given property. This, for instance, would be disallowed:

now the initial appearance of the Closet is "Dusty"

(since "initial appearance" is a property which only things can have, not rooms). Finally, the object has to actually have the property, not just have the right to have that property. Thus:

now the printed name of the Closet is "Suddenly Spooky Closet"

…is only permitted if the Closet is designed with a "printed name". In fact this is certain to be true: all rooms and things automatically have a printed name, which is the short boldface description in the case of rooms, and the usual text briefly describing something in the case of things.

"Now" is a simple way to change many things in Inform, but it's cumbersome to change the map of the model world using "now", because the map is such a complicated arrangement. (It's not a property: it's a sort of mesh of relations.) So a special phrase exists to change map connections:

change (direction) exit of (room) to (room)

This phrase alters the map so that the given map connection is made. Note that connections can be made to rooms, but not doors: the positions of doors are fixed. Example:

change the east exit of the Closet to the Tsar's Imperial Dining Salon

Since "nothing" is not a room, this doesn't allow us to change the exit to nothing, so there is a separate definition of:

change the west exit of the Closet to nothing
change (direction) exit of (room) to nothing/nowhere

This phrase alters the map so that the given map connection is unmade. Example:

change the west exit of the Closet to nowhere

Altering the map itself is not a very subtle way to adjust when and where the player can move - writing suitable rules is usually a cleaner solution - so this phrase is best avoided unless really needed.

Examples

117.
Thirst
A waterskin that is depleted as the player drinks from it.
118.
A campfire added to the camp site, which can be lit using tinder.

WI §8.6 Whose property?

This seems a useful point to clarify something already seen. We normally call a property with a value something like:

the printed name of the West Ballroom

We are sometimes allowed to omit the "of the …" part, and simply call it "the printed name", for the sake of brevity. For instance, the following room description:

The West Ballroom is a room. "A handsome sweep of chequered floor beckons the eye into the [printed name]."

will result in "West Ballroom" being substituted for "[printed name]". Since the text belongs to the West Ballroom, that is assumed to be the owner of any properties named in its description. Similarly:

Instead of examining something, say "Hmm, let me see: [printed name]..."

Here the owner of the "printed name" is assumed to be the noun referred to in the action - in other words, the "something" alluded to in the rule.

WI §8.7 Moving things

We have now seen how to change the properties of rooms and things, and also any freestanding values which may have a bearing on the model world. We are not allowed to change the kind of anything during play. Our remaining freedom is to move things around. It would make no sense to move rooms around, because rooms are the fixed reference points in our geography, but anything else is mobile. This even includes things which are supposedly "fixed in place", for unlike the player, we have god-like powers. (There are minor restrictions: backdrops are trickier to move, since they are present in several rooms at once - see the next section. And doors, at the junction between two rooms, cannot be moved.)

Here is how to move something:

move (object) to (object)

This phrase moves the first-named object to the second. Example:

move the genie's lamp to Aladdin's Cave;

The first object named has to be a thing; the destination must be a room, as here, a container, a supporter, or a person. When something is moved, all its parts and contents (and all their contents, and so on) move with it. If the thing being moved is a person, then the destination is required to be a room or an enterable container. (In particular, a person cannot be carried by another person.)

Two options can be used if the object being moved is the player.

move the player to Aladdin's Cave, without printing a room description

omits the description which would otherwise be produced. A compromise is to use:

move the player to Aladdin's Cave, printing an abbreviated room description

which gives a full description if the player has never been here before, but only a brief one if it is a familiar scene. These options have no effect for any other objects being moved.

If the destination is a person, like so:

move the genie's turban to Aladdin;

then it will be carried rather than worn. We could arrange for it to be worn instead by writing

now the genie's turban is worn by Aladdin;

"Now…" is a much more flexible phrase than "move": more on this shortly.

Example

A meteor in the night sky which is visible from many rooms, so needs to be a backdrop, but which does not appear until 11:31 PM.

WI §8.8 Moving backdrops

A backdrop can be in several rooms at once. When created, its position can be given as any specific collection of rooms, or as a region, or even as "everywhere". For instance:

The Upper Cave is above the Rock Pool. The Ledge is east of the Pool.
The stream is a backdrop. It is in the Upper Cave and the Ledge.

Moving backdrops is not like moving other things, because there's no single destination. There are several possibilities:

(a) A backdrop can be moved to a region. If we define:

Lower Level is a region. The Rock Pool and the Ledge are in the Lower Level.

then we can write either of

move the stream to the Lower Level;
now the stream is in the Lower Level;

and either way, the stream is now found in the Rock Pool and the Ledge but nowhere else.

(b) A backdrop can be moved to a category of rooms:

move (object) backdrop to all (description of objects)

This phrase moves the backdrop so that it is now present in every room matching the given description. Example: If we define

A room can be wet or dry. A room is usually dry. The Rock Pool is wet.

then we can write

move the stream backdrop to all wet rooms;

This phrasing, "move the … backdrop to all …" is deliberately meant to look unlike the simpler "move … to …", to emphasise that this kind of movement is possible only for backdrops.

What then happens is that the stream is present in whichever rooms are currently wet. But the stream's position is ordinarily checked only after movements, for efficiency's sake. So if the player is in a room which suddenly changes from being dry to being wet, the stream will not magically appear (though it will be there if the player goes out and comes in again). If this is not good enough, the phrase "update backdrop positions" can be used to ensure the accuracy of all backdrop locations after a dramatic change:

update backdrop positions

This phrase runs through all backdrops in the model world and makes sure they are correctly in, or not in, the current location, so that everything appears right from the player's point of view. Example:

The Upper Cave is above the Rock Pool. The Ledge is east of the Pool. The stream is a backdrop.
When play begins:
   move the stream backdrop to all wet rooms.
A lever is in the Cave. The lever is fixed in place.
Instead of pulling the lever when the Cave is dry:
   now the Cave is wet;
   now the lever is in the Rock Pool;
   now the lever is portable;
   update backdrop positions;
   say "The old rusty lever pulls away, and the thin cave wall goes with it, so that a stream bursts into the cave, falling to the pool below."

(c) A backdrop can be moved to be either everywhere or nowhere:

After sleeping:
   say "It's a bright new day!";
   now the stars are nowhere.
After waiting:
   say "Darkness falls rapidly here.";
   now the stars are everywhere.

Example

120.
Orange Cones ★★★
Creating a traffic backdrop that appears in all road rooms except the one in which the player has laid down orange cones.

WI §8.9 Moving the player

The player is a thing, too, and can also be moved, which has the effect of instantaneous transportation, without the need for a suitable map connection to the new location. For instance, these are equivalent:

move the player to the Bodleian Library;
now the player is in the Bodleian Library;

This will ordinarily result in a room description of the Bodleian Library being printed up, but that might not always be desirable. For instance:

Instead of waiting in the Schola Maleficorum:
   say "A bored demon catches your eye (they really do have very inquisitive fingers) and throws you back out into the Antechamber.";
   move the player to the Antechamber, without printing a room description.

Thus tacking on the option "without printing a room description", remembering to add the comma, omits the description which would otherwise be produced. A compromise is to use the option "printing an abbreviated room description": this gives a full description if the player has never been here before, but only a brief one if it is a familiar scene.

The player's point of view can also be moved by shifting to another character. Suppose the story features two people, Alice and Bob, and the player at the keyboard is giving commands to Alice, and seeing everything from her point of view. The phrase:

now the player is Bob

switches the perspective so that now Bob is the one controlled by the human player, and it's Bob's point of view which counts. The human being at the keyboard may feel a sense of having jumped abruptly from place to place, but in fact neither Alice nor Bob has moved.

A change of player can sometimes cause confusing things to happen, if it takes place as part of a successful action. Suppose there's an action called "possessing", which enables the player to possess somebody else's body; and suppose the player types POSSESS ADELE. The action succeeds, so that the player moves into the mind of Adele. But that means that at the end of the action, the player is no longer the actor - that is, no longer the person who began the action; and consequently, Inform won't use the report rulebook to say what has just happened. It's a strange business, moving into another body.

Example

Multiple player characters who take turns controlling the action.

WI §8.10 Removing things from play

Some things will occasionally be in a limbo state called being "off-stage": like actors or props not needed in Act II, but perhaps to be brought back on-stage later, they wait on the sidelines. Anything created with no apparent location will start the story off-stage, as in the case of the lamp here:

Aladdin's Cave is a room. The genie's lamp is a container.

(Such things are easy to see in the World index because they are listed after all of the rooms and their contents, not belonging inside any room.) If we wanted to make this clearer to a human reader, we could add:

The lamp is nowhere.

to emphasise the point. In this context, "nowhere" means "in no room". Moving the lamp onto the stage-set, so to speak, is easy:

now the lamp is in the Cave;

or perhaps:

now the player is carrying the lamp;

and we can whisk it away again like so:

now the lamp is nowhere;

(We can't say "now the lamp is somewhere" because that's too vague about exactly where it is.) In older builds of Inform, the usual thing was to write "remove the lamp from play", but that's now a deprecated phrase: better to use "nowhere" instead.

remove (object) from play

Removes the given object from play, so that it is not present in any room. We are not permitted to remove rooms, or doors, or the player, from play; but we are permitted to remove backdrops, making them disappear from all rooms in which they are present. Example:

remove the gold coin from play;

We can test whether something is on-stage or off-stage with:

if the gold coin is somewhere, ...
if the gold coin is nowhere, ...

Inform also understands two adjectives for this:

if the gold coin is on-stage, ...
if the gold coin is off-stage, ...

Because these are adjectives, they can be used in a few ways which "nowhere" and "somewhere" can't, such as:

say "Ah, so many absent friends. Who now remembers [list of off-stage people]?"

Note that "on-stage" and "off-stage" apply only to things. Rooms, directions and regions are the stage itself: so it makes no sense to ask the question of whether they are "on-" or "off-". Doors are always on-stage; a backdrop, say "the sky", is always on-stage unless it has been taken off by writing something like "now the sky is nowhere".

Examples

A potion that the player can drink.
A character who sulks over objects that the player has broken (and which are now off-stage).
124.
A supply of red pens from which the player can take another pen only if he doesn't already have one somewhere in the game world.

WI §8.11 Now...

"Now" has already appeared several times in this chapter, being used like a Swiss army knife to change values of all kinds:

now the score is 100;

In fact, "now" is by far the most flexible phrase known to Inform.

now (a condition)

This phrase makes the condition become true. Examples:

now the score is 100;
now the player is Kevin;
now the front door is open;
now Mr Darcy is wearing the top hat;
now all the doors are open;
now all of the things in the sack are in the box;

Inform issues a problem message if the condition asks to do the impossible ("now 3 is an even number") or is vague ("now the duck is not in the Lily Pond") or not in the present tense ("now the front door had been open").

We've now seen all three things which can be done with a condition S which describes the world:

S. - The relation holds at the start of play.
if S, ...; - Does the relation hold right now?
now S; - Make the relation hold from now on.

For instance,

The apple is in the basket.
if the apple is in the basket, ...;
now the apple is in the basket;

Examples

125.
A maze with directions between rooms randomized at the start of play.
126.
Hatless ★★
It's tempting to use "now…" to distribute items randomly at the start of play, but we need to be a little cautious about how we do that.
127.
A ray gun which destroys objects, leaving their component parts behind.

WI §8.12 Increasing and decreasing

Once we begin to deal with named values (or table entries, list entries or other ways to describe places where values are kept), we find that we often want to change them. We could if we wanted always use "now" for this, but it can be a little clumsily worded if we want to increase or decrease something:

now the score is the score plus six;

Because of that, we have some convenient abbreviations which have the advantage that the value being changed only has to be named once:

increase (a stored value) by (value)

This phrase increases the variable, table entry, list entry, or property by the given amount, which must be of a compatible kind. Example:

increase the score by 8;
increase the time of day by 5 minutes;
decrease (a stored value) by (value)

This phrase decreases the variable, table entry, list entry, or property by the given amount, which must be of a compatible kind. Example:

decrease the score by 6;
decrease the carrying capacity of the player by 10;

An even greater abbreviation can be made when we are changing a number by 1 either way:

increment (a stored value)

This phrase increases the variable, table entry, list entry, or property by 1. Example:

increment the score;
decrement (a stored value)

This phrase decreases the variable, table entry, list entry, or property by 1. Example:

decrement the score;

"Increment" and "decrement" are traditional computing terms, though they have been used in engineering for at least a century and in finance for longer still.

WI §8.13 Checking on whereabouts

We have seen that while rooms are fixed, their contents move around, so we will need ways to examine the current whereabouts of things. The following examples show the kind of conditions allowed:

if the genie's lamp is in Aladdin's Cave ...
if Aladdin is not in Aladdin's Cave ...
if Aladdin's Cave contains the genie's lamp ...
if the genie's lamp is carried by Aladdin ...
if Aladdin is carrying the genie's lamp ...
if Aladdin does not have the genie's lamp ...
if the table supports the genie's lamp ...
if the table is supporting the genie's lamp ...
if the genie's lamp is supported by the table ...
if the genie's lamp is on the table ...
if the genie's lamp is on top of the table ...
if the genie's lamp is in the cupboard ...
if the genie's lamp is contained in the cupboard ...
if the genie's lamp is inside the cupboard ...
if the genie's lamp is within the cupboard ...
if the wick is part of the genie's lamp ...

These are exactly like the assertions which we use to set up the world, except that we make them questions by placing "if" in front. But we shall later see that we can also use three other tenses, not to mention plural forms, so that new verbal forms like "had not been inside" and "were not supported by" are legal here (which they would not be in assertions). What we are not allowed is to contract these verbs with apostrophes: "isn't", "hasn't" and "hadn't" are forbidden.

Overwhelmingly the condition we check most is whether the player is carrying something. The following are therefore equivalent:

if the genie's lamp is carried by the player ...
if the genie's lamp is carried ...

And similarly for "not carried", "worn" and "not worn". To be precise, if a form of to be carried or to be worn is not followed by any other description, then "the player" is assumed to be doing the carrying or wearing.

WI §8.14 More flexible descriptions of whereabouts

The examples just given were all basically of the form "X relation Y" where X and Y were specific names of things. For example,

if the genie's lamp is carried by Cinderella ...
if the genie's lamp is inside the cupboard ...

Just as actions could be described with patterns to be matched ("taking an open container", say), so can the positions of things. Giving subtler descriptions of our X and Y sometimes broadens the possibilities, sometimes narrows them:

if the genie's lamp is carried by a woman ...
if the genie's lamp is inside the closed cupboard ...

In the first case, Y is allowed to be one of a whole range of things - any of the women existing in the world. This makes for a broader condition. In the second case, Y has not only to be the cupboard, but at a time when it is closed: which makes for a narrower condition. We can, of course, also vary X:

if an animal is inside the cupboard ...
if a container is carried ...

And we can even vary both X and Y at once:

if a woman is holding an animal ...

a condition which will be true if, anywhere in the story's world, any woman is holding any animal.

WI §8.15 Calling names

Conditions like "if somebody is in an adjacent room" allow complicated tests to be performed with a minimum of fuss, but it's rare that we want to know only whether they are true: more likely we also want to know which person, and which room.

For this purpose, we are allowed to supply a name for any such vaguely-described object which comes up, and then to use that name thereafter.

if somebody is in an adjacent room (called the Hiding Place), say "You hear distant breathing from [the Hiding Place]."

We can even name more than one of the things discovered:

Instead of waiting when a woman (called the kidnapper) is holding an animal (called the pet), say "How can you think of rest when, somewhere out there, [pet] has been cruelly kidnapped by [the kidnapper]?"

Note the brackets, which are essential. The result of typing "wait" is then

How can you think of rest when, somewhere out there, a lapdog has been cruelly kidnapped by Baroness Orczy?

Of course, that might be just one of many animals held by women in the story. We shall later see ways to go through all of the possibilities found, performing some action with each in turn.

A calling, if we can use that word, should be made immediately after the noun it refers to, and not left to hang back after any relative clauses. For instance,

if something (called the penitential object) held by the player is hot

is allowed, but not

if something held by the player (called the penitential object) is hot

because there is too much potential ambiguity - are we trying to call the player something?

See Also

Repeat running through for systematically working on everything matching a description.

Example

All doors in the game automatically attempt to open if the player approaches them when they are closed.

WI §8.16 Counting the number of things

It is very often useful to know how many things are in a given situation, and for this purpose we have the "number of …" construction. For instance:

the number of edible things carried
the number of things on the table
the number of people in the Dining Room

Whereas "a woman is holding an animal" makes the same test as "an animal is held by a woman", getting the same result, counting is not so even-handed:

the number of women holding animals
the number of animals held by women

are different questions and, unless the ration is strictly one lapdog per baroness, will have different answers. If Cruella de Vil has 101 dalmatians, they may be very different indeed.

It can also be helpful to count things with no particular location, like so:

the number of rooms
the number of closed doors

For instance:

When play begins:
   now the right hand status line is "Explored: [number of visited rooms]/[number of rooms]".

Provided that the possible range is finite, we can also use "number of" to count values which match a description. For instance:

the number of non-recurring scenes

or if we were to define

Colour is a kind of value. The colours are red, orange, yellow, green, blue, indigo and violet.

then "the number of colours" would evaluate to 7. As with other ways of talking about whole ranges of values, this only works if the range is manageable. "The number of numbers" cannot sensibly be worked out: there are infinitely many, for all practical purposes, and similarly for "the number of texts".

WI §8.17 Looking at containment by hand

The descriptions outlined in the last few sections are intended to deal with almost all of the routine questions we might have about what currently resides where. It should be a last resort to use the following more primitive way to inspect the world.

holder of (object)object

This phrase produces the container, supporter, carrier, wearer or room in which the object resides.

It's sometimes useful to go the other way. When something has possessions, we can find them out one at a time by running through a list.

first thing held by (object)object

This phrase produces the first of the list of things held by the object. Example:

first thing held by Baroness Orczy
next thing held after (object)object

This phrase produces the next item of the list of things held by something. Example: suppose Baroness Orczy is carrying a lapdog and a string of pearls.

next thing held after the lapdog

is then the string of pearls.

WI §8.18 Randomness

Sometimes we want to introduce random behaviour into play. We usually do this by generating random values, and then acting differently depending on what they are. The following:

a random number from 2 to 5

produces, as it suggests, a random number drawn from the choices 2, 3, 4 or 5, each of which is equally likely to come up. In fact, this isn't limited to numbers:

a random (name of kind) between (arithmetic value) and (arithmetic value)value
or…
a random (name of kind) from (arithmetic value) to (arithmetic value)value
or…
a random (name of kind) between (enumerated value) and (enumerated value)value
or…
a random (name of kind) from (enumerated value) to (enumerated value)value

This phrase produces a uniformly random value in the range given. Examples:

a random number from 10 to 99
a random time from 2:31 PM to 2:57 PM

If we make a new kind of value:

A cloud pattern is a kind of value. The cloud patterns are cumulus, altocumulus, cumulonimbus, stratus, cirrus, nimbus, nimbostratus.

then we can also take random values from it:

a random cloud pattern between stratus and nimbus

which has three possible outcomes, all equally likely.

We can also use random conditions:

if a random chance of (number) in (number) succeeds:

This condition is true X/Yths of the time, where X and Y are the numbers. Example:

if a random chance of 2 in 3 succeeds, ...

Here is a rule which applies only 15% of the time:

Instead of waiting when a random chance of 15 in 100 succeeds: ...

Testing IF which makes random choices can be rather frustrating, because a problem showing up on one attempt may not show up on another. We can get around this by making use of the fact that computers do not actually generate true randomness, but instead make a sequence of apparently random numbers by applying a complicated formula to each one in order to make the next. The starting point is a number called the "seed", because the next choice grows out of it.

seed the random-number generator with (number)

This phrase changes the seed number as specified. Any random numbers generated after that depend only on the seed. Example: the following sentence will "fix" the process of generating these random numbers so that they are not random at all - the same sequence of random numbers will be produced on each run.

When play begins, seed the random-number generator with 1234.

The seed value "1234" can be anything positive; a different sequence of random numbers will be produced for each different seed value. A seed value of 0 restores the RNG to properly random behaviour again.

Alternatively, it's possible the "fix" the RNG by clicking the "Make random outcomes predictable when testing" option on the Settings panel. This makes the behaviour predictable whenever the story is played within Inform, but (unlike the rule above) has no effect on the story file once released.

Examples

129.
A pair of dice which can be rolled, and are described with their current total when not carried, and have individual scores when examined.
130.
Very simple randomized combat in which characters hit one another for a randomized amount of damage.
131.
The automatic weather station atop Mt. Pisgah shows randomly fluctuating temperature, pressure and cloud cover.
132.
Uptown Girls ★★★
A stream of random pedestrians who go by the player.

WI §8.19 Random choices of things

Writing "a random number" is not allowed, because the possible range is too large, but that was the only reason why not.

a/-- random (description of values)value

This phrase makes a uniformly random choice from values satisfying the description given. Example:

a random visited room
a random scene

A problem message is issued if the range is too large (for instance, "a random text"). Unexpected results may follow if no value fits the description, unless we are describing objects, in which case the result is the special value "nothing".

For instance:

say "You can see [number of adjacent rooms] way[s] from here; how about [random adjacent room]?"

But it's important to worry about the possibility that nothing qualifies - here, that no adjacent rooms exist. The above would then say:

You can see 0 ways from here; how about nothing?

Examples

133.
Candy
One of several identical candies chosen at the start of play to be poisonous.
134.
A "Carousel Room", as in Zork II, where moving in any direction from the room leads (at random) to one of the eight rooms nearby.