Let's Play/Read: Inform 7 manuals (Done for now)

The I6 library defines 31 attributes. That was a fair amount of headroom. And yeah, you could overload in an ad-hoc way by using the “general” attribute for something object-specific.

Mm. I think the I6 compiler is up to date, but I7’s ENABLE_GLULX_ACCEL_R() function (provided in Glulx.i6t or the equivalent) needs to be modernized.


That was common, and also as zarf said, I6 defined a lot fewer than I7 does. A lot of I7 is designed on the principle of “we can assume people have plenty of RAM and a fast processor”, so the difference between one opcode to test an attribute and a handful of opcodes to look up a memory address then read from it isn’t significant. (“Fast” here means “fast by Infocom standards” so it’s a pretty good assumption.)

This is why I7 makes it so easy and painless to define new properties. It assumes memory usage and access speed are less important than having descriptive labels that are easy to read later. Earlier versions of Inform provided a general attribute that meant nothing except what you chose to use it for on an individual object, and properties like number for the same purpose; I7 expects you to invent your own properties on the fly instead.


Quite possible.

And I do remember reading about some home computer that had a built-in plotter for use when the family TV was occupied, though I don’t know if Infocom games would run on it. (About the only thing I remember was the reviewer complaining that the manual warned you not to send the pen outside the paper, even though some of its examples would do just that.)

1 Like

Chapter 6: Descriptions

I’m interested in reading this chapter because I’m not sure what’s different between Texts in general and Descriptions specifically, and why they need different chapters.

6.1 is What are descriptions.

Oh, I see; a description is a combination of adjectives and/or nouns. Not text at all!

So we’re not talking about ‘the description of the zorkmid is “----”’, we’re talking about:

The cargo trunk is an openable container.

Here ‘openable container’ is a description.

You can make lists of things matching a description:
"You look down at [the list of things in the basket]."

And count them:
"There are [number of things in the basket] things in the basket."

Now I can definitely see why this would use its own chapter, I had trouble with this recently.

Section 6.2 is Adjectives and nouns.
It says descriptions have at most one noun and any number of adjectives:

supporter = the noun supporter
closed = the adjective closed
the open wine cask = the adjective open + the noun wine cask
something portable = (some) + the noun thing + the adjective portable

It mentions that ‘something’ is ‘some thing’, referring to the kind ‘thing’.

[T]here are eight special nouns of this kind, but with only three different meanings between them:

something = anything
someone = anyone = somebody = anybody
somewhere = anywhere

So for instance “anybody male” or “somewhere dark” are valid descriptions.

I’d assume that ‘anybody male’ only matches people and not animals and ‘somewhere dark’ only matches rooms and not regions or containers, but it doesn’t say.

These special words can go before adjectives, while all other nouns come after.

No examples yet!

Section 6.3 is Sources of Adjectives.

The ones we already have are either/or properties and kinds of values. There are also new adjectives you can create and reserved ones like ‘visible’, ‘touchable’, and ‘adjacent’.

Section 5.4 is Defining New Adjectives. I’m interested in seeing this because I’ve only defined adjectives through either/or properties or kinds of values before, and only learned the second one in the last month.

Oh! We use the phrase ‘definition’! I see this in Emily Short’s code all the time. Man, that’s so useful! It seems like a nice way to make an either/or property that updates itself.

Here’s an example:

Definition: A supporter is occupied if something is on it.

Note the colon, which is essential, and the usage of “it” in the definition part to refer to the object in question.

You can ‘overload’ this definition in the programming sense:
We could give a second definition thus:

Definition: A room is occupied if a person is in it.

These are entirely different senses of the word “occupied” - a mantelpiece is occupied if an invitation is on it, but for a drawing room to be occupied there must be human presence - and Inform applies whichever sense is relevant when deciding whether or not a given object is “occupied”.

If you want it to have an opposite you specify that:
Definition: A room is occupied rather than unoccupied if a person is in it.

So this really seems like either/or properties in a fancy hat, with the main difference I’m seeing is that Inform stores either/or properties and they have to be manually changed but these are evaluated when-needed and thus allow more flexible changes? (Maybe???)

My hypothesis above is supported by the following example:

Inform could not satisfy:

The Ballroom is occupied. The bucket is a large container.

because there is not enough information: by whom is the Ballroom occupied? How large, exactly?

My only concern is that so far we’ve only seen definitions that fit on one line, while I can think of several uses that would require multi-line logic. You could get around that with nesting things (like Definition: a thing is hot if… and Definition: A thing is aflame if it is hot and…)

It is occasionally clumsy having to refer to the subject of a definition using “it”. We can avoid this and give the definition better legibility by supplying a name instead. For instance:

Definition: a direction (called thataway) is viable if the room thataway from the location is a room.

Example 73 is Finishing School.

Definition: a person is another if it is not the player.

Instead of eating something in the presence of another person:
    say "Your mannerly upbringing prevents you from eating without a fork or knife in front of someone."

Section 6.5 is adjectives for values. I already know one reason this section is very useful: it’s hard to make lists of things based on their numerical values, but lists based on adjectives are very easy to construct. I was not aware of this section before but will definitely use it in the future!

Here are some examples:

Definition: A number is round if the remainder after dividing it by 10 is 0.
Definition: A time is late rather than early if it is at least 8 PM.

There are some built-in definitions:

positive - one which is greater than zero (but not 0 itself)
negative - one which is less than zero (but not 0 itself)
even - a number like ..., -4, -2, 0, 2, 4, ...
odd - a number like ..., -5, -3, -1, 1, 3, 5, ...
empty - the text "", with no characters in it, not even spaces
non-empty - any text which does have at least one character in

The same adjective can be reused in other areas as long as they don’t conflict:
A container can be odd or ordinary.
doesn’t contradict that numbers can be odd or even.

You can also restrict definitions to a single thing:

A colour is a kind of value. The colours are red, green and blue.
Definition: red is subtle if the player is female.
Definition: a colour is subtle if it is blue.

and this example also illustrates some hierarchy:

The first definition of “subtle” takes precedence, of course, since it has the more specific domain - it applies only to red. The effect of this is that, if the player’s female, the subtle colours are red and blue; if not, just blue.

Example 74, Only You, uses even and odd numbers:

Every turn when the turn count is even:
    if every room is smoky, make no decision;
    let previously smoky be whether or not the location is smoky;
    repeat with area running through smoky rooms:
        now every room which is adjacent to the area is smoky;
    if previously smoky is false and the location is smoky:
        say "[The location] is filling rapidly with smoke."

Section 6.6, Whereabouts on a scale? is about using inequalities in definitions:

Definition: A container is huge if its carrying capacity is 20 or more.
Definition: A container is large if its carrying capacity is 10 or more.
Definition: A container is standard if its carrying capacity is 7.
Definition: A container is small if its carrying capacity is 5 or less.

In my stats class, if you have a range of values and an object in that range you approximate its true value with the midpoint. But inform uses the smallest value, so with the above definition, if we type:

The basket is a large container in the Shop. The thimble is a small container in the Shop. The matchbox is a standard container in the Shop.

You can use different categories for different kinds, and creating a thing with that category will use the definition for the kind it belongs to:

A person has a number called height. Definition: A man is tall if his height is 72 or more. Definition: A woman is tall if her height is 68 or more.

Inform then judges whether someone is or is not “tall” using different standards for men and for women, and

In the Shop are a tall man and a tall woman.

then they will have the most moderate values they can have, that is, the basket will have carrying capacity 10 and the thimble 5 (and of course the matchbox 7).

Section 6.7 is Comparitives. Apparently if you have a numerical definition of an adjective based on an inequality, you can turn that adjective into a comparator:

If we define

Definition: A container is large if its carrying capacity is 10 or more.

we not only say how to test if something is large (see if its capacity is at least 10) and how to create something large (give it a capacity of exactly 10), we also create a new form of comparison. Thus,

if the basket is larger than the thimble ...
if the thimble is not larger than the basket ...

are both true.

Have any of you used this before? It’s interesting but seems risky…

It also mentions that you can use the following comparisons with the ‘taller’ definition from earlier:

if Adam is taller than Eve ...
if Adam is the same height as Eve ...
if Adam is shorter than Eve ..

But this is weird because we defined ‘tall’ differently for men and women. So is making the comparative form of a defined adjective really just about looking at what values it has inequalities of and comparing those values? If so that should probably be stated.

Section 6.8 is Superlatives. It’s exactly like the last section but we use ‘largest’ or ‘smallest’. It also explains the etymological process:

Note that Inform constructs comparatives and superlatives by a pretty simplistic system. If we want to use these forms for an adjective expressing the relatively large size of a room, we had better go with “roomy” (roomier, roomiest) - not “spacious” (spaciouser, spaciousest).

I’ve never used the comparative forms before but now I want to try.

Section 6.9 is Which and Who.

It says that you can make descriptions of things (again when making lists or doing for loops or random things) that include relationships by using ‘who’ or ‘which’ which are equivalent:

an open container which is on the table
a woman who is inside a lighted room
an animal which is carried by a man
a woman who is taller than Mark
something which is worn by somebody

You can also omit ‘who’ or ‘which’ in the above phrases. But sometimes you need to spell it out:

a man who is not Sherlock Holmes

And you can nest things:

something worn by a woman who is in a dark room

Section 6.10: Existence and there

This section is for where you want to create something but not give it a location. You can just say ‘there is a…’:

There is a man called Bond.

You can also just do this with ‘Bond is a man’. (At least I think there isn’t a difference).

You can use if there is a woman in the Summerhouse, ... in conditions. This is better than what I usually do, which is if the number of women in summerhouse > 0:

And you can check for non-existence:
if there is nobody in the Summerhouse, ...

Section 6.11 is ‘a word about in’.

