Here’s a quick overview of action rules:
The action sequence, the order in which the game runs the rules, is the following:
- Before rules
- Instead rules *
- Check rules
- Carry out rules
- After rules *
- Report rules
Instead and after rules, marked with a star above, stop the action by default. What this means is that the first instead/after rule the action sequence encounters will block everything that would come after it, unless the rule instructs otherwise. If there is an instead rule, only before rules and the instead rule will run and all others are skipped. If there is an after rule, all report rules are skipped.
You can make any of the rules stop the action sequence with “instead” or “stop the action”. This is most commonly done in the Check rules. Almost if not all standard library block rules (“block cutting”, “block drinking” etc) are check rules that have “stop the action”.
If there are multiple applicable rules of any kind, all of them will run, unless any of them stop the action sequence. This applies to every rule in every rulebook. (Remember that instead and after rules stop the action by default, but the others continue by default, including before and report rules.) Stopping the action sequence means stopping right there, without consulting any other action rules, so in practice it looks like as if the game would only follow the most specific instead rule. The order in which the rules run is decided by the specificity, this is discussed in manual chapter 18.18. The specificity rule of course applies only within the same type of rules, so a more specific carry out rule will never run before a less specific check rule.
Now, here’s a quick and dirty overview of how the rules “should” be used. In the end they’re just a bunch of rules in a specific order, so you could work with them however you want, but there are big benefits if the rules are used as they are designed to be used in that the design becomes more robust, easier to maintain and less error prone.
Before rules: The before rules are the first in the sequence so they are the strongest of them all. For the same reason they should be used with special care because they can easily introduce hard-to-notice bugs into the game. The common way to use before rules is to create implicit actions or redirect the action to another:
Before taking off the shirt when the player is wearing the jacket:
say “(first taking off the jacket)[command clarification break]”;
try taking off the jacket.
Before pushing a person:
say “(attack [the noun])[command clarification break]”;
try attacking the noun;
stop the action.[/code]
(Note how the second rule stopped the pushing action after the action had been directed to the attacking action.)
The before rules are also handy for restricting actions en masse:
Before doing something when the player is in the elaborate death trap and the action requires a touchable noun:
say "You can't do that when your hands are tied!";
stop the action.
Check/carry out/report rules: These are the core action rules: check whether the action should be blocked; if not, carry out the game mechanics, then report to the player what happened. Note that none of these rules stop the action by default, so you have to remember to have “instead” or “stop the action” in the check rules that prevent the action and if you have multiple report rules make sure they don’t show the wrong messages. The core rules should handle only the general case.
After rules: The after rules override the report rules, so they are mostly used to give custom reports if the game mechanism is the same (for example, describing the taste of an edible thing after the eating action.)
Instead rules: The instead rules skip all rules except before rules, so they are used for exceptions. Literally, instead of doing what you would normally do with this action, do this instead.
So usually the action sequence is like this for the general case:
- (before rules)
- Check rules <-- if they pass, continue
- Carry out rules <-- make changes to the world model
- Report rules (or an after rule, if applicable) <-- tell the player what happened
And when there’s something that should be handled differently:
- (before rules)
- Instead rule <-- choose the most specific applicable instead rule, run it, stop the action
Now when it comes to replacing rules in the action sequence rulebooks, I very rarely do that. This might be a personal preference in design but I’ve preferred to build up and on top of the standard rules instead of replacing them and starting with an empty table. The only place where I mess around with the standard rules is the looking action where there’s a bunch of rules that print the room description, but even there the rules I modify are rarely part of the actual action sequence.
I hope that clarifies it a bit rather than messing it up even more.