§19.4. Listing rules explicitly

If rules can manage perfectly well without, why bother to have names for rules?

The answer is that although Inform contains an elaborate mechanism for placing rules into the correct rulebook at the correct position, and this happens automatically, Inform will sometimes get it wrong. It will use a rule we do not want, or place them in an order which does not suit us. To put this right, we can give explicit instructions which take precedence over Inform's normal practice. This is done with the "to list" verb, as in the following examples.

1. The simplest usage is to place a named rule, which currently has no home, in any rulebook of our choice. (This looks redundant, but just occasionally we want the same rule to appear in two different rulebooks.)

The blossom rule is listed in the every turn rules.

A rule can appear in more than one rulebook, but within any single rulebook it can only appear once.

2. We can also specify that the rule needs to appear before, or after, some other named rule in the same rulebook:

The collapsing bridge rule is listed before the moving doorways rule in the instead rules.

Instead of being placed in specificity order in the whole "instead" rulebook, the "collapsing bridge" rule would now be placed in specificity order only in the first half of the "instead" rulebook - the rules from the start up to (but not including) the "moving doorways" rule. To reiterate: that doesn't necessarily mean it will be immediately before the "moving doorways" rule; it will be placed according to Inform's usual sorting rules within that range.

"Listed" sentences are obeyed by Inform in sequence, so if later ones issue instructions contradicting earlier ones, it's the later ones which win out. Thus if we say "A is listed before B in X" and then "B is listed before A in X", the result is that B comes before A.

3. We can specify that a rule needs to appear first or last in a given rulebook:

The collapsing bridge rule is listed first in the instead rules.

Again, if we make several such instructions about the same rulebook then the most recent one wins: "A is listed first in X. B is listed first in X. C is listed first in X." causes rulebook X to begin C, B, A.

4. We can also substitute one rule for another:

My darkness rule is listed instead of the can't act in the dark rule in the visibility rules.

If rule A is listed instead of rule B in rulebook X, and A was already a rule in rulebook X, then A will move from its previous position to occupy the place where B was, and B will disappear. (In particular rule A will not be duplicated, which would break the principle that no rule occurs twice in the same rulebook.)

5. And we can strike down existing rules, either specifically or in all their applications:

The can't act in the dark rule is not listed in the visibility rules.
The can't remove from people rule is not listed in any rulebook.

This does not actually destroy the rules in question: they could still, for instance, be put into another rulebook, or even be applied explicitly, as we shall see. But unless we take deliberate action to the contrary, un-listing a rule amounts to abolishing it forever. This is a little drastic, and more subtle effects can be seen in the next section.


arrow-up.pngStart of Chapter 19: Rulebooks
arrow-left.pngBack to §19.3. New rules
arrow-right.pngOnward to §19.5. Changing the behaviour of rules

*ExampleUptempo
Adjust time advancement so the game clock moves fifteen minutes each turn.

*ExampleVerbosity 2
Making rooms give full descriptions each time we enter, even if we have visited before, and disallowing player use of BRIEF and SUPERBRIEF.

*ExampleSaint Eligius
Adding a first look rule that comments on locations when we visit them for the first time, inserting text after objects are listed but before any "every turn" rules might occur.

Inform's default assumption is that if a player on an enterable object drops something, the dropped article winds up beside him on the same supporter or in the same container. This makes lots of sense for a dais, say, or a king-sized bed. It's a little less sensible if the enterable supporter in question is a bar stool or the like. So suppose we want to add a new kind of supporter called a perch, where everything dropped lands on the floor.

There are actually several ways of implementing this, but one of them is to reach right into the drop action and replace the "standard dropping rule" with a different one of our own invention -- like this:

paste.png "Swigmore U."

Moe's Tavern is a room. The bar is an enterable supporter in Moe's. A drink is a kind of thing. On the bar is a drink called a flaming Homer.

A perch is a kind of supporter. A perch is always enterable. The stool is a perch in Moe's.

The player carries a dead field mouse and a tomacco fruit.

The sophisticated dropping rule is listed instead of the standard dropping rule in the carry out dropping rulebook.

This is the sophisticated dropping rule:
    if the player is on a perch (called the awkward position):
        let place be the holder of the awkward position;
        move the noun to the place;
    otherwise:
        move the noun to the holder of the player.

