Inform 7 Home Page / Documentation


Chapter 19: Rulebooks

§19.1. On rules; §19.2. Named rules and rulebooks; §19.3. New rules; §19.4. Listing rules explicitly; §19.5. Changing the behaviour of rules; §19.6. Sorting and indexing of rules; §19.7. The preamble of a rule; §19.8. New rulebooks; §19.9. Basis of a rulebook; §19.10. Rulebook variables; §19.11. Success and failure; §19.12. Named outcomes; §19.13. Rulebooks producing values; §19.14. Abide by; §19.15. Two rulebooks used internally; §19.16. The Laws for Sorting Rulebooks

arrow-up-left.png Contents of Writing with Inform
arrow-left.png Chapter 18: Activities
arrow-right.png Chapter 20: Advanced Text
arrow-down-right.png Indexes of the examples

§19.1. On rules

When we open the casing and look inside the machinery of Inform, what we see are rules and rulebooks. We seldom need to know how this machinery works, but every once in a while we want to replace components, or even install new mechanisms of our own. And as we shall see, creating new rulebooks can be a neat way to tackle complicated simulations full of exceptions and special cases.

So far we have seen many rules, and the term "rulebook" has frequently but vaguely been used. Here is a summary of the rulebooks seen so far:

before
instead
after
check taking, carry out taking, report taking
and three similar rulebooks for each of the 90 or so actions
persuasion
unsuccessful attempt
reaching inside
reaching outside
visibility
does the player mean

when play begins
when play ends
every turn
when Confrontation Scene begins
when Confrontation Scene ends
and two similar rulebooks for each scene we create, if any

before printing the name of
for printing the name of
after printing the name of
and three similar rulebooks for each of the 20 or so activities

Which makes around 340 rulebooks before we even start to write. All the same, not everything in Inform belongs to a rulebook - timed events, for example, are rules which normally live outside of rulebooks; and other constructions, such as newly-created phrases, or definitions, may look vaguely like rules, but they aren't. So the following are not rulebooks:

At 11:10 PM: ...
To dislodge the shelf: ...
Definition: ...


arrow-up.png Start of Chapter 19: Rulebooks
arrow-left.png Back to Chapter 18: Activities: §18.40. Starting the virtual machine
arrow-right.png Onward to §19.2. Named rules and rulebooks