This section says that ‘in’ means a couple of things. First, containment:

The croquet ball is in the box.

He goes on to say:

This kind of “in” talks only about direct containment. If we ask [assuming the box is in Summerhouse, which I cut out earlier]

if the croquet ball is in the Summerhouse, ...

then the answer is that it isn’t - it is in the box which is itself in the Summerhouse, but that’s not the same thing.

This is almost always the meaning of “in” that we intend.

Hmm, I disagree with that last statement. I usually DO want ‘in’ to mean indirect containment. If I have a book in a chest in the Summerhouse, I darn well want to the game to think the book is in the summerhouse in IF conditions!

I know from a programming viewpoint that it makes way more sense to have ‘in’ be unambiguous, but I wouldn’t say that excluding indirect containment from ‘in’ is a logical action.

There have been numerous threads from confused people over the years. One example is here:

The second thing Inform means by ‘in’ is ‘in’ regions.

The answer is that meaning 1 is always the meaning of “X is in Y” unless Y is explicitly the name of a region. Thus:

if the croquet box is in the Garden Area, ...

is meaning 2, because “Garden Area” is the name of a region.

This is nice (and I could honestly see myself making some rooms their own region just so I don’t have to deal with indirect containment; but probably not, since I can use ‘enclosed by’).

There then is a caveat to this that I don’t understand (if helpful people want to comment here please do:)

[v]alues are indeed sometimes given names (becoming “variables”, or values “that vary”). Suppose “mystery value” is a name for a value which is an object, but which has different identities at different times. Then Inform reads

if the croquet box is in the mystery value, …

as meaning 1, because whatever “mystery value” is, it isn’t explicitly a region name, even if from time to time it might happen to be equal to a region.

This sounds like he’s talking about a value which is an object but can also become a region? Is that even a thing? Can the same variable sometime be a thing and sometimes be a region? Seems fake to me, but if anyone cane explain, please do.

If we are in such a confusing situation, we can say:

if the croquet box is regionally in the mystery value, ...

Section 6.12 is A word about nothing.

This also has two meaning. Meaning 1 is ‘no thing’:

Definition: a container is bare if nothing is in it.

Meaning 2 is ‘nothing’ as a value. I know if you make a list of things with a description and nothing matches that description, then it will return ‘nothing’, so you can check for that:

Definition: a container is impossible if its matching key is nothing.

Meaning 2 is used only for the keyword ‘is’ with no other relationships, and meaning 1 is for all others, like ‘is in’.

Section 6.13: To be able to see and touch

Oh! I’ve always heard about this section! The infamous ‘visible!’ >:)

Two of the adjectives built into Inform are:

"visible" - the player can see this
"touchable" - the player can touch this

So we can write descriptions such as “someone visible” or “a touchable container”. We also have adjectives “invisible” and “untouchable”, as might be expected. The visibility adjectives are particularly useful because the following is likely to go wrong:

if Helen is in a dark room, ...

This tests whether the room is dark, of itself; Helen may in fact be able to see by means of a torch, but the room is still “dark”.

A chunk of this section seems to be missing It says:

We can also talk about what other people can see and touch:

something which can be seen by Helen

are synonymous.

What are synonymous? I only see one example…

It gives the Inform definition of invisible:

Definition: Something is invisible if the player cannot see it.

It goes on to say:

The exact definitions of visibility and touchability are complicated, because there are so many ways in which vision and touch can be obstructed, but the gist is that they behave as one would expect.
Note that in darkness, nothing is visible, and that nobody can see from one room to another.

Hmm, so I’m going to make a guess. It seems to me that visible means ‘not in darkness or an opaque container’, and invisible means everything else. It doesn’t seem to mean ‘visible from where I am’. Let’s experiment with a sandbox program:

Lab room is a room. 

Closet is south of lab room. Closet is a dark room.

Lobby is north from lab room.

The glass case is a closed transparent unopenable container in lab room. The bouncy ball is in the glass case.

The chest is a closed opaque openable container in lab room. The gold piece is in the chest.

The baseball bat is in Closet.

The hamburger is in Lab room.

The receipt is in Lobby.

When play begins:
	repeat with current running through things:
		say "[The current] [are] [if current is visible]visible[otherwise]invisible[end if]."

When I run this, I get:

You are visible.
The glass case is visible.
The bouncy ball is visible.
The chest is visible.
The gold piece is invisible.
The hamburger is visible.
The baseball bat is invisible.
The receipt is invisible.

Oh, so it does care about which room it’s in, because the receipt is invisible!

Okay, that explains the thing he says about not seeing into other rooms.

Let’s try touchable:

You are touchable.
The glass case is touchable.
The bouncy ball is untouchable.
The chest is touchable.
The gold piece is untouchable.
The hamburger is touchable.
The baseball bat is untouchable.
The receipt is untouchable.

Hmm, this is very reasonable. Only the thing in the glass case changed.

The problem must be with action definitions, then, since that’s when I usually see people have problems. Defining an action as applying to ‘one visible thing’ usually seems to cause problems. I guess we’ll find out why later!

Example 76 is Lean and Hungry:

Every turn:
    if the sinister gentleman can touch something valuable (called the treasure) which is not carried by a person:
        try the gentleman taking the treasure.

Report the gentleman taking something:
        say "[The gentleman] slyly acquires [the noun] and tucks it into his pocket." instead.


Section 6.14 is complicated: Adjacent rooms and routes through the map.

Adjacency is easy:

Two rooms are said to be adjacent if there is a map connection between them which does not pass through some barrier such as a door. This is easily tested:

if the Hallway is adjacent to the Study ...

We can use ‘adjacent’ as an adjective:

if somebody is in an adjacent room, ...

You can ask for more specific map connections as so (if a door is in between, the connection maps to the door, not the room on the other side):
if the Ballroom is mapped north of the Hallway, ...

You can get the room on the other side of a door (or just the next room if there is a door) with:

room (direction) from /of (room) … room

if the room north from the Garden is nothing, say "The grass leads nowhere."

If there is a door, you can say:
door (direction) from /of (room) … door

and if you don’t know, and want to catch a door if there is one or a room if there is not, you can say:
room-or-door (direction) from /of (room) … object

Now for the hard part: pathfinding!

best route from (object) to (object) … object

This gives the next direction to go to get from one room to the next, and just the next direction. It does not go through doors unless you specify it to do so:

The description of the brass compass is "The dial points quiveringly to [best route from the location to the Lodestone Room, using even locked doors]."

You can also restrict it to rooms that match a specific description:

best route from the Drawbridge to the Keep through visited rooms

(the condition you give also applies to the endpoints).

You can also count the number of steps to move from one room to the next (with or without restrictions):
number of moves from (object) to (object) … number

This phrase produces the number of map connections which must be followed in order to get from A to B by the shortest number of movements between rooms. If A and B are the same, the answer is 0; if there is no route at all, the answer is -1.

There are two algorithms for route-finding.

Use fast route-finding is quick but a memory hog. It is the default for Glulx.
Use slow route-finding is slow but uses less memory. It is the default for Z-machine.

Now we have 5 examples all at once!

Example 77 is Mistress of animals:

Every turn:
    if Artemis is in a room (called the current space):
        let next space be a random room which is adjacent to the current space;
        if Artemis is visible, say "Artemis heads to [the next space].";
        move Artemis to next space;
        if Artemis is visible, say "Artemis arrives from [the current space]."

Section 78 is All Roads Lead to Mars, which makes the map rearrange itself so the player always goes the right place next. This actually happens in the Mars section of Photopia, so I wonder if this is from Adam Cadre’s code, a later recreation, or neither.

Before going a direction (called way) when a room (called next location) is not visited:
    let further place be the room the way from the location;
    if further place is a room, continue the action;
    change the way exit of the location to the next location;
    let reverse be the opposite of the way;
    change the reverse exit of the next location to the location.

Example 79 is Hotel Stechelberg

After looking:
    say "Yellow arms on the signpost point:-[line break]";
    repeat with destination running through interesting rooms:
        let the way be the best route from the location to the destination;
        if the way is a direction, say " [way] for [the destination]: [number of moves from the location to the destination] Std."

Example 80 is A View of Green Hills

This example lets players look into nearby rooms.

Understand “look [direction]” as facing.

Facing is an action applying to one visible thing.

Carry out facing:
    let the viewed item be the room noun from the location;
    if the viewed item is not a room, say "You can't see anything promising that way." instead;
    try looking toward the viewed item.


Instead of facing up:
say "Above you is bright sky."

Understand "look toward [any adjacent room]" as looking toward. Understand "examine [any adjacent room]" as looking toward.

Looking toward is an action applying to one visible thing.

Carry out looking toward:
say "You make out [the noun] that way."

Example 81 is Unblinking, where travelling only through lit areas. It uses a fake invisible object called the ‘light-meter’ whose only purpose is to be a player surrogate that checks if things are visible in that room.

This reminds me of the person I tutored in Inform 7 for money who wanted to make a complex elevator. We ended up making an invisible NPC called the elevator pusher who would teleport into the elevator and push buttons from the inside whenever you pushed buttons from the outside.

This example gives a caution:

An important word of caution: this method would give false negatives if there were a backdrop lightsource, such as the moon, providing light to the Upward Path. This is because backdrops are actually moved around the map by Inform during play, following the player around. So if the moon backdrop is in the Crash Site with the player, it will not be in the Upward Path as well – even if it’s scheduled to move there as soon as the player does.

Section 6.14 is all, each, and every. I use these sometimes for assertions, but not for if statements.

if each door is open
if anyone is carrying all of the animals
if everybody is in the Dining Room

We can also do:

if some of the doors are open
if most of the doors are open
if almost all of the doors are open

The thresholds for these are at least one being true, more than half being true, or at least 80% being true.

