Epistemology of Conversation Topics

OHHHH BABY! I think I have something working. Well, with some hitches.

One hitch is that you probably have to redefine proto-discussing so the nouns go the other way, because I couldn’t get it to happen with the quip as the first noun and the interlocutor as the second noun. I think the Should the game suggest rules can resolve the noun first and then evaluate the second noun based on what the noun is but not vice versa. (The documentation discusses this in relation to the Does The Player Mean rules in section 16.19, and I expect STGS rules work the same way.)

Another hitch is that I don’t understand why it’s working now and why it wasn’t working before, which means that there’s probably all kinds of fragilities involved. And I spent a while goofing up because I forgot that “now the addressee is the last interlocutor checked” isn’t the same thing as “now the last interlocutor checked is the addresee.”

I also kept having to try eight times to get the syntax for the relation in the “Should the game suggest” rule to compile, and I’m not sure why some work and others don’t.

There may also be some type safety issues involving where I demand things to be quips and where I don’t.

The proto-discussing action didn’t actually seem to be redirecting to discussing, but when I changed the “instead of proto-discussing to it about” rule to a “carry out proto-discussing to it about” rule, that seemed to get fixed. IIRC check and instead rules don’t play together nicely, though I’m not sure why they didn’t play nicely in this particular way.

And I got the code working so it doesn’t run the relabel available quips rule for every disambiguation – it keeps track of who the interlocutor was the last time it relabeled available quips, and if that’s still the interlocutor, it doesn’t rerun the rule.

Anyway, I’m happy that it seems to be working now. Hope this is helpful.

Here’s the code, with the rest of the attempted code scattered in the comments:

[spoiler][code]“Spelunkery”

[Include Disambiguation Override by Mike Ciul.]
Include Conversation Framework by Eric Eve.
Include Disambiguation Control by Jon Ingold.

Book I - Machinery

Section 1 - Quips

A quip is a kind of thing.

Quip-supplying relates various quips to various people. The verb to quip-supply (it quip-supplies, they quip-supply, it quip-supplied, it is quip-supplied) implies the quip-supplying relation.

Definition: a quip is character-tailored rather than universally-applicable if it quip-supplies someone.

Mentioning relates various quips to various things. The verb to mention (it mentions, they mention, he mentioned, it is mentioned) implies the mentioning relation.

Understand “[something related by mentioning]” as a quip.

Section 2 - Availability Rulebook, abridged

This is the relabel available quips rule:
[ This rule is very important: it tags quips available before running a new turn. Therefore, the game doesn’t have to reassess availability on the fly during plausibility tests or during parsing. ]
[ On the other hand, it means that we should not test availability or plausibility on our own without first calling this rule. ]
now every quip is flagged-unready;
repeat with item running through quips:
say “[item]”;
if item is available:
say “*”;
now item is flagged-ready;
[Thus, we can also mark quips nonviable in order to skip considering them; if for instance we only want to consider quips relevant to the current scene, or the current character.]
say ", ";

A quip can be flagged-ready or flagged-unready.

The relabel available quips rule is listed after the adjust light rule in the turn sequence rules.
[ The rule needs to appear late in the turn sequence so that if for instance a change of scene changes the identity of the current interlocutor, ]
[ the quips are correctly labeled based on that information. ]

Availability rules are an object-based rulebook. The availability rules have outcomes it is available (success) and it is off-limits (failure).
[ This determines whether a given quip is even allowed for use. It is different from plausibility, which chooses quips that are relevant at the moment, ]
[ but (depending on the system) might not include everything that the player could reasonably choose to talk about at the moment. ]

Definition: a quip is available:
follow the availability rules for it;
if the outcome of the rulebook is the it is available outcome, yes;
no.

The first availability rule (this is the don’t talk to no one rule):
if the current interlocutor is not a person:
it is off-limits; [But this should never happen!]

An availability rule for a quip (called the target) (this is the restriction of quips to special people rule):
if the target is character-tailored and the current interlocutor is not quip-supplied by the target:
it is off-limits;
make no decision;

The last availability rule (this is the generic availability rule):
it is available.

Section 3 - The Discussion Action

Understand the commands “ask”, “tell”, “say”, “answer”, “a”, “t” as something new.

Discussing it with is an action applying to two visible things.

Check discussing something with:
if the second noun is not the current interlocutor:
implicitly greet the second noun;
say “(addressing [the current interlocutor])”;
if the current interlocutor is not the second noun, stop the action;
follow the relabel available quips rule;

Carry out discussing it with:
try discussing the noun.

Discussing is an action applying to one visible thing.

Understand “talk about [any flagged-ready quip]” and “talk [any flagged-ready quip]” as discussing.
Understand the commands “say” and “discuss” as “talk”.

