OK, now I have a bunch of thoughts that won’t be immediately helpful, but might inspire someone (coughdraconiscough) to dive into the I6 and make something useful.
It used to be that you could do something like this:
After reading a command:
if the player's command includes "[thing]":
and the thing that got matched would get stored as the noun. (By the way, note that when you’re matching a snippet against a topic “matches” means exactly matches and “includes” means includes, while when you’re matching a text against a text “matches” means is included in and “exactly matches” means exactly matches. This confuses me no end but is impossible to fix at this point without breaking lots of code.)
Which would’ve allowed you to try this:
After reading a command:
repeat with item running through L:
if the player's command includes "[thing]" and the noun is the item:
say "Match made."
The problem is that this was a bug, because you don’t want to overwrite the noun when you make a change like this. See this bug report, this thread, and this uservoice suggestion.
This was apparently taken care of by a change to ConsultNounFilterToken, which preserves the noun as it should be, but also makes it impossible as far as I can tell to access the thing that actually got matched as the “[thing]” token.
Now, my guess is that it should be possible to take the new ConsultNounFilterToken:
[ ConsultNounFilterToken obj sn rv;
if (token_filter ofclass Routine) {
sn = noun;
noun = obj;
rv = indirect(token_filter);
noun = sn;
return rv;
}
if (obj has (token_filter-1)) rtrue;
rfalse;
];
and make a new I6 global variable that could be accessed from I7 as “the most recently matched thing,” which gets assigned somewhere in there. I think maybe you’d have to set this to obj at some point? Possibly conditional on rv? A problem is that I have no idea what “indirect” is doing, or basically what anything else is going on. So I can’t really make something that works there. But if someone who knows a bit more about the internals wants to try, that might be a possible approach.
Then if that I6 hook got put in, you could try
After reading a command:
repeat with item running through L:
if the player's command includes "[thing]" and the most recently matched thing is the item:
say "Match made."
But you’d need someone to do the I6 hook.
(By the way there is an extension Objects Matching Snippets which I think is designed for cases like this, but I’m not sure if it’s updated for the newest versions of Inform.)