The four following things are equivalent:

if no door is open
if all of the doors are not open
if none of the doors is open
if all of the doors are closed

It can also do ‘all’ and ‘most’, etc. for values where only finitely many values are possible:

Colour is a kind of value. The colours are red, orange, yellow, green, blue, indigo and violet. A colour can be found or unfound.

if every colour is found
if most of the colours are found
if any colour is found

Example 82 is a rare 4-star example, including rulebooks and other things.

This is too long to quote here but here are some pertinent selections:

The complaint rules is a rulebook.

A complaint rule:
    if something (called the offending item) on the table is drippy:
        say "'Help! Get me a coaster!' screams the table[if the table is visible], its veneer squirming under [the offending item][otherwise] from the Dining Room[end if].";
        rule succeeds;
    if something (called the offending item) on the red chair is drippy:
        say "'Oh dear,' murmurs the red chair, as [the offending item] drips into its velvety seat. 'Oh dear, I will have a damp spot. This is so very -- what will people think?'";
        rule succeeds;
    if something (called the offending item) on the visible armchair is drippy:
        say "[The offending item] visibly begins degrading the suede where it sits. The armchair is tactfully silent.";
        rule succeeds;
    if a drippy thing (called the offending item) is in the location and the player is in the Dining Room:
        say "'Cripes,' says the parquet. 'No one mind me at all. Just leave that [offending item] right here. You know I'm the most valuable thing in the room?'";
        rule succeeds.
An every turn rule:
    if some of the things are concerned, say "You sense some resentment from [the list of concerned things]."
An every turn rule:
    now score is 5 minus the number of concerned things;
    if the location is concerned, decrement the score;
    if all of the supporters are concerned and the location is concerned, end the story;
    if none of the supporters are concerned and the location is not concerned, end the story finally.

Section 6.16 Counting while comparing

You can put specific numbers of things in your if statements:

if two women are carrying animals
if at most three doors are open
if fewer than 10 portable containers are closed
if all but two of the devices are switched on
if there are more than six locked doors

Here ‘if two women are…’ is functionally equivalent to ‘if at least two women are…’

If you want to be precise, you can say something like ‘if exactly two women are…’

The “all but” counts - say, “if all but two doors are open” - are exact: if, in fact, all of the doors are open then this will be found false.

You can also use this for any other finite amount of values (so not all numbers or all texts):

if more than three scenes are happening
if there are more than two non-recurring scenes

And that’s it!

I always skipped this chapter because I thought it meant object descriptions of nouns. I guess a more apt name that I would give it (but is ugly) is ‘looking up objects by their properties’, since every time we use these descriptions we’re looking things up, except in the very rare case we are using them to declare something.


Multi-line definitions are possible.

Descriptions are pretty fundamental to Inform. They are a natural way to refer to groups of objects, in many contexts:

let X be a random DESC;
if all DESC are carried by the player: ...
if a DESC (called X) is in the trophy case: ...
now all DESC are in the Kitchen;
now all DESC are lit;

You can think of a description as a (computed) either/or property, but the important part is doing something with the group of objects that have that property.


Do you have an example of a multiple-line definition? I believe you that they exist, I’d just like a code snippet I can use as a future reference. Thanks for the help!

WI 11.16: New conditions, new adjectives


Oh, so it has the same format as ‘to decide whether’? I like that!

1 Like

“in” may not be exactly what you want, but at least it’s far from unambiguous!

The hardest thing about making a verb that means either one of enclosed by or regionally in is that Inform has hogged all the good words.

Withinhood relates an object (called o1) to an object (called o2)
  when o1 encloses o2 or o2 is regionally in o1.
The verb to surround means the withinhood relation.

An object variable can sometimes be a thing and sometimes a region. With this setup:

lab is a room.
cat is in lab.
manor is region.
the map region of lab is manor.
r1 is a region that varies.
obj1 is an object that varies.
obj1 is initially manor.

If you test if the Lab is in [...] with any of manor, r1, obj1, it’s true. If you test for the cat, you’ll find that the cat is in manor and r1 but not obj1. But both the cat and the lab are regionally in all of manor, r1, and obj1.

And to be in is the reversed containment relation, so to contain is as weird as in.

1 Like

You know, maybe you can explain a recent error I had.

I had a scene that had the following code:

Flying-scene ends abruptly when the player in end-room.

It compiled, but the scene always ended abruptly as soon as it began, even when it wasn’t in end-room. As soon as I changed it to ‘when the player is in end-room’, it worked perfectly.

How was Inform interpreting it before the word ‘is’ was there?

Good question. The compiled code just says “if (true)…” I don’t know what’s going on in Inform’s tiny mind, but it’s not very useful. Quite possibly that’s not meant to be valid Inform code, and the compiler has a bug about reporting the error.


Hunh. I was about to say something about the weird behavior of a lone “in” and how it differs from “is in” based on this thread…

but from your report of if (true) it looks like possibly there’s a different weirdness occurring if it’s in an action’s when clause.

1 Like

…oh my god, I have also always skipped this chapter because I never could think of anything I wasn’t sure how to do with object descriptions! And similarly, every time I’ve needed to figure out stuff of the form “list of things satisfying some condition” I’ve just done it via trench warfare with the compiler. Thanks once again for doing this thread, I’m learning a bunch!

This is funny, because I feel like for most rules, you can’t say “it” and need to do the “called the foo” thing…

Ah, I feel like I’m constantly trying to refer to this as “nothing” and then it doesn’t work – helpful!

Agreed – this is why learning about the enclosure relation was so revelatory!

That’s where it is? I thought this was just part of Inform oral tradition!

This is what I thought of too – Photopia is an I6 game, of course, but the code seems like it does what Cadre did.


Yes, the syntax for action definitions is a bit different. That’s where the confusion lies. But we’ll get to that later.

Strictly speaking, “visible” means “in scope”—Inform believes that the player can see it, and therefore should be able to refer to it in commands. This means that adding things to scope can make them “visible” when they wouldn’t otherwise be. For example, you can give things a “visible between rooms” property, and then make them be visible from adjacent rooms.

Similarly, you can modify what’s “touchable” with reaching inside and reaching outside rules, but we’ll get to those later.

This deserves a bit of emphasis because it always used to trip me up. Rooms separated by an open door are not adjacent. You need to define your own relation for that.

And I’m learning something new! I’ve never used this.


Chapter 7: Actions

Now we finally get to do stuff!

I usually associate ‘actions’ with commands the player types, but they don’t have to be synonymous.

We write actions using present participles. For instance, if the player types “take napkin” or “get the napkin” or something similar then the resulting action would be written as:

taking the napkin

Every action ends in success or failure. In this context, success means only that the player’s intention has been fulfilled. If the player sets out to take the napkin, but finds a million-pound banknote in its folds instead, the action will be deemed to be a failure.

There’s a testing command called ‘ACTIONS’ that prints out what actions are happening. I used this a lot in my game when debugging a clone that copies the players actions exactly two turns after you start them.

Here’s what the output looks like:

[going south]
Security Vault
You can see a metal door here.
[going south - succeeded]
>close door
[closing metal door]
You close the metal door.
[closing metal door - succeeded]
>take door
[taking metal door]
That's fixed in place.
[taking metal door - failed the can't take what's fixed in place rule]

(This is from the text; I swear there should be an implicit looking action when they go south because when I was doing the clone thing there was an implicit look action).

Hmm, actually I just tried it in a sandbox and the Actions command doesn’t pick up on the implicit LOOK.

Section 7.1 is Instead rules. This is kind of the bread and butter of Inform programming; it’s what people usually start with, and many experienced programmers use it a lot, too.

An action is ordinarily handled by running it through Inform’s extensive rulebooks of what might be called normal behaviour. An action such as “taking the napkin”, for instance, will be run through numerous checks to see if it is physically reasonable, and then provided all is well, the napkin will be moved into the possession of the player.

Instead, though, we can bypass the rules to do with an action and do something else:

Instead of eating the napkin: say "Why not wait for the actual dinner to arrive?"

This is a rule (one of our first ones), called an ‘instead rule’.

You can also do it in one line:

Instead of eating the napkin, say “Why not wait for the actual dinner to arrive?”

Some examples:

Example 84, Grilling

Instead of taking something which is on the grill:
    say "'Hey, you'll burn yourself,' says Mom."

This example uses the ‘descriptions’ from last chapter, with the ‘which is on the grill’ part.

Example 85: Bad Hair Day replaces the player’s description:

Instead of examining the player:
    say "Oh, stop fussing. You look fine."

This is different from the description of the player, since, if unspecified, the player is an amorphous blob person called ‘yourself/your former self’ and the description of the player is attached to that being; changing to a different person (with the command ‘now the player is ____’) changes the description.

But this method gives the same description no matter who you are. This comes up a lot for me in my games because I often switch who the player is (in flashbacks in Color the Truth, for instance, or when controlling a giant death robot in Absence of Law).

Section 7.3 is Before Rules

These are like instead rules, but they happen before you do something. When I had my clone copying the player, I first was using Instead/carry out rules and the clone couldn’t copy unsuccessful attempts at things. Then I switched to ‘before’ rules and that let the clone attempt unsuccessful things/actions with inappropriate objects (like eating rocks).

Anyway, here’s what the section says:

“Before” rules genuinely precede checking of any kind. They also differ from instead rules in that they do not automatically stop the action in its tracks. Rather, they are provided as an opportunity to ensure that something else is done first. For example:

Before taking the napkin, say "(first unfolding its delicate origami swan)".


(first unfolding its delicate origami swan)

Often you still want to stop the normal actions, so you can just throw an ‘instead’ into the before rule. I always put it at the very end of a block like this:

Before going north:
  do thing1;
  do thing2;
  do thing3 instead;

