Intercepting "examine" before I7 even cares about the noun

I know this is odd, but there’s a narrative purpose behind it. So there’s my stylistic disclaimer. :slight_smile:

I’ve been attempting to render the same response to the examination of anything – even to the point of overriding the thing-is-not-here error. In other words, I would like one particular, custom response to “examine” to be triggered as soon as I7 sees the word “examine,” whether the player specifies something that exists, or something that doesn’t.

I can make the response to a legitimate “examine” universal with no problem, but the noun has to exist for I7 to display that universal response – if it doesn’t, the player gets the usual not-seen-here error. I would even like “examine (typo)” to return the custom examining message.

I’ve been finding great success with Ron Newcomb’s “Default Messages” extension, and it works well for changing any error message that deals with a particular command. The problem with changing the not-seen-here error for “examine” is that there is no particular bad-noun error message for “examine” – the same can’t-see-that-here message is triggered if the player tries to take a nonexistent object, push it, smell it, etc.

Thanks so much for any help with this!

No-examining is an action applying to one topic.
Report no-examining:
	say "Forget it."

Understand the command "examine" as something new.
Understand "examine [text]" as no-examining.

This just covers the verb “examine”. You’d also want to catch all of its synonyms:

Understand the commands "x", "watch", "describe", "check" as something new.
Understand the commands "x", "watch", "describe", "check" as "examine".

Similarly for “read”, “look”, “look at”.

Wow. That’s extremely helpful. Thanks for your time – I sure appreciate it!

zarf, I thought of using your trick for figuring out what you’re trying to do when you get a parser error, but I can only get it to work when an error is actually happening, so I need another case to intercept examining things that are there:

[code]To decide what action-name is the action-to-be: (- action_to_be -).

Rule for printing a parser error when action-to-be is the examining action: say “Forget it.”

Instead of examining: say “Forget it.”[/code]

Is there a hook I can hang action-to-be on that’ll intercept non-parser-errors as well?

Aaron Reed’s “Remembering” extension makes some modifications to the examine command - you might want to look into how he does that. It reminds me I should finish up my Lost Items extension which deals specifically with the “you can’t see any such thing” error:

Rule for printing a parser error when the latest parser error is the can't see any such thing error:

You might also need to catch the “noun did not make sense in that context” error if you have anything more specific than a topic in any of your verb grammars:

Rule for printing a parser error when the latest parser error is the noun did not make sense in that context error (this is the custom replace did not make sense in that context rule): now the latest parser error is the can't see any such thing error; make no decision;
(I just remembered why I added this. “Remembering” has the phrase ‘you can’t see any such thing’ hard-coded in a rule, and I had to use this to trigger the correct message from Custom Library Messages if, for example, the person and tense had changed.)