Understand “change the subject to [any flagged-ready quip]” and “change subject to [any flagged-ready quip]” as discussing.
Understand the command “a” as “ask”. Understand the command “t” as “tell”.

Understand “discuss [any flagged-ready quip] with [something]” or “say [any flagged-ready quip] to [something]” as discussing it with when the second noun is the current interlocutor.
Understand “tell [something] that/about [any flagged-ready quip]” or “ask [something] that/about [any flagged-ready quip]” as discussing it with (with nouns reversed) when the second noun is the current interlocutor.
Understand “tell [something] [any flagged-ready quip]” or “ask [something] [any flagged-ready quip]” as discussing it with (with nouns reversed) when the second noun is the current interlocutor.

Report discussing: say “You ask [the current interlocutor] [the noun].”

Section 4 - Catching

Proto-discussing is an action applying to one visible thing. Proto-discussing to it about is an action applying to two visible things.

Understand “talk about [any quip]” and “talk [any quip]” as proto-discussing. Understand “change the subject to [any quip]” and “change subject to [any quip]” as proto-discussing.

Understand “tell about [any quip]” and “tell [any quip]” as proto-discussing. Understand “ask about [any quip]” and “ask [any quip]” as proto-discussing.

Understand “discuss [any quip] with [something]” or “say [any quip] to [something]” as proto-discussing to it about (with nouns reversed).
Understand “tell [something] that/about [any quip]” or “ask [something] that/about [any quip]” as proto-discussing to it about.
Understand “tell [something] [any quip]” or “ask [something] [any quip]” as proto-discussing to it about.

[Check proto-discussing when the current interlocutor is not visible and the current interlocutor is not nothing:
abide by the can’t converse with absent interlocutor rule.]

[Check proto-discussing:
if the current interlocutor is not a person, say “You aren’t addressing anyone at the moment.” instead;
say “That doesn’t seem to be a topic of conversation at the moment.” instead.]

Before asking which do you mean when proto-discussing:
follow the relabel available quips rule;
[ filter the match list for flagged-ready quips, leaving at least one choice;
if the first match is not a quip or the first match is not flagged-ready:
say “That doesn’t seem to be a potential topic of conversation.” instead.]

Check proto-discussing to something about:
if the noun is not the current interlocutor:
implicitly greet the noun;
say “(addressing [the current interlocutor])”;
if the current interlocutor is not the noun, stop the action;
follow the relabel available quips rule;
[ Let item be the most likely match between the topic understood and “[any flagged-ready quip]”;
If item is a thing:
instead try discussing the item;]

[instead of proto-discussing to it about, try discussing the second noun.]
Carry out proto-discussing to it about: try discussing the second noun.

proto-discussing is implicit-conversing.

Check saying hello to the player:
say “Talking to yourself is unrewarding.” instead;

Instead of proto-discussing:
try discussing the noun.

Section 5 - Disambiguation Control-Related Stuff

The last interlocutor checked is a person that varies.
Every turn: now the last interlocutor checked is the player. [Hopefully this effectively serves as a null value, because you can’t talk to yourself. If not you may need an actual null value.]

To decide whether (subject - a quip) interests (addressee - a person):
if the addressee is not the last interlocutor checked: [otherwise we just relabeled quips for that interlocutor and don’t have to do it again]
now the last interlocutor checked is the addressee;
now the current interlocutor is the addressee;
follow the relabel available quips rule;
if the subject is flagged-ready, yes.

Interest relates a thing (called subject) to a person (called addressee) when the subject interests the addressee. The verb to fascinate (he fascinates, they fascinate, it is fascinated) implies the interest relation.

Should the game suggest proto-discussing to a person about a quip that does not fascinate the noun: never.

Book II - The World

There is room. Bob is a man, here. Janet is a woman, here. The player carries a coin. Janet wears a bandana.

what it might be worth is a quip.
it quip-supplies Bob.
It mentions the coin.

who she represents is a quip.
it quip-supplies Janet.
it mentions the bandana.

who would buy it is a quip.
it mentions the coin and the bandana.

Freya is a woman.

who flipped it is a quip.
it quip-supplies Freya.
it mentions the coin.

Test problem with “ask Bob about coin / worth / ask Janet about bandana / represents / ask Bob about coin / ask Bob about coin”

every turn, showme the current interlocutor.[/code][/spoiler]

And here’s the output:

Typing the commands in instead of using the test command also works.

By the way, you can’t type “buy” at the last prompt after the disambiguation question, because the game recognizes it as a verb and goes to processing it as a command instead of a disambiguation. This is a known issue with Disambiguation Control and also with plain old Inform 7. [EDIT: Wait, maybe it’s not a known issue. Well, is now.]