But apparently it can go in front too:

Before taking the key, instead say "It seems to be soldered to the keyhole."

There is also a line called ‘stop the action’, which I’ve tried before and never does what I want. I tried to use it to stop the implicit LOOK action after going, but it doesn’t do that, it seems.

stop the action

This phrase stops the current rule, stops the rulebook being worked through, and finally stops the action being processed. Example:

Before taking the key:
say "It seems to be soldered to the keyhole.";
stop the action.

We can also stop it from stopping:

Instead of taking the napkin:
    say "(first unfolding its delicate origami swan)[command clarification break]";
    continue the action.

Hmm…I never got this before! ‘stop the action’ turns a before rule into an instead rule with slightly more power (due to firing before all other instead rules), while ‘continue the action’ turns an instead rule into a slightly weaker before rule.


As a general principle, it is good style to use instead rules whenever blocking actions, and before rules only when it is genuinely necessary to do something first but then to continue: in fact, it is good style to use “stop the action” or “continue the action” as little as possible.

Example 86 is Democratic Process shows a useful before rule:

Before inserting something which is not carried by the player into something:
    if the noun is in the second noun, say "Already done." instead;
    say "(first taking [the noun])[line break]";
    silently try taking the noun;
    if the player is not holding the noun, stop the action.

In my mind, from now on I’ll think ‘stop the action is just like ‘instead’ except you put it in as its own command instead of at the end of another command’

Example 87 is Sand, a rare 4-star example. It allows you to put multiple things in other things. It includes the text of 86 as well as this line:

Understand "put [things] in [something]" as inserting it into. Understand "put [things] on [something]" as putting it on.

Section 7.4 is Try and Try silently.

[S]urveys of Inform source text showed that the three most popular phrases used by authors are “say”, “if” and “now”. The fourth most popular is “try”…

‘Try’ is what lets the computer do an action itself rather than waiting for the player to type it in.

Instead of entering the trapdoor, try going up.

This is one of the basic phrases players need to learn. In fact, so far I’d recommend new players start reading this chapter before any of the others!

You have to be specific in your action, and can’t type:

try eating something;

We use ‘try’ because it might fail:

Before locking the front door, try closing the front door.

could go wrong in any number of ways - perhaps the door is closed already, perhaps it is not openable, perhaps somebody has wedged it open. It would be safer to write:

Before locking the front door:
    try closing the front door;
    if the front door is open, stop the action.

You can also do ‘silently’ which means that routine messages aren’t printed (I assume this means the ‘carry out’ messages’):

`try silently taking the napkin;`

Silence is maintained only if this new action, the taking of the napkin, is successful (so if the napkin is successfully taken, the text “Taken.” will not appear): if the action should fail, a suitable objection will be voiced as usual.

Example 88, Fine Laid, is a way of redirecting one object to another in all situations except examining:

The sheet of paper is a thing in High Street Stationer. The writing is part of the sheet of paper.

The description of the sheet of paper is "A beautiful sheet of heavy cream paper." The description of the writing is "Delicate and spidery."

Instead of tasting the sheet of paper, say "You might need more fiber in your diet, but this isn't the way.".

Before doing something other than examining when the current action involves the writing:
    if the writing is the noun, now the noun is the sheet of paper;
    if the writing is the second noun, now the second noun is the sheet of paper;
    try the current action instead.

This is our introduction to ‘the current action’ as an object, as well.

My current game has tons of ‘labelled’ items or things with inscriptions. This might be a nice way of handling that…

Example 89 is ‘Hayseed’:

A staircase is a kind of door. A staircase is usually open. A staircase is seldom openable.

The ladder is a staircase. It is above the Barn and below the Hayloft.

Instead of climbing a staircase:
    try entering the noun.

I think I have this almost word for word in my current game.

Finally, we have 7.5, After rules, which completes the three main ways we mess around with rules: Before, Instead, and After. Later on, we’ll see Check, Carry Out, and Report, which are very similar but used more when defining new actions.

After rules replace Inform’s normal responses:

After taking the diamonds, say "Taken!"

just says ‘Taken!’ instead of


which is what you’d get if the normal response fired off.

You can also ‘continue the action’:
After taking the diamonds: say "(Mr Beebe looks up sharply.) "; continue the action.

If I understand this right (correct me if not) this is almost identical to using ‘instead’ with ‘continue the action’ here, except that with ‘instead’ the above line would be printed before the game actually took the object and with ‘after’ it’s printed after it took the object, which would matter if you change what’s printed based on the location of the object.

The only example is Example 90, Morning After:

A thing can be examined or unexamined.

After taking something unexamined:
    say "Taken. [run paragraph on]";
    try examining the noun.

Carry out examining something:
    now the noun is examined.

I have a flag in my game called ‘oncetaken’, which I think is identical to Inform’s ‘handled’, which I didn’t know existed at the time.

Section 7.6 is “Reading and Talking”. This feels more like a ‘Recipe Book’ section than a ‘Writing with Inform’ section.

For players to type ‘look up ___ in ___’ or "consult __ about ___’ we use the consulting it about action:

After consulting the book about "grove", say "The Grove is a sacred yadda, yadda. There's a tree, that sort of thing. Wisdom."

After consulting the book about "future events", say "It's a bit, what's the word? Delphic."

Here “grove” and “future events” are ‘texts’ (i.e. strings) and not objects.

Here’s the examples for asking about:

After asking the Sybil about "verses", say "She blushes."

After telling the Sybil about "persians", say "She nods gravely."

After answering the Sybil that "I am mad", say "She sighs."

Man, again I’d have to say that this is the first chapter I’d send a newbie to.

You can redirect ‘telling’ to ‘asking’ like so:
Instead of telling the Sybil about something, try asking the Sybil about it.

I have a custom conversation engine and I redirect ‘talking to’, ‘answering it that’, ‘asking it about’, ‘telling it about’, etc. to error messages detailing how to use my system.

There are lots of examples here; you can tell both authors are enthusiastic about this.

Example 91 is Sybil 1:

Instead of telling someone about something, try asking the noun about it. Instead of answering the noun that something, try asking the noun about it.

Instead of asking the Sybil about "persians", say "She nods gravely."

Instead of showing something to someone, try giving the noun to the second noun.

The player carries a coin. Instead of giving the coin to the Sybil: move the coin to the Sybil; say "She accepts with a smile."

I also redirect giving and showing since it’s rare you want different activity for these two in my games.

This example also includes some phrases using the slash format Mike Russo expressed fondness for:
Instead of asking the Sybil about "Darius/king", say "Her smile unnerves you."

Example 92 redirects one conversational topic to another:

Instead of asking Lucy about "checkers":
    try asking Lucy about "games".

Instead of asking Lucy about "games",
    say "'I don't like games,' she sniffs."

Example 93 is Sybil 2, who can also understand various forms of saying ‘yes’:Instead of asking the Sybil to try saying no: try saying no. Instead of asking the Sybil to try saying yes: try saying yes. Instead of asking the Sybil to try saying sorry: try saying sorry.

Instead of answering the Sybil that "yes", try saying yes. Instead of answering the Sybil that "no", try saying no. Instead of answering the Sybil that "sorry", try saying sorry.

Instead of saying yes in the presence of the Sybil:
    say "She looks interested."

Instead of saying no in the presence of the Sybil:
    say "She looks annoyed."

Instead of saying sorry in the presence of the Sybil:
    say "She looks bored."

The complexity arises from the fact that we want to handle both YES and SYBIL, YES. If we only had the latter, ‘yes’ would be treated as a text given to the Sybil, just as in the commands SAY YES TO SYBIL or ANSWER YES. But because we have defined it as a command (so that the player can use it independently), SYBIL, YES is understood as an order to the Sybil to do the YES action.

Example 94 is Costa Rican Ornithology:

A book is a kind of thing. Understand "book" as a book. A book has a table name called the contents.

Instead of consulting a book about a topic listed in the contents of the noun:
say "[reply entry][paragraph break]".

Report consulting a book about:
say "You flip through [the noun], but find no reference to [the topic understood]." instead.

The Guide to Central American Birds is a book carried by the player. The contents of the Guide is the Table of Listed Birds.

Table of Listed Birds

topic reply
“[red]” or “[red] bird/macaw” “You flip through the Guide for a while and eventually discover a reference to the [scarlet macaw], which appears to correspond with what you see before you.”
“quetzal/trogon” or “resplendent trogon” “The entry on the quetzal is quite lyrical, describing its brilliant plumage, flashing and igniting in the sunshine, which is supposedly sufficient to lure birdwatchers from all over the world. Unfortunately, the quetzal is described as being bright emerald in color, with a pink fuzz on its head and a long soft tail ‘like a feather boa’. None of these describes your visitor.”

(note that Discourse is weird copying and pasting tables so I did it this way).

Section 7.7 is The Other Four Senses (Again, very happy this section is so grounded in reality)

I’m just going to reproduce this section in full:

The five senses are all simulated with actions. Sight is so informative that it is handled by a whole range of actions: “looking”, which describes the general scene; “examining something”, which takes a closer look at a specific thing; “looking under something”, and so on.

The other senses have one action each: “listening to something”, “touching something”, “tasting something” and “smelling something”. It makes no sense to touch or taste the general scene, but listening and smelling are a different matter: we often just listen, without listening to anything specific. If the player types the command “listen”, Inform understands that as listening to the current location: similarly for the bare command “smell”. Thus:

Instead of listening to the Seashore, say "The song of gulls."

Instead of smelling the Cave, say "Salt and old seaweed."

This was useful for me in my current game where there is a dark room but you have to find two different objects, one by smelling and another by listening.

Example 95 is The Art of Noise, which is about listening and smelling:

A thing has some text called sound. The sound of a thing is usually "silence".

