Inform 7 Home Page / Documentation
§19.5. Changing the behaviour of rules
Here is another way to abolish an already-existing rule:
The print final score rule does nothing.
The rule continues to be listed in any rulebook it would normally be listed in: but now it doesn't do anything. More usefully, we can attach a condition:
The print final score rule does nothing if the score is 0.
The print final score rule does nothing unless the score is 100.
We can also substitute a rule of our own:
This is the print fancy final score rule:
say "Oh my, you scored a mammoth [score]!"
The print fancy final score rule substitutes for the print final score rule.
and once again a condition can be applied:
The print fancy final score rule substitutes for the print final score rule when the score is greater than 100.
|Start of Chapter 19: Rulebooks|
|Back to §19.4. Listing rules explicitly|
|Onward to §19.6. Sorting and indexing of rules|
Access All Areas
If somebody tries to walk through a closed door, the "can't go through closed doors rule" usually stops them. This is a rule belonging to the "check going" rulebook. These names are fairly explanatory when written out, but hard to remember: fortunately we don't need to remember them, as the Index panel contains a full inventory of the check, carry out and report rules for every action, showing all of their names and the order in which they are checked. (We can also find out which rules are stopping an action by typing the testing command ACTIONS.)
Here we make the rule do nothing provided a condition holds:
(The Pointy Hat may be useful in debugging a game, even if it never makes it into the final published work.)