Chapter 18: Rulebooks
18.15. Phrases concerning rules


This section and the previous one are about a feature which is being withdrawn from Inform in future. Experience shows there are equally good ways to achieve the same ends without needing procedural rules. As elegant as they were, they often confused users, and they were expensive at run-time (that is, they made everything work more slowly). Withdrawing them from Inform will make it possible to make more efficient story files, and will simplify the language.

The "ignore" phrase is only one of a suite, which should only be used in procedural rules. The full list is:

ignore (rule)

This phrase can only be used in procedural rules, which are now deprecated. It causes the named rule to be ignored (skipped over without producing a result) within the scope of the current "follow".

reinstate (rule)

This phrase can only be used in procedural rules, which are now deprecated. Its only effect is to reverse the effect of any "ignore" phrase affecting the rule named.

reject the result of (rule)

This phrase can only be used in procedural rules, which are now deprecated. It causes the named rule to used, but to have its result ignored, within the scope of the current "follow". In other words, if the rule succeeds or fails then this is suppressed and its rulebook continues.

accept the result of (rule)

This phrase can only be used in procedural rules, which are now deprecated. Its only effect is to reverse the effect of any "reject the result of" phrase affecting the rule named.

substitute (rule) for (rule)

This phrase can only be used in procedural rules, which are now deprecated. Whenever the second rule is to be invoked - from any rulebook, or as a result of any "follow" instruction - invoke the first one instead.

restore the original (rule)

This phrase can only be used in procedural rules, which are now deprecated. Its only effect is to reverse the effect of any "substitute ... for ..." phrase affecting the rule named.

move (rule) to before (rule)

This phrase can only be used in procedural rules, which are now deprecated. This causes the first rule to be ignored whenever it turns up in the ordinary way, but to be invoked either immediately before the second rule whenever that second rule is invoked. In effect, it cuts out the first rule from wherever it was, and glues it onto the second. Note that there is no obligation for the first rule to begin in the same rulebook(s) as the second, so this can be used to slot in a wholly new rule, perhaps only if certain circumstances hold.

move (rule) to after (rule)

This phrase can only be used in procedural rules, which are now deprecated. This causes the first rule to be ignored whenever it turns up in the ordinary way, but to be invoked either immediately after the second rule whenever that second rule is invoked. In effect, it cuts out the first rule from wherever it was, and glues it onto the second. Note that there is no obligation for the first rule to begin in the same rulebook(s) as the second, so this can be used to slot in a wholly new rule, perhaps only if certain circumstances hold.

These rule-changing instructions allow apparently casual sentences to wreak havoc with the model world. This, for instance, is quite the recipe for mayhem and perplexity:

A procedural rule:
    reject the result of the before rules;
    ignore the after rules;
    move the after rules to before the before rules.


391
* Example  Uptempo
Adjust time advancement so the game clock moves fifteen minutes each turn.

RB
392
** Example  Solitude
Novice mode that prefaces every prompt with a list of possible commands the player could try, and highlights every important word used, to alert players to interactive items in the scenery.

RB
393
** Example  Swigmore U.
Adding a new kind of supporter called a perch, where everything dropped lands on the floor.

RB
394
** Example  Lethal Concentration 1
A poisonous gas that spreads from room to room, incapacitating or killing the player when it reaches sufficient levels.

RB
395
*** Example  Lethal Concentration 2
Poisonous gas again, only this time it sinks.

RB

This is a slight variation on the previous gas diffusion example: the main difference is that gas preferentially moves towards lower rooms, and will gradually settle in the bottom floor. We do this by calculating the probability of movement separately for each pair of rooms.

"Lethal Concentration"

A concentration is a kind of value. 200.9ppm specifies concentration. 200.9 ppm specifies concentration.

A room has a concentration called current concentration. A room has a concentration called former concentration.

To decide what number is the probability inverse between (space - a room) and (second space - a room):
    let guess be 20;
    let way be the best route from space to second space;
    if way is up, let guess be 50;
    if way is down, let guess be 10;
    if the guess is less than 10, decide on 10;
    decide on guess.

If we wanted, we could introduce other concerns into the calculation here: open and closed doors, windows between rooms, rooms that are outdoors vs. those that are indoors, and so on. The possibilities are numerous, so we will stick with the simple principle that our poison gas sinks.

Every turn:
    follow the diffusion rules.

The diffusion rules are a rulebook.

A diffusion rule (this is the gas movement rule):
    repeat with space running through rooms:
        let sum be 0.0 ppm;
        repeat with way running through directions:
            let second space be the room way from the space;
            if second space is a room:
                let incoming be the former concentration of the second space divided by the probability inverse between second space and space;
                let outgoing be the former concentration of the space divided by the probability inverse between space and second space;
                let difference be incoming minus outgoing;
                increase sum by the difference;
        now current concentration of the space is the former concentration of the space plus the sum.

A diffusion rule (this is the resetting concentration rule):
    repeat with space running through rooms:
        now the former concentration of the space is the current concentration of the space.

The last diffusion rule (this is the lethal dosage rule):
    if the current concentration of the location is greater than LC50:
        say "The concentration in the air overpowers you...";
        end the story;
    otherwise:
        if the current concentration of the location is greater than TLV-STEL:
            say "You feel extremely uncomfortable in this environment."

Instead of doing something when the current concentration of the location is greater than TLV-STEL:
    if going, continue the action;
    say "You can't work in this environment: your eyes and nose sting and it hurts to breathe."

Room 1A is west of Room 1B. Room 1B is west of Room 1C. Room 1C is west of Room 1D. Room 1D is west of Room 1E.

Room 2A is west of Room 2B and below room 1A. Room 2B is west of Room 2C and below Room 1B. Room 2C is west of Room 2D and below Room 1C. Room 2D is west of Room 2E and below Room 1D. Room 2E is south of Room 1E and below Room 1E.

The former concentration of Room 1C is 800.0 ppm.

The status grid is a device carried by the player. The status grid is switched on.

And just for fun, this time we'll make the grid prettier, too:

Every turn:
    try examining the grid.

    Instead of examining the status grid:
    say "[unicode box drawings light down and right][top bar][unicode box drawings light down and left][line break]";
    say "[unicode box drawings light vertical]";
    say "[state of room 1A][state of room 1B][state of room 1C][state of room 1D][state of room 1E] upstairs[line break]";
    say "[unicode box drawings light vertical and right][middle bar][unicode box drawings light vertical and left][line break]";
    say "[unicode box drawings light vertical]";
    say "[state of room 2A][state of room 2B][state of room 2C][state of room 2D][state of room 2E] downstairs[line break]";
    say "[unicode box drawings light up and right][bottom bar][unicode box drawings light up and left][variable letter spacing][line break]"

Include Unicode Character Names by Graham Nelson.

To say top bar:
    repeat with N running from 1 to 9:
        if the remainder after dividing N by 2 is 0, say "[unicode box drawings light down and horizontal]";
        otherwise say "[unicode box drawings light horizontal]".

To say middle bar:
    repeat with N running from 1 to 9:
        if the remainder after dividing N by 2 is 0, say "[unicode box drawings light vertical and horizontal]";
        otherwise say "[unicode box drawings light triple dash horizontal]".

To say bottom bar:
    repeat with N running from 1 to 9:
        if the remainder after dividing N by 2 is 0, say "[unicode box drawings light up and horizontal]";
        otherwise say "[unicode box drawings light horizontal]".

TLV is a concentration that varies. TLV is 30.0ppm. [Long-term exposure maximum, safe for 8 hours a day.]

TLV-STEL is a concentration that varies. TLV-STEL is 50.0ppm. [Short-term exposure maximum, safe for fifteen minutes max.]

TLV-C is a concentration that varies. TLV-C is 150.0ppm. [Absolute exposure ceiling.]

LC50 is a concentration that varies. LC50 is 300.0ppm. [Concentration at which 50 percent of test subjects die of exposure, usually expressed in terms of time and body weight; in our LC50 these are factored in for the player's weight for one minute.]

Include Basic Screen Effects by Emily Short.

To say state of (space - a room):
    if the current concentration of space is less than TLV, say blue letters;
    if the current concentration of space is TLV, say blue letters;
    if the current concentration of space is greater than TLV, say green letters;
    if the current concentration of space is greater than TLV-STEL, say yellow letters;
    if the current concentration of space is greater than TLV-C, say red letters;
    say "[unicode square with diagonal crosshatch fill]";
    say default letters;
    say "[unicode box drawings light vertical]".

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


PreviousContentsNext