Delicious, Delicious Rocks
In some cases, we may want to add new stages to action processing. One possibility is a stage where we check the sanity of what the player is trying to do before executing any of the other commands; so that we avoid, for instance
Here is how we might insert such a stage in our action processing, using rulebook manipulation.
Test me with "eat lollipop / eat rock".
You can see a lollipop tree and a genuine rock here.
>(Testing.)
>[1] eat lollipop
(first taking the lollipop tree)
You eat the lollipop tree. Not bad.
>[2] eat rock
Your digestion is so delicate -- you're sure the genuine rock wouldn't agree with you.
Notice that now Inform does not try taking the rock before rejecting the player's attempt to eat it.
It is of course possible to get the same effect with
…and in a small game with few rules, there's not much reason to add an extra stage. The ability to modify the stages of action processing becomes useful when we have a fairly large game with sophisticated modeling and want to be sure that some kinds of message (such as the sanity-check) are always handled before other things that we might be doing at the before stage (such as generating implicit actions like opening doors before going through them).