What’s the correct way to test whether or not an activity is ongoing?
“if handling the … activity” doesn’t seem to work.
Scullery is a room. A sack is carried by the player. The sack contains a yellow onion. The player carries a cork.
[ Before printing the name of the onion while listing contents:
if the holder of the onion contains exactly 1 thing, say "single ". ]
Before printing the name of the onion:
if the holder of the onion contains exactly one thing and handling the listing contents activity begin;
say "single ";
Looking at auto.inf, the first code (while listing contents) produces a call to TestActivity; the second produces a call to ForActivity.
The “if handling” construction seems meant for pretty special occasions (as when the author of an extension introduces a new activity): specifically, chapter 17.7 says
I suppose this means that the “if handling listing contents” phrase makes the game consider the for listing contents rulebook, and if there had been no rules in that rulebook, the “say ‘single’” phrase would have been executed, while, since there actually is a standard contents listing rule in the for listing contents rulebook, that rule will run here instead of “say ‘single’”.
“… while listing contents” (and “if listing contents activity is going on …”) apparently merely tests whether any of the acticvity’s rulebook is currently running,
whereas “if handling the listing contents activity” actually run the activity’s for rules, if it has any; if it doesn’t have any – and only then –, the program continues to execute the consequent.
(I confess that I never understood that chapter before, either.)