blocking everything but particular action

Say at the beginning of a game one wanted to confine it so that anything other than a specific verb (e.g., SPELUNK) got a message indicating that action was not yet available. This feels to my untutored intuitions like it should work:

Before doing anything during Very Beginning:
	if spelunking:
		continue the action;
		say "entertaining message about how you cannot do that yet";
		stop the action.

But if you type something like “X TURNIP,” you will get a message that says “You can’t see any such thing.” How do you get this all the way in front so that even actions like this receive the action-not-available message?

“x no-such-object” never makes it to the stage of being an action. It is rejected with a parser error before the action rulebooks begin.

You should set up an “after reading a command” rule; see 17.31. (The example (b) is almost exactly what you want, if you change the “includes” test to “does not match”.)

I will note that this is an extreme solution, and you’ll have to be careful not to mislead the player into thinking that your game does not use normal IF parsing at all. Your original solution might be better.

You might alternatively catch the parser errors you want to catch by some such code as

Rule for printing a parser error during the Very Beginning: unless the latest parser error is the not a verb I recognise error or the latest parser error is the I beg your pardon error: say "Here goes an entertaining message about how you cannot do that yet."; otherwise: continue the activity.
(This would also allow the game to react normally to commands for out-of-world actions like save, undo, test me etc.)


That’s equivalent to the poster’s original code, up top. (Modulo the precedence difference between “instead” and “before” rules, which are probably not significant.)

Very useful and informative, thanks. I think between the “Before” rule I had and a “printing parser error rule,” I might be able to avoid the “after reading command” solution.