version 3 by Ron Newcomb
Example: * But Then What? - Regarding a snafu with the "only understood as far as" error.
Unlike the "What would you like to..." message which incorporates the relevant part of the player's command into itself, the parser error "I only understood you as far as.." does not. We can change the message, but the player's command will always be tacked on afterward, making it difficult if we wish to end the response with a close quote, a closing bracket, roman type, etc. For this situation, we must use a rule. (If we use both, the rule is consulted first. This can be useful if we want to add "when..." conditions to the rule: the table's version would be used when no rules apply.)
For additional measure, a phrase printing the rest of the command, and a phrase deciding if the misunderstood word is known at all, also appear.
"But Then What?"
Include Default Messages by Ron Newcomb.
There is a room called In the Spotlight.
Rule for printing a parser error when the latest parser error is the only understood as far as error:
say "'You wanted to [library message verb] but what did you mean by the word [misunderstood word] in ['][what was misunderstood][']?'"
To decide which snippet is what was misunderstood:
(- (((wn - 1) * 100) + (WordCount() - 2)) -).
To decide which snippet is the misunderstood word:
(- (((wn - 1) * 100) + 1) -).
Rule for printing a parser error when the latest parser error is the only understood as far as error and the misunderstood word is known elsewhere:
say "'You wanted to [library message verb] but, although I know the word [misunderstood word], I wasn't expecting it there.'"
To decide if the misunderstood word is known elsewhere:
(- (wn--, NextWord() ~= 0) -).
Test me with "examine me now / examine me closely now / examine me spotlight".