"ask about [text]" vs "ask about [thing]" collision: how best to decide in more detail?

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?

1 Like

Do you need to use topics? Would it be possible to make them things, too, instead?

1 Like

That’s a strong possibility! I didn’t really think of that when I set things up, probably because I kept going up against the item limits and kept having to reset USE_MAX_ITEMS. Another thing was that I wanted to give preference to asking about things in the current region, though I suppose I could tweak that with.

a universal-idea is a kind of thing. a universal-idea has text called default-response.

to decide if x is this-convo-preferred:
    if x is a universal-idea, yes;

That might actually let me collapse some code, especially since asking about a thing without a specific response and a topic without a specific response go to the same thing.

I’m a bit worried it might slow the code down even more, though to be honest, I’m not sure what precisely does. I mean, I know a game with lots of items and verbs defined is slower, but I’m not sure if that’s items or verbs or both.

As it happened, I have relatively few topics, so maybe it would be a possibility to close that loophole.

It’s kind of funny … I remember pointing out that “a dead man” would be better off as scenery so you don’t get the “You get no reply.” default text, but I never considered defining ideas. So that’s a possibility.

And if I have to define an idea as an in-game thing for just one piece of conversation, maybe that’s a sign it’s potentially superfluous anyway.

If you want to eliminate one synonym for one action, this trick can be useful:

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

Understand "mineral" as the rock when the action-to-be is not the objasking generically action.

action_to_be was documented in the I6 parser, but has now slipped into the background, but it still works.

3 Likes