The report listening rule is not listed in the report listening to rules.

Carry out listening to something:
say "From [the noun] you hear [the sound of the noun]."

Instead of listening to a room:
if an audible thing can be touched by the player, say "You hear [the list of audible things which can be touched by the player].";
otherwise say "Nothing of note."

Definition: a thing is audible if the sound of it is not "silence".

Before printing the name of something audible while listening to a room:
say "[sound] from the "Preformatted text

This example shows unlisting a rule:
‘The report listening rule is not listed in the report listening rules’.

I usually just say ‘The report listening rule does nothing when …’. Not sure what the advantages are between doing nothing and unlisting.

Section 7.8 is Rules applying to more than one action.

You can say:
Instead of examining, looking under or searching the desk: say "There's no use poking around in that old desk."

I don’t know if this is still true, but at one point I had a rule like that with a ton of actions in it but it really slowed down compiling. Instead I used a different construction, like:

Examining is investigation.
Looking under is investigation.
Searching is investigation.

Instead of investigation when the noun is the desk:
  say "blah blah blah"

Section 7.9 is All actions and exceptional actions.

You can just type ‘doing something’ or ‘doing anything’ if you want to catch all possible interactions.

I do this with objects the player saw but aren’t there anymore. So if a monkey ran by and disappears, I make a scenery object called ‘missing-monkey’ or something and say

Instead of doing anything when the noun is the missing-monkey:
   say "The monkey is already gone!"

Although I notice that I said ‘when the noun is’ and they said ‘to the…’, which seems more general, since the monkey could be the second noun.

Oh, wait, maybe it’s not more general:

“Putting the handbag on the cucumber sandwich” would also not qualify as “doing something to the cucumber sandwich” - only to the handbag.

You can also add exceptions:

Instead of doing something other than examining, taking or dropping with the dagger: say "Don't fool around with that dagger. It's exceedingly sharp."

Note the “with”, which is crucial here. Without it, the rule is subtly different:

Instead of doing something other than examining, taking or dropping the dagger: say "Don't fool around with that dagger. It's exceedingly sharp."

This second version matches if the action is, say, taking a shield, or even just looking, because that would be an action other than examining the dagger, taking the dagger or dropping the dagger.

Example 96 is Zodiac:

Instead of doing something other than looking or examining in the presence of the Capricorn Killer:
    say "You dare not attempt it!"

This example also introduces ‘in the presence of’ (unless maybe that was covered in the ‘visible’ section before?)

Section 7.10 is The noun and the second noun (not, as I learned through cruel experience, The first noun and the second noun).

Basically, if you want to refer to the object of an action , call it ‘the noun’:

Instead of examining something, say "[The noun] is none of your concern!"

This is a pretty vital thing to know how to use!

‘The second noun’ is used for actions that apply to two things, and means the second thing you typed (unless you set up actions ‘with nouns reverse’, in which case its the first thing you typed).

Despite ‘the second noun’ being in the section name, there are no examples in the text or in th examples section that use it. So schade

Example 97 is Ming Vase:

A thing can be strong or fragile. A thing is usually strong.

Instead of attacking or dropping a fragile thing:
    now the noun is nowhere;
    say "[The noun] breaks into thousands of pieces!"
The pillow is a portable supporter. It is carried by the player.

Instead of dropping a fragile thing when the pillow is in the location: try putting the noun on the pillow instead.

After putting a fragile thing on the pillow:
say "You set [the noun] down gently on the pillow."

Example 7.11 is In rooms and regions.

You can just add conditions on actions only in certain areas:

Instead of taking something in the Supernatural Void, say "In this peculiar mist you feel unable to grasp anything."

You can also do this in regions:

The Public Area is a region. The Arboretum and Gardens are in the Public Area.

Instead of eating in the Public Area, say "The curators of the Gardens are ever among you, eagle-eyed and generally cussed."

This has been vital for my mega-game. One area is a wax museum under surveillance; one is a magical area with spells; and another has flashbacks where you a different person in the past. So there are a lot of rules I want to completely ban in one region (like in the spell region magic can teleport you, but I don’t want it to function elsewhere).

Section 7.12 is In the Presence of and when

Okay, so this is where in the presence of is defined! Haven’t used it before. Apparently it’s when two people or things are in the same location:

Instead of doing something other than looking, examining or waiting in the presence of the Queen: say "I'm afraid they take what you might call a zero tolerance approach to breaches of court etiquette here."; end the story saying "You have been summarily beheaded"

You can also use ‘when’ in an instead statement which just functions like an ‘if’ clause with any condition:

Instead of eating something when the radio set is switched on, say "Something about the howling short-wave static puts you right off luncheon."

Or if you only want that in the room that actually has the radio:

Instead of eating something in the presence of the radio set when the radio set is switched on, say "Something about the howling short-wave static puts you right off luncheon."

Example 98 is Beachfront. This is a crucial example that does something players often want to do: make an object that isn’t there until you search something else:

The heavy oak desk is a supporter in the stuffy office. It is scenery. Understand "paperwork" as the desk.

The creamy envelope is an openable container. The description is "There is no return address on the outside of the envelope, just the address of the Doctor's office -- but the legs of the capital A are rubbed down in a characteristic way, and the top of every R is open. There's no question that it comes from the same typewriter as the blackmail note." In the envelope is a letter. The envelope can be found or lost. The envelope is lost.

Instead of searching the desk when the envelope is lost:
    now the envelope is found;
    say "You rifle through the piles of bills and notices; invitations to conventions; advertisements for high-end prescription drugs; pink carbon sheets bearing patients['] names and medical identification numbers in spidery, elderly handwriting. Almost at the bottom of the heap, you find what you were looking for: a creamy envelope with the address typed.";
    move the envelope to the desk.

Instead of searching the desk:
    say "Further investigation of the desk reveals nothing else suspicious."

Notice that we have two rules that apply to “searching the desk”, but one of them has a more specific set of parameters (“when the envelope is lost”). This means that Inform will consult that rule first and use it if it applies; it will only carry out our plain vanilla “instead of searching the desk” rule when the more restricted rule is not relevant.

Example 99 is Today Tomorrow:

Instead of eating something in the presence of the chihuahua:
    say "[The chihuahua] yips at you! Maya looks despairingly at [the noun], which is obviously inciting it."

This example also introduces time of day:

Rule for deciding the concealed possessions of someone (called carrier):
    if the particular possession is the chihuahua and the carrier wears the trenchcoat, yes;
    otherwise no.

The time of day is 11:45 AM.

At 11:47 AM: say "Your boss pokes his head in, temporarily free of the round of conference calls that occupy all his days. 'Maya,' he says. 'Your coat?' He shakes his head, clucking sadly. 'It doesn't say professional!' But mercifully Maya manages to take it off so slowly that he doesn't glimpse her pet before her phone rings again.";
now Maya carries the trenchcoat.

Section 7.13 is Going from, going to.

Going has special text to distinguish when you care about the destination from when you care about the origin:

The Catalogue Room is east of the Front Stacks. South of the Catalogue Room is the Musicology Section.

Instead of going nowhere from the Front Stacks, say "Bookcases obstruct almost all passages out of here."

Instead of going nowhere, say "You really can't wander around at random in the Library."

Before going to the Catalogue Room, say "You emerge back into the Catalogue Room."

It includes this gem (another crucial thing for new players and cementing this chapter as ‘the best first chapter’ for me):

Note that “going nowhere” means trying a map connection which is blank, and if no rules intervene then “You can’t go that way” is normally printed. Unless “nowhere” is specified, descriptions of going apply only when there is a map connection. So “going from the Musicology Section” would not match if the player were trying to go east from there, since there is no map connection to the east. Similarly, “going somewhere” excludes blank connections.

You can use regions instead of rooms for ‘to’ and ‘from’.

If you type something like this in a region:
Instead of going north in the Wilderness, say "Oh, it's too cold."

Inform parses it as ‘Instead of going north when the player is in the Wilderness’ (here the Wilderness is a region).

You can’t use instead rules for variables in this way (this does not compile):

The Dome is a room. The Hutch is north of the Dome. The rabbit is in the Hutch. Before going to the location of the rabbit, say "You pick up a scent!"

But this does:
The Dome is a room. The Hutch is north of the Dome. The rabbit is in the Hutch. Definition: a room is rabbit-infested if it is the location of the rabbit. Before going to a rabbit-infested room, say "You pick up a scent!"

I’ve noticed that pretty much any complicated thing that won’t compile works well as an adjective. (well, at least a couple of times it has worked).

Lots of examples, including the glamorours example 100!


Neptune is a region.

Tijuana is a room.

High School is north of Tijuana. It is in Neptune.

Detective Offices is west of High School. It is in Neptune.

The player is in High School.

Instead of going from Neptune to a room which is not in Neptune:
say "It's a bad time to leave Neptune."

Is this a reference to something?

Example 101 is A&E:

Film Set is a region. Duck Pond, Stately Lawn, and Stately Home are in Film Set.

Instead of going to Film Set when the player does not carry the VIP Pass: say "A burly studio guard materializes in your path, convincing you that you would prefer to be elsewhere."

Example 102 is Bumping into Walls, a deeply useful example that tells the player available exits if they go the wrong way:
Definition: a direction (called thataway) is viable if the room thataway from the location is a room.

Instead of going nowhere:
    let count of exits be the number of viable directions;
    if the count of exits is 0, say "You appear to be trapped in here." instead;
    if the count of exits is 1, say "From here, the only way out is [list of viable directions].";
    otherwise say "From here, the viable exits are [list of viable directions]."

Example 103 is Polarity:
The former location is a room that varies.

First carry out going rule:
    now the former location is the location.

Understand "go back" as retreating. Understand "back" or "return" or "retreat" as retreating.