Test me with "sit on stool / drop mouse / look / get up / look".

Now the carry-out behavior of the dropping action has been changed, but we haven't had to interfere in the checks or reporting at all. The rest of the action works just as it always did.

Of course, maybe we do want to change the way the action is reported, to make it clearer to the player where the dropped article wound up:

paste.png The sophisticated report dropping rule is listed instead of the standard report dropping rule in the report dropping rulebook.

This is the sophisticated report dropping rule:
    say "You drop [the noun] on [if the holder of the noun is a room]the ground[otherwise][the holder of the noun][end if]."

**ExampleSwigmore U.
Adding a new kind of supporter called a perch, where everything dropped lands on the floor.

Inform's default assumption is that if a player on an enterable object drops something, the dropped article winds up beside him on the same supporter or in the same container. This makes lots of sense for a dais, say, or a king-sized bed. It's a little less sensible if the enterable supporter in question is a bar stool or the like. So suppose we want to add a new kind of supporter called a perch, where everything dropped lands on the floor.

There are actually several ways of implementing this, but one of them is to reach right into the drop action and replace the "standard dropping rule" with a different one of our own invention -- like this:

paste.png "Swigmore U."

Moe's Tavern is a room. The bar is an enterable supporter in Moe's. A drink is a kind of thing. On the bar is a drink called a flaming Homer.

A perch is a kind of supporter. A perch is always enterable. The stool is a perch in Moe's.

The player carries a dead field mouse and a tomacco fruit.

The sophisticated dropping rule is listed instead of the standard dropping rule in the carry out dropping rulebook.

This is the sophisticated dropping rule:
    if the player is on a perch (called the awkward position):
        let place be the holder of the awkward position;
        move the noun to the place;
    otherwise:
        move the noun to the holder of the player.

Test me with "sit on stool / drop mouse / look / get up / look".

Now the carry-out behavior of the dropping action has been changed, but we haven't had to interfere in the checks or reporting at all. The rest of the action works just as it always did.

Of course, maybe we do want to change the way the action is reported, to make it clearer to the player where the dropped article wound up:

paste.png The sophisticated report dropping rule is listed instead of the standard report dropping rule in the report dropping rulebook.

This is the sophisticated report dropping rule:
    say "You drop [the noun] on [if the holder of the noun is a room]the ground[otherwise][the holder of the noun][end if]."

Inform's default assumption is that if a player on an enterable object drops something, the dropped article winds up beside him on the same supporter or in the same container. This makes lots of sense for a dais, say, or a king-sized bed. It's a little less sensible if the enterable supporter in question is a bar stool or the like. So suppose we want to add a new kind of supporter called a perch, where everything dropped lands on the floor.

There are actually several ways of implementing this, but one of them is to reach right into the drop action and replace the "standard dropping rule" with a different one of our own invention -- like this:

paste.png "Swigmore U."

Moe's Tavern is a room. The bar is an enterable supporter in Moe's. A drink is a kind of thing. On the bar is a drink called a flaming Homer.

A perch is a kind of supporter. A perch is always enterable. The stool is a perch in Moe's.

The player carries a dead field mouse and a tomacco fruit.

The sophisticated dropping rule is listed instead of the standard dropping rule in the carry out dropping rulebook.

This is the sophisticated dropping rule:
    if the player is on a perch (called the awkward position):
        let place be the holder of the awkward position;
        move the noun to the place;
    otherwise:
        move the noun to the holder of the player.

Test me with "sit on stool / drop mouse / look / get up / look".

Now the carry-out behavior of the dropping action has been changed, but we haven't had to interfere in the checks or reporting at all. The rest of the action works just as it always did.

Of course, maybe we do want to change the way the action is reported, to make it clearer to the player where the dropped article wound up:

paste.png The sophisticated report dropping rule is listed instead of the standard report dropping rule in the report dropping rulebook.

This is the sophisticated report dropping rule:
    say "You drop [the noun] on [if the holder of the noun is a room]the ground[otherwise][the holder of the noun][end if]."

**ExampleSlouching
A system of postures allowing the player and other characters to sit, stand, or lie down explicitly or implicitly on a variety of enterable supporters or containers, or in location.