I just created this extension - it’s very short and simple, but I think it might be handy. It allows you to test if an object “is identified with” a snippet (the snippet matches the object) or “is named in” a snippet (the snippet includes the object).
eyeballsun.org/i/Objects%20Match … ippets.i7x
[spoiler][code]Objects Matching Snippets by Mike Ciul begins here.
Section - The Item to Match
The item to match is a object that varies.
Definition: A thing is matchable if it is the item to match.
Definition: An room is matchable if it is the item to match.
Definition: A direction is matchable if it is the item to match.
Definition: A region is matchable if it is the item to match.
Section - Snippet-matching
Does the object match is a snippet based rulebook. The does the object match rulebook has outcomes it does (success) and it does not (failure).
Does the object match a snippet (called S):
if the item to match is a thing and S matches “[any matchable thing]”, it does;
if the item to match is a room and S matches “[any matchable room]”, it does;
if the item to match is a direction and S matches “[any matchable direction]”, it does;
if the item to match is a region and S matches “[any matchable region]”, it does;
it does not.
To decide whether (candidate - an object) matches (S - a snippet):
Now the item to match is candidate;
follow the does the object match rules for S;
decide on whether or not the outcome of the rulebook is the it does outcome;
Snippet-matching relates an object (called candidate) to a snippet (called S) when candidate matches S. The verb to be identified with implies the snippet-matching relation.
Objects Matching Snippets ends here.
Section - Snippet-inclusion
Does the object’s name appear in is a snippet based rulebook. The does the object’s name appear in rulebook has outcomes it does (success) and it does not (failure).
Does the object’s name appear in a snippet (called S):
if the item to match is a thing and S includes “[any matchable thing]”, it does;
if the item to match is a room and S includes “[any matchable room]”, it does;
if the item to match is a direction and S includes “[any matchable direction]”, it does;
if the item to match is a region and S includes “[any matchable region]”, it does;
it does not.
To decide whether the name of (candidate - an object) appears in (S - a snippet):
Now the item to match is candidate;
follow the does the object’s name appear in rules for S;
decide on whether or not the outcome of the rulebook is the it does outcome;
Snippet-inclusion relates an object (called candidate) to a snippet (called S) when the name of candidate appears in S. The verb to be named in implies the snippet-inclusion relation.
---- DOCUMENTATION ----
Objects Matching Snippets is a very simple extension that provides a convenient way to search for names of objects within a snippet such as the player’s command or the topic understood.
There are two relations that can be used for this: snippet-matching (“O is identified with S”) and snippet-inclusion (“O is named in S”). These correspond to the built-in phrases “S matches O” and “S includes O.”
Snippet-matching tests whether the name of object O matches the snippet S:
say "[The list of things identified with the topic understood] all match the phrase '[the topic understood]' in your command.";
Snippet-inclusion tests whether the name of object O appears in the snippet S:
say "The rooms [list of rooms named in the player's command] are all mentioned in your command."
Note that these are both object-to-snippet relations, so you can test them on rooms, directions, and regions as well as things.
Example: * Exclamations - Creates a new action that can be parsed from the command “[someone], [something]”
*: "Exclamations"
Include Objects Matching Snippets by Mike Ciul.
Exclaiming it to is an action applying to two visible things.
Report exclaiming it to: say "You say '[noun]' to [the second noun]."
An exclamation is a kind of thing. Hello is an exclamation.
Check answering someone that:
Let item be a random exclamation identified with the topic understood;
If item is a thing:
instead try exclaiming item to the noun;
If there is an exclamation named in the topic understood:
say "Your command did not exactly match anything you can say, but perhaps you meant '[a random exclamation named in the topic understood]?'";
stop the action.
Test is a room. Bob is a man in Test.
Test me with "say hello to bob/bob, hello how are you"[/code][/spoiler]