Retreating is an action applying to nothing.

Carry out retreating:
    let way be the best route from the location to the former location, using doors;
    if way is a direction, try going way;
    otherwise say "You can't see an open way back."

When play begins: now the former location is the Dome.

Instead of retreating when the former location is the location: say "You haven't gone anywhere yet."

This is the first example of the phrase ‘first carry out…’, which I never use but we’ll see more later.

1 Like

Chapter 7: Continued:

Section 7.14 is Going by, going through, going with. It refers to vehicles, doors, and pushing:

Instead of going to the Front Stacks by the trolley, say "The Front Stacks are far too confined for the trolley to manoeuvre into them."

(Reminds me of the hedge roller in Curses!, which is fun)

Before going through the green baize door, say "Through you go..." After going through the green baize door: try looking; say "...and here you are."

Instead of going from the Office with the trolley, say "But it looks perfectly placed here. Why push any further?"

(It seems in the first example the player is riding the trolley, while in the third they are pushing).

A final nugget of wisdom:

“Going” is not the only action which moves the player. Another is “exiting”, an action which moves the player out of whatever he/she is currently in or on. This action is often caused by the player typing just OUT or GET DOWN, and there’s no noun as such. But Inform allows the syntax “exiting from” to make it easier to write rules about the exiting of particular containers or supporters:

After exiting from the Mini Cooper:
    say "You painstakingly unpack your limbs from the tiny car."

Many examples!

First is 104, No Relation:

Instead of going by a vehicle (called the auto) to somewhere offroad:
    say "You can't drive [the auto] off-road."

The ignition is part of the car. Instead of going by the car when the ignition is switched off: say "The ignition is off at the moment." Instead of switching on the car, try switching on the ignition. Instead of switching off the car, try switching off the ignition.

We have to specify ‘going by a vehicle’ instead of ‘going by something’, since otherwise if a player is on a pedestal and tries going north this rule will trigger.

Example 105 is Mattress King:

After going a direction (called way-pushed) with something (called the thing-pushed):
    say "You push [the thing-pushed] [way-pushed] to [the location].";
    continue the action.

(Usually inform just prints the description of the new room)

Example 106 is One Short Plank, a bridge that collapses if the player is carrying something over it or pushing something onto it:

The East Jungle is a room. The plank bridge is west of the East Jungle and east of the West Jungle. The plank is an open unopenable door. "A precarious plank bridge extends [if the location is West Jungle]east[otherwise]west[end if] across the chasm." The description of the plank is "Extremely fragile and precarious."

Instead of going through the plank when the player is carrying something:
say "You step gingerly across the plank, which bows under your weight. But your meagre possessions are the straw which breaks the camel's back!";
end the story.

After going through the plank:
say "You step gingerly across the plank, grateful that you're not burdened.";
continue the action.

There is a feather in the East Jungle.

The gigantic stone ball is a thing in the West Jungle. It is pushable between rooms.

Before going through the plank with something:
say "Surely you jest." instead.

Example 107 is Provenance Unknown:

This example uses the rare and mysterious ‘setting action variables’ command, generally used for when the authors are pulling something monstrous and outrageous out of nowhere:

Setting action variables for pushing something to:
    if the noun is enclosed by a pushable between rooms thing (called the pushed item) which is in the location:
        now the noun is the pushed item instead.

Example 108, Zorb, lets players push things up or down.

The new can't push unpushable things rule is listed instead of the can't push unpushable things rule in the check pushing it to rules.

This is the new can't push unpushable things rule:
    if the noun is not pushable between rooms:
        say "[The noun] [are] not amenable to being pushed from place to place." instead.

The can't push vertically rule is not listed in any rulebook.

Section 7.15 is ‘Kinds of action’. I alluded to this earlier; it’s a way to group actions to make rules about them together.

I have a lot of testers who like to do weird things like lick the sun, so I take every action involving physically touching something and call it ‘physicality’, and have rules like ‘instead of physicality when the noun is distant…’

Here’s the books example:

Kissing Mr Carr is unmaidenly behaviour.
Doing something to the painting is unmaidenly behaviour.

Instead of unmaidenly behaviour in the Inn, say "How unmaidenly!"

Example 109 is Dearth and the Maiden, based on novelist Georgette Heyer. It essentially uses the above example.

Example 110 is Mimicry:

Asking someone about something is speech. Telling someone about something is speech. Answering someone that something is speech. Asking someone for something is speech.

Before speech in the presence of an ungreeted person: try waving hands.

One complication is that “asking someone to try doing something”, which describes commands such as FRED, GO SOUTH, cannot be made into a kind of action. This requires its own rule:

Before asking someone to try doing something in the presence of an ungreeted person: try waving hands.

Check waving hands:
    unless the player can see someone who is not the player, say "You are alone." instead.

Carry out waving hands:
    say "You nod hello to [the list of ungreeted people who can be seen by the player].";
    now every ungreeted person who can be seen by the player is greeted.

The report waving hands rule is not listed in the report waving hands rulebook.

This example also includes some arcane rules:

A persuasion rule:
    describe poor reception;
    persuasion fails.

To describe poor reception:
    if the player is in the Invisible box,
        say "Everyone convulses with silent laughter as you try to shout from within the invisible box.";
        say "You attempt to convey your meaning with gesture and interpretive dance, but [the list of visible other people] scorn[if the number of visible other people is 1]s[end if] your performance, refusing to respond."

I’ve never used persuasion rules or persuasion fails, so I look forward to learning more about this.

7.16 is Repeated actions. I think someone was asking about this recently:

Instead of examining the tapestry for the third time, say "All right, so it's a masterpiece, but is this really the time to make a detailed study?"

Instead of examining the urn at least twice, say "It's an urn. What do you want from me?"

Instead of going nowhere for the 20th time, say "Do stop walking into walls, there's a good fellow."

Typing something like:
Instead of taking something for the fourth time, say "No. I'm capricious."

means that it is the fourth time a “taking…” action has been tried, and does not mean that the same item was taken each time. Also, note that we are counting the number of times the action has been tried, not the number of times it succeeded.

Example 111 is Y ask Y?

A thing can be examined or unexamined. A thing is usually unexamined. Carry out examining something: now the noun is examined.

Taking inventory is acting confused. Looking is acting confused. Examining an examined thing is acting confused.

After acting confused for the sixth turn:
say "(If you are feeling lost, try typing HELP for suggestions.)"

I remember reading about Lynnea Glasser designing Coloratura (one of the best parser games of the 2010s) and doing stuff like this but more subtly, so that if the player is stuck the game gently guides them forward.

Example 112 is a true 4-star example. It is the entire text of Emily Short’s A Day for Fresh Sushi, which is a real game in its own right that is fun to play. It has a fish that comments on everything you do. It says stuff like

After examining cloths for the first time:
    say "'Whatcha looking at? I can't see through the doors, you know.'"

Section 7.17 is Actions on Consecutive turns:

We can also reckon the number of consecutive turns on which an action has been repeated, by talking about “turns” instead of “times”, as demonstrated in the following example story. Note also that we are allowed to use the phrase “doing it” to mean “the same description as the previous one except for the part about turns or times”, like so:

Instead of examining the Daily for the first time, say "The best article seems to be about how your star sign affects your best swimsuit colour. Really: that's the best article."

Instead of doing it for the second time, say "You now know a generous amount about a typical week in the life of a weather forecaster."

Instead of doing it for the third time, say "You would now know how to cook herb bread, except that you have already forgotten the names of both of the herbs."

Instead of doing it more than three times, say "Nope, you've drained it of all conceivable sustenance, even the small ads about French farmhouses to let (sleeps 7) and breast reduction surgery (with alarming photographs in sallow light)."

After waiting for four to six turns, say "This is getting mighty dull." After waiting for seven to eight turns, say "Really, exceptionally dull." After waiting for nine turns, end the story saying "You have died of boredom, something previously thought medically impossible".

So I think only the bottom example uses the new ‘turns’ phraseology.

Finally, Section 7.18 is Postscript on actions, which just says that future sections will explain how to make NPCs do actions, create new actions, and completely redirect the effects of an action.

Great chapter! This is the real core stuff here.

1 Like

That’s the explanation given in the documentation, but I suspect it was also to avoid conjugating verbs. “Try”, “report”, “instead of”, etc are all words that can be followed by a gerund: “waiting” instead of “wait” or “waits” or such.

Actually it’s the report messages. Though those won’t be introduced for a few more chapters.

The flow of action processing goes…

  • Before: Should anything special be done before this action happens? I generally use these rules to redirect one action into another.
  • Feasibility checks: Can the player touch things that need to be touched? Is there sufficient light? If you asked someone else to do the action, are they willing to do it? This stage isn’t its own rulebook, by default, but some extension authors turn it into one: the “Precondition” rules.
  • Instead: The action is now known to be feasible. Are there special exceptions that should apply to this situation? I use these liberally, for any special situations pertaining to my game. By default, an Instead rule will stop the action, preventing any further processing.
  • Check: Are there standard reasons this action should fail, like taking something that’s fixed in place? This is the last chance to make the action fail.
  • If it reaches this point, the action is considered a success.
  • Carry out: The standard functionality of the action. Taking something moves it into the actor’s inventory. Most actions don’t print anything in this stage; the ones that do are things like examining, where the only effect is to print something.
  • If the action was tried “silently”, stop processing now.
  • After: Does the author want a special description for this situation? By default, an After rule will stop the action, preventing any further processing. (But this doesn’t make the action fail: it already succeeded.)
  • If the action was done by someone else, and the player can’t see that person, stop processing now.
  • Report: The standard description for the action. This is the stage that prints “Taken.” when you take something.

Yep, you can go TO (a room), FROM (a room), BY (a vehicle), WITH (a pushable thing), and/or THROUGH (a door).

And if you want, you can even create new prepositions like this: that’s what “setting action variables” rules are for! In Counterfeit Monkey, for example, an action variable lets you write rules about “waving the letter-remover at something creating an ant”.


I peeked ahead, and it looks like this is one of the largest chapters for a while, with the very biggest chapter being Advanced Phrases.

Chapter 8 - Change

Section 8.1 is Change of Values that Vary. The whole idea of this chapter is that we alter the basic worldstate or mechanics, as opposed to what we did in the last chapter which is just completely replace mechanics or use what is in place.

In this section we learn to use ‘now’ to set variables:

The prevailing wind is a direction that varies. The prevailing wind is northwest.

Instead of waiting when the prevailing wind is northwest:
    say "A fresh gust of wind bowls you over.";
    now the prevailing wind is east.

They point out that the type matters in Inform, so since we called the prevailing wind a direction, we can only use ‘now’ to set it to other directions, not numbers or rooms or texts.

Constants cannot be changed. This gives an error:

Colour is a kind of value. The colours are blue, red and mauve.

After pulling the psychedelic lever:
now blue is mauve.

Section 8.2 is Changing the Command prompt. I’ve seen a few people do this recently!

You change it pretty easily:

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

and you can even put variable text in there:
When play begins: now the command prompt is "[time of day] >".

Section 113 is Don Pedro’s revenge, a complex example where you are given partially filled sentences as the command prompt, like so:

Table of Random Prompts

position prompt
boxed "So securely boxed-in that you can really only parry or thrust, you try to "
boxed "Trapped between your barrels, you decide to "
perched "Able to slice at your attackers but not to advance or retreat, you choose to "
perched "Perched up here with the advantage of height (but little mobility), you attempt to "
free "Out on the open deck with no impediments, free to advance or retreat, you decide to "
When play begins: reset the prompt.

Every turn: reset the prompt.

To reset the prompt:
    sort the Table of Random Prompts in random order;
    repeat through the Table of Random Prompts:
        if the position entry is the placement of the player:
            now the command prompt is prompt entry;

Section 8.3 is Changing the Status Line. I’ve done this a lot in the past (I found a neat way to use Javascript to play music or display images in response to the status line, so it’s important in several of my games).

You just say Now the left hand status line is "" or Now the right hand status line is "".

The default value for the right hand status line is blank (or the score and turn count if scoring is on), while the default value for the left hand status line is “[player’s surroundings]”, which is either the location, or in darkness, or in an opaque container.

Example 114 is Politics as Usual:

When play begins:
now the right hand status line is "[map region of the location]".

Washington is west of Idaho.

Red is a region. Blue is a region. Idaho is in red. Washington is in blue.

I wondered when I saw this what would happen in my game where I have nested regions, but there’s a note that says it prints the smallest region available if there is ambiguity.

Example 115 uses the useful extension ‘Basic Screen Effects’ by Emily Short:

Rule for constructing the status line:
    center "[location]" at row 1;
    rule succeeds.

Section 9.4 is change of either/or properties. There’s not much special here, we just use ‘now’:

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.

It just mentions that you set a property that is already set (like making an open door open), just nothing happens, but if you try to give something a property is shouldn’t have (like making a number examined), it throws up an error.

Example 16 is “Vitrine”:

The smart window can be transparent. The smart window is transparent.

Carry out switching off the window: now the window is transparent.

Carry out switching on the window: now the window is opaque.

Section 8.5 is Change of properties with values. This is almost identical to the last one; we still use the same format:
now the printed name of the Closet is “Suddenly Spooky Closet”
The game just checks to make sure that you’re putting in a value of the appropriate type, and that the object has that kind of value associated with it.

The only thing in this section that doesn’t use the ‘now’ format is ‘change’ for changing exits of a room (due to like a landslide or a hidden door or something):

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

You can also change an exit to ‘nothing’ if it gets closed off:

change the west exit of the Closet to nowhere

Example 117 is Thirst:

The player carries a waterskin. The waterskin can be full, partly drained, or empty. The waterskin is full. Understand "water" as the waterskin.

Instead of drinking the waterskin when the waterskin is empty:
say "There is no water left."

Instead of drinking the waterskin: if the waterskin is partly drained, now the waterskin is empty; if the waterskin is full, now the waterskin is partly drained; say "You drink a long draught."

Example 118 is Thirst 2, which includes a campfire:

There’s a lot here, but there’s one part that’s especially useful for new people I think (having some stuff disappear while other stuff appears):

Instead of burning the whole kindling:
    if the tinder is not flaming:
        say "You need the tinder to be flaming, first.";
        now the tinder is nowhere;
        now the kindling is nowhere;
        move the campfire to the location;
        say "You succeed in lighting yourself a proper campfire.";
        now the printed name of Campsite is "By The Campfire".

Section 8.6 is “Whose property”. This is something I didn’t realize for a while, that if some object is currently being referenced, you can omit its name:

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

So we don’t have to say ‘printed name of the west ballroom’ here, it just prints it itself.

This works but I’m not sure if it works in action definitions, which is where I’ve tried it the most and had it fail the most.

Section 8.7 is ‘moving things’. I always use ‘now the ___ is in ___’, but this is a different notation that I think affects rules differently. I often wish there was a nice way to move people from one room to another or from a container to its larger room without inform printing the new room’s description (if anyone has a nice answer let me know!)

Here we go:
move the genie's lamp to Aladdin's Cave;

oh my gosh…

it’s…it’s right here…I…

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

I could cry right now…this is everything to me…

We can also say ‘printing an abbreviated room description’ which only prints the description if the player has been their before, and is only when moving the player.

We can move things to people (which makes it carried):

move the genie's turban to Aladdin;

Or we can make it worn, but not with move:
now the genie's turban is worn by Aladdin;

Section 8.8 is Moving Backdrops.

Backdrops are secretly just scenery that is moved from room to room, following the player.

But nominally we have it ‘in’ a cluster of rooms at once, and can move it that way.

So we can move a backdrop called ‘stream’ to a region with either of these commands:

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

Or we can move the backdrop with a command describing rooms:

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

move the stream backdrop to all wet rooms;

However, backdrops only update when you move, so this doesn’t work to make a backdrop appear in the player’s location. You can fix this with the following command:
update backdrop positions;

Finally, backdrops can go nowhere or everywhere:

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 is Orange Cones.

The traffic is a backdrop. It is not scenery. 

When play begins:
move the traffic backdrop to all accessible roads.

A line of orange cones are a thing.

Definition: a road is accessible if the orange cones are not in it.

After dropping the orange cones in a road:
say "With steely determination you begin to lay out the orange cones, blocking access to this segment of street. This produces honking and swearing -- but you persevere.";
update backdrop positions.

After taking the orange cones:
say "You go around taking up the orange cones, and within moments the traffic begins to flow into the street again.";
update backdrop positions.

I’ve never scene a backdrop that was declared not to be scenery; cool! It seems to allow it to be seen and have an initial appearance.

Section 8.9 is Moving the Player.

We’ve learned two ways to move the player:

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

[T]acking 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.

You can also move the player viewpoint, which I love to do!

now the player is Bob

This can cause some issues with reporting rules:

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 121 is Terror of the Sierra Madre.

Teresa is a woman in the Hay-Strewn Corridor. "Teresa stands opposite you[if Teresa carries something], her fingers wrapped tightly around [a list of things carried by Teresa][end if]." Teresa carries a bulb of garlic and a cross.

Maleska is a man in the Hay-Strewn Corridor. "Maleska watches you from eyes entirely black." Maleska carries a skull.

The player is Maleska. Understand "Maleska" as Maleska.

Now the Corridor contains just two people, and we arrive on the scene as Maleska, with only Teresa facing us.

Every turn:
    if the player is Maleska, now the player is Teresa;
    otherwise now the player is Maleska.

When you are someone, the printed name of that person is “yourself”. You can fix it with this:

Rule for printing the name of Teresa: say "Teresa".

Rule for printing the name of Maleska: say "Maleska".

Section 8.10 is Removing things from play

This is a useful section. It just says you can put stuff nowhere, either at the beginning:

The lamp is nowhere.

or in the middle of the game:

now the lamp is nowhere;

The old phrase was ‘remove ___ from play’, but that is now deprecated! You can’t remove rooms, doors, or the player, but can remove backdrops.

The opposite of nowhere is ‘somewhere’, and the two can be referred to as ‘on-stage’ or ‘off-stage’.

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

This is really core stuff, and I use this all the time. Before I understood it, I had a room called ‘Limbo’ and put everything in it, but not anymore (although I did do that in my Dialog game).

Example 122 is Beverage Service:

Instead of drinking a potion (called the drink):
    now the drink is nowhere;
    say "You quaff [the drink]. It goes down beautifully."

Example 123 is Spring Cleaning:

A thing can be tough or fragile. A thing is usually tough.

Instead of attacking something fragile:
    say "You smash [the noun] to smithereens!";
    now the noun is nowhere.

Example 124 is Extra Supplies:

This is a fantastic example where you want to model a supply of limitless items, but only allow the player to take one at a time. Whenever anyone wants to create 100s of indistinguishable objects, this is the better option much of the time. I’ll reproduce the whole thing:

The Supply Closet is a room. A supply of red pens is in the Supply Closet. Understand "pen" as the supply of red pens when the red pen is not visible.

There is a red pen.

Instead of taking the supply of red pens:
    if the red pen is off-stage:
        move the red pen to the player;
        say "You help yourself to a fresh red pen.";
        say "You're only allowed one pen at a time. The department secretary is very strict."

South of the Supply Closet is the Furnace Room. The incinerator is a thing in the Furnace Room. It is a container. "The incinerator is here, working full blast."

