The example below is distilled from a larger program, but the upshot is:
1 it makes sense to ask an NPC about a key, because they are locked in a prison. The prison doesn’t require an actual key, but asking about a key gives the player a hint.
2 I could say “[any still-available thing]” to lessen the possibility the key/keycar are confused, or I could just remove the understand “key car” as keycar text, but I want to give the reader shortcuts, and I imagine this case will come up elsewhere.
(Note I’ve cut out some programming details here. I do check for people in the room, but I want to focus on the topics vs. things collision. And how things override topics, because I assume [any thing] is more specific than [text]. And something like “does the player mean objasking about keycar” only favors objasking subjects, not objasking over asking.)
"sandbox" by andrew schultz
asking generically is an action applying to one topic. Understand "ask about [text]" or "talk about [text]" or "a [text]" as asking generically.
objasking generically is an action applying to one visible thing. Understand "ask about [any thing]" or "talk about [any thing]" or "a [any thing]" as objasking generically.
understand "key/car" and "key car" as keycar.
r1 is a room.
the keycar is a thing in r1.
carry out asking generically:
repeat through table of talk topics:
if topic understood is topic-match entry, say "[text entry]" instead;
say "No matches for topics.";
carry out objasking generically:
repeat through table of talk things:
if noun is noun-match entry, say "[text entry]" instead;
say "No matches for things.";
table of talk topics
topic-match (topic) text
"key" "Key, the topic."
table of talk things
noun-match text
keycar "Keycar, the item."
My tentative solution was to put in a 3rd row saying “pass-rule” in the table of talk things where objasking generically abides by the pass-rule, if it exists. Then we might have:
carry out objasking generically:
repeat through table of talk things:
if there is a talk-check rule:
abide by the talk-check rule;
if noun is noun-match entry, say "[text entry]" instead;
say "No matches for things.";
table of talk things
noun-match text talk-check
keycar "Keycar, the item." keycar-pass rule
this is the keycar-pass rule:
if (npc in the location needs the key), try asking generically "key" instead;
if (keycar's existence is not known), try asking generically "key" instead;
[any other rules are added here]
This feels like a potential solution but not the best one.
Some other solutions may be to hint “hey! You might’ve meant to ask about a general subject and not an item!” and have a verb like “as [text]” which only looks for topics and not things, that is a potential spoiler if someone doesn’t know about the keycar.
In the game I have the NPC, who is absent-minded, say “Keycar? No, just a key. Nope, no key…”
So does anyone have any suggestions? Or is this having a check-rule in the dialogue table the best I can do?