Only doing that to something animate

I want to block a fair chunk of verbs with a “You don’t need to do that”-style message, but I can’t just overwrite their grammar, since I want to re-introduce some of them later in the game. So I have a Before rule that checks whether the action is one I’m allowing by looking it up in a table of Allowed Verbs. Here’s a simplified version, without the table:[code]The Kittenarium is a room. A toy kitten is in the kittenarium. A real kitten is an animal in the kittenarium.

Before doing something:
if the current action is looking or the current action is examining:
continue the action;
say “You’re too overwhelmed with cuteness to do anything!”;
stop the action.[/code]
This works fine, except for some reason:

Turning on actions and rules tracing is unenlightening:

I tried adding The block kissing rule is not listed in the check kissing rulebook. to no effect, which is unsurprising because, as far as I understand it, the Check rules run after the Before rules anyway. This is entirely cosmetic and sort of gratuitous, since my actual game does not require kissing and is unlikely to inspire anyone to want to do so anyway, but I’d like to at least understand what is going on. Is altering the library messages the only way to hook into this?

The standard rules give this understand line for kissing:

Understand "kiss [someone]" as kissing.

So “kiss toy” doesn’t match any understand rules – the parser error message you get happens when there’s a thing where the understand line has a [someone] token. (I mean, as far as I can tell this is true.)

Adding this line to your, er, toy example gets what you want, I think:

 Understand "kiss [something]" as kissing.

Though then you have to make sure that this doesn’t mess anything up in more complicated cases, as usual, I guess.

Kissing and other such actions (asking, telling, answering) are filtered to animate objects at the grammar level:

Understand “kiss [someone]” as kissing.

The parser therefore never gets as far as the action rulebooks.

(I’m not particularly fond of this design, as it means you have to jump through hoops to provide a custom response for “kiss photograph of your mother”, etc.)

Customizing the parser error message (the “can only do that to something animate error”) is a reasonable patch for this case. If you really wanted to clean it up, you’d have to strip out and redefine the grammar for each of these person-related verbs.

Aha. I think I’d had an inkling about that being a thing to investigate, and then promptly forgot it. :slight_smile:

Thanks, both of you.