After inserting something into the incinerator:
    now the noun is nowhere;
    say "A fiery blast consumes [the noun]!"

Section 8.11 is “Now”. We’ve used the ‘now’ command in every other section, so I’m not sure why this is here…it just gives a bunch of 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;

It says we can’t be impossible or vague, and says we have three ways of doing things with conditions:

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.

Example 125 is Bee Chambers, making a random maze (which is described as a bad idea):

A Bee Chamber is a kind of room.

Bee1, Bee2, Bee3, Bee4, Bee5, Bee6, Bee7, Bee8, Bee9, and Bee10 are Bee Chambers.

When play begins:
    now right hand status line is "[number of visited rooms]/[number of rooms]";
    repeat with place running through Bee Chambers:
        now a random Bee Chamber is mapped north of place;
        now a random Bee Chamber is mapped northwest of place;
        now a random Bee Chamber is mapped west of place;
        now a random Bee Chamber is mapped southwest of place;
        now a random Bee Chamber is mapped south of place;
        now a random Bee Chamber is mapped southeast of place;
        now a random Bee Chamber is mapped east of place;
        now a random Bee Chamber is mapped northeast of place;
        now a random Bee Chamber is mapped above place;
        now a random Bee Chamber is mapped below place;
        now a random Bee Chamber is mapped inside place;
        now a random Bee Chamber is mapped outside place.

The next, Example 126 Hatless, shows a pitfall of pre-game randomization:

A hat is a kind of thing. A hat is always wearable. Definition: a person is hatless if he is not the player and he does not wear a hat.

The indigo bowler, the polka-dotted fedora, the pink beret, and the scarlet cloche are hats.

When play begins:
now every hat is worn by a random hatless person.

This picks a random person and puts every hat on them!

So instead you should type:

When play begins:
    now every hatless person wears a random hat.

Except that that gives one hat to everyone (one at a time)

so finally:

When play begins:
    repeat with item running through hats:
        now the item is worn by a random hatless person.

This is our first example of ‘repeat with item running through…’ that shows up in the main part of a small example, that I can remember. It was probably part of a bigger example earlier.

Example 127 is Technological Terror:

Carry out shooting something with something:
    say "ZAP! [The noun] twinkles out of existence! [if something is part of the noun][The list of things which are part of the noun] clatter to the ground! [end if][paragraph break]";
    now every thing which is part of the noun is in the location;
    now the noun is nowhere.

Section 8.12 is increasing and decreasing. I struggled with this a lot before; this is just arithmetic. Inform’s format is a little clunky, but so is Dialog’s. How is TADS at math?

Here are some ways of increasing things:
now the score is the score plus six;

increase the score by 8;
increase the time of day by 5 minutes;

or decreasing things:

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

There is also an equivalent of the ‘++’ from C:
increment the score; just increases the score (or whatever variable you type) by 1.
decrement the score; does the same.

8.13 is Checking on whereabouts. This section is mainly a list of examples:

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 ...

The following are equivalent:

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

So if we want to check it being carried by anybody, not just the player, we need something else (probably ‘carried by anybody’, is my guess).

Section 8.14 is More Flexible Descriptions of whereabouts. It’s the same thing but allows generic kinds, or nouns or kinds modified by adjectives, instead of specific things:

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

Section 8.15 is ‘Calling names’

This is a:

majorly important section

This is when you want to vaguely describe an object and then use a name for it later:

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

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]?"

You have to place this parenthetical clause (phrase?) directly after its antecedent:

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

Example 128 is Higher Calling:

Before going through a closed door (called the blocking door):
    say "(first opening [the blocking door])[line break]";
    silently try opening the blocking door;
    if the blocking door is closed, stop the action.

Section 8.16 is Counting Things. I usually use this for lists and stuff. You just say ‘the number of [description of things]’ and it gives you a number. Like:

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

I use ‘the number of’ 34 times in my game, for instance here:

To decide what lightcolor is currentcolor:
	if the number of switched on light-switches is 3, decide on white;
	if the number of switched on light-switches is 2:
		if green-switch is switched off, decide on magenta;
		if blue-switch is switched off, decide on yellow;
		if red-switch is switched off, decide on cyan;
	if red-switch is switched on, decide on red;
	if blue-switch is switched on, decide on blue;
	if green-switch is switched on, decide on green;
	decide on black;

You can also count weird things, like:
the number of non-recurring scenes
but not ‘the number of numbers’.

Section 8.17 is Looking at containment by hand

holder of (object) … object

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

This section delves into lists. There are a few phrases here I’ve never used (heck, I’ve never used ‘the holder of’ at all!):

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.

This seems kind of weird, honestly. How do you know when to stop? If you were in a repeat through loop, you wouldn’t be using this phraseology anyway. Just seems weird…

Section 8.18 is randomness!

a random (name of kind) between (arithmetic value) and (arithmetic value) … value


a random (name of kind) from (arithmetic value) to (arithmetic value) … value


a random (name of kind) between (enumerated value) and (enumerated value) … value


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

When you create values, it implicity orders them, so you can do this:
A cloud pattern is a kind of value. The cloud patterns are cumulus, altocumulus, cumulonimbus, stratus, cirrus, nimbus, nimbostratus.

Then a random cloud pattern between stratus and nimbus can only be stratus, cirrus, or nimbus.

I occasionally use the next one, although I deplore randomness in my games in general:
if a random chance of 2 in 3 succeeds, ...
Instead of waiting when a random chance of 15 in 100 succeeds: ...

To fix the random number generator to a specific random seed for testing:

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

(or replace 1234 with some other positive number).

Lots of examples!

Example 129 is Do Pass Go:

Check rolling when the noun is not the pair of dice: say "Not something you can roll." instead.
Carry out rolling:
    now the pair of dice is in the holder of the actor;
    now the first die of the pair of dice is a random number from 1 to 6;
    now the second die of the pair of dice is a random number from 1 to 6.

This is just a segment, but notice how when you roll them they are in ‘the holder of the actor’. This is so if you roll dice while on a platform, it stays on the platform, or if in a cage, it stays in the cage.

Example 130 is Lanista part 1. This is basic combat!:

Instead of attacking someone:
    let the damage be a random number between 2 and 10;
    say "You attack [the noun], causing [damage] points of damage!";
    decrease the current hit points of the noun by the damage;
    if the current hit points of the noun is less than 0:
        say "[line break][The noun] expires, and is immediately carried away by the Arena slaves!";
        now the noun is nowhere;
        end the story finally;
        stop the action;
    let the enemy damage be a random number between 2 and 10;
    say "[line break][The noun] attacks you, causing [enemy damage] points of damage!";
    decrease the current hit points of the player by the enemy damage;
    if the current hit points of the player is less than 0:
        say "[line break]You expire!";
        end the story.

Example 131 is Weathering, which I print in its entirety:

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

The Mount Pisgah Station is a room. "The rocky peak of Mt. Pisgah (altitude 872m) is graced only by an automatic weather station. The clouds, close enough almost to touch, are [a random cloud pattern]. Temperature: [a random number from 7 to 17] degrees, barometric pressure: [950 + a random number from 0 to 15] millibars."

Example 132 is Uptown Girls:

Every turn when a random chance of 1 in 3 succeeds:
reset passerby;
choose a random row in the Table of Atmospheric Events;
say "[event entry][paragraph break]"

Table of Atmospheric Events
"Slowly [a passerby] strolls by, turning to look at you as she passes."
"Some [passerby] nearly bumps into you."
"You dodge to avoid [a passerby]."
"You weave around [a passerby], who has stalled to look into a window."
"There's a ruckus as one of the ubiquitous taxis nearly collides with [a passerby] crossing the street."
"[The passerby] beside you waves to a friend across the street."
"To your left, [a passerby] drops her purse, and swears as she retrieves it."

Hair color is a kind of value. A person has hair color. the hair colors are red-headed, brunette, blonde.

Height is a kind of value. A person has height. The heights are tall, medium-height, short.

Grooming is a kind of value. A person has grooming. The groomings are messy and tidy.

To reset passerby:
now the hair color of the passerby is a random hair color;
now the height of the passerby is a random height;
now the grooming of the passerby is a random grooming.

There’s also a neat trick with tables at the end of this example, which I have not reproduced.

Finally, 8.19 is Random Choice of things:

a random visited room
a random scene

Often when there is one thing of a kind in a room and I want to great it, I say ‘let X be a random ____ in the location’. Sincere there is only one ____ in the location, this will always pick exactly that one.

For instance, I have this in my current game:

Instead of giving something to frankenstein:
	if the noun is oncefrankheld:
		let current be a random thing carried by Frankenstein;
		say "'Hmm, fine, I'll take it back,' says Frankenstein. 

	He grabs [the noun] from you and hands you [the current].";
		now current is carried by the player;
		now the noun is carried by Frankenstein;
		let current be a random thing carried by Frankenstein;
		say "Frankenstein says, 'Ooh, what's this? Is it valuable?'

	He grabs [the noun] from you and hands you [the current].";
		now current is carried by the player;
		now the noun is carried by Frankenstein;

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

If there are no adjacent ways, it prints You can see 0 ways from here; how about nothing?

Example 133 is Candy:

Toxicity is a kind of value. The toxicities are safe and poisonous. A piece of candy has a toxicity. A piece of candy is usually safe.

When play begins:
now a random piece of candy is poisonous.

Example 134 is Zork II (not the whole game! Just the Carousel Room):

Instead of going from the Carousel Room:
    move the player to a random adjacent room.

You can only omit the object name if you’re defining a text property of an object. That’s the only situation where the compiler really knows what object is “the item described”.

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

In this example, of course, you’re defining the room’s description property. This is by far the most common case, which is why the I7 term is “the item described”.

1 Like