§7.2. Instead rules
An action is ordinarily handled by running it through Inform's extensive rulebooks of what might be called normal behaviour. An action such as "taking the napkin", for instance, will be run through numerous checks to see if it is physically reasonable, and then provided all is well, the napkin will be moved into the possession of the player.
Instead, though, we can bypass the rules to do with an action and do something else:
Instead of eating the napkin: say "Why not wait for the actual dinner to arrive?"
This is an example of a "rule": a set of circumstances followed by a list of instructions. When those circumstances apply, the instructions are carried out. In the case of an "instead" rule, after this is done the action is immediately ended (and counts as a failure, since the original intention has been thwarted).
A friendly alternative can be used when there is only a single instruction, as here: in such rules the colon can be replaced with a comma. Thus:
Instead of eating the napkin, say "Why not wait for the actual dinner to arrive?"
|
Descriptions of objects can be used in "Instead" rules: we can not only say "Instead of taking the steak", but also "Instead of taking something" or "Instead of taking something which is on the grill". That last rule is useful if, for example, we want to prevent the player from interacting with anything on a specific supporter:
We could just as easily adapt this rule to affect a container: "Instead of taking something which is in the ice chest," for example. Note also that in older versions of Inform, the pattern "get all from..." was treated differently from "get steak", and had to be accounted for separately. This is no longer the case; this instead of taking... rule will handle all the phrasings which the player might use to try to acquire this object. |
|
Descriptions of objects can be used in "Instead" rules: we can not only say "Instead of taking the steak", but also "Instead of taking something" or "Instead of taking something which is on the grill". That last rule is useful if, for example, we want to prevent the player from interacting with anything on a specific supporter:
We could just as easily adapt this rule to affect a container: "Instead of taking something which is in the ice chest," for example. Note also that in older versions of Inform, the pattern "get all from..." was treated differently from "get steak", and had to be accounted for separately. This is no longer the case; this instead of taking... rule will handle all the phrasings which the player might use to try to acquire this object. Descriptions of objects can be used in "Instead" rules: we can not only say "Instead of taking the steak", but also "Instead of taking something" or "Instead of taking something which is on the grill". That last rule is useful if, for example, we want to prevent the player from interacting with anything on a specific supporter:
We could just as easily adapt this rule to affect a container: "Instead of taking something which is in the ice chest," for example. Note also that in older versions of Inform, the pattern "get all from..." was treated differently from "get steak", and had to be accounted for separately. This is no longer the case; this instead of taking... rule will handle all the phrasings which the player might use to try to acquire this object. |