Inform 7 Home Page / Documentation
§27.20. Primitive Inform 6 declarations of rules
By writing a sentence like this:
we create a new rule, the "underground rule", and also notify Inform that it will have no definition as I7 source text: instead, it will be provided as an I6 routine called "UNDERGROUND_R". We can define this with an Include like so:
Include (-
[ UNDERGROUND_R;
if (real_location hasnt light) { RulebookSucceeds(); rtrue; }
rfalse;
];
-).
The rule should return false if it wants to make no decision, but call either RulebookSucceeds or RulebookFails and return true if it does. These routines can optionally take an argument: which will be the return value from the rulebook.
Note that UNDERGROUND_R itself has no arguments. In the case of an action based rulebook, the I6 variables noun, second and actor can be referred to, while for a value based rulebook the parameter is stored in the I6 global variable parameter_object (which is not necessarily an object, in spite of the name).
We can put this rule into a rulebook in the same way that any named rule can be: