Asking player to specify conversation topic

Hi, I’m a total beginner, so hope this hasn’t been solved yet! I couldn’t find it in the older posts.

I’m trying to solve a dialogue problem, so that the player can say what she wants to “talk about” by just naming the topic.

I let my friend test my unfinished game (he had never played a parser game before so it was really cool to see his thought process). He tried to talk to an NPC (“talk to janitor”) which I programmed as a mistake (“What do you want to talk about?”) So he just typed “weather” (lol). I’ve been trying to figure out for days now to let him do that without typing “talk to janitor about weather”.

So it would look like this (sry for the clumsy formating):

TALK TO JANITOR

But what do I want to talk about?
WEATHER
(talks to janitor about weather)

I’m not using any extensions. Maybe I can reparse or use a which-do-you-mean prompt that compares the player input with the conversation topic table…?

4 Likes

Here is one way to do that:

The Lab is a room.  The scientist is a man in the lab.

Talk mode is a truth state that varies.

Understand "talk to [someone]" as talking to. Understand "talk to [something]" as talking to. Talking to is an action applying to one visible thing.

Carry out talking to:
	now talk mode is true.
	
Report talking to:
	say "What do you want to talk about?".

Topic-proposing is an action applying to one topic.
Understand "[text]" as topic-proposing when talk mode is true.

Table of Current Topics
topic	reply
"weather"	"He smiles. 'What a lovely day it is, not a cloud in sight!'"
"job/scientist"	"'I'm the resident mad scientist here, working on a doomsday device.'"

Check topic-proposing:
	if the topic understood is not a topic listed in the Table of Current Topics:
		say "You don't think it will be fruitful to bring up this topic." instead; 
	now talk mode is false.

Carry out topic-proposing a topic listed in the Table of Current Topics:
	say "[reply entry][line break]";
	now talk mode is false.

[This next rule notifies the player when he does something other than propose a topic when talking to someone.]
Before doing anything other than topic-proposing:
	if talk mode is true:
		say "(leaving the conversation)[line break]";
	now talk mode is false.

In a complete game, you would need some modifications, for example to check whom the player is actually talking to if you’ve got more than one NPC, and in general, you’d probably want to combine this with a regular ASK/TELL system, but it’s a start.

It’s based on Example 323, Quiz Show, by Mike Tarbert (from section 17.17 in Writing with Inform), and you might also find the various examples in the sections on conversation in the Recipe Book helpful (7.6. Getting Started with Conversation, 7.7. Saying Simple Things, 7.8. Saying Complicated Things).

Of course, it could also be worthwhile to check out the conversation extensions, for example those by Eric Eve.

3 Likes

I was going to suggest “Conversation Responses” by Eric Eve as a back up to take care of the different ways many players try to interact, but I wasn’t sure if the OP was meaning to not use exensions, or just hadn’t yet.

Conversation Responses allows you to make rules instead of tables for conversations like

Response for Bob when asked about Bob:
Response for Bob when saying hello:
Response for Bob when asked or told about "life":
Response for Bob when shown the wristwatch:

etc. That’s been my bare-bones go-to for conversation in I7 when not using Hybrid Choices as a menu system. Eric Eve has several more conversation extensions that work together beyond this as well.

3 Likes

If you’re willing to move away from topics and towards things as the basis of conversations in your world model, then you can get what you want with something like:

"Small Talk"

Place is a room.

Alice is a woman in Place.

A conversation topic is a kind of thing. Some conversation topics are defined by the Table of Small Talk. [see WWI 16.16 Defining things with tables]

Table of Small Talk
conversation topic	transcript
weather	"[The noun] agrees that the weather is nice."
programming	"You and [the noun] have an animated discussion about sorting algorithms."

Talking to it about is an action applying to one thing and one visible thing. Understand "talk to [someone] about [any conversation topic]" or "talk to [someone] about [any thing]"  as talking to it about. [presence of first version in first position triggers the clarifying question during parsing]

Report talking to someone about something (called remark):
    if the remark is a conversation topic:
	    choose the row with conversation topic of the remark in the Table of Small Talk; [see WWI 16.5 Choosing rows; alternatively WWI 16.3 Corresponding entries]
	    say "[transcript entry][paragraph break]";
 	otherwise: [general case fallback option]
	    say "You talk to [the noun] about [the remark]."

After talking to Alice about Alice: [a special case]
    say "'How are you, Alice?'[paragraph break]'Just grand.'"

The action-to-be is an action name that varies. The action-to-be variable translates into i6 as "action_to_be". [exposes an internal parser variable for use in next rule]

Rule for printing a parser error while the action-to-be is the talking to it about action and the latest parser error is the noun did not make sense in that context error: [replaces default error message; see WWI 18.35 Printing a parser error]
    say "You can't think of anything to say about that."

Test me with "talk to alice about weather / talk to alice about politics / talk to alice about alice / talk to alice about me / talk to alice / programming". [see WWI 24.2 Debugging features to use in source]

Unfortunately, the part of the parser that prompts the player to finish a partial command expecting a second noun doesn’t seem to do that if the second parameter for the action is a topic.

3 Likes

Guys I never said thank you, your replies really helped.

I’ve added choosing a random NPC in the vicinity (included yourself) when the command doesn’t specify who you want to talk to (“talk about x”) and carrying out a greeting procedure before delving into the convo. Posting the code below if someone looks for similar answers, but it’s still very clunky xD

Setting stage and convo system plus non responses and greetings:

The elevator is a room. Here is a woman called Greta.
A man called the janitor is in the elevator. "A janitor is pottering around with a step ladder." 

[Asking a RANDOM PERSON]
Asking vaguely about is an action applying to one topic. Understand “ask about [text]” or "talk about [text]" as asking vaguely about.
Carry out asking vaguely about:
	let P be a random person enclosed by the location;
	if P is greeted, say "(to [P])[line break]";
	try asking P about the topic understood.

Instead of asking the player about something:
	say "I mutter under my breath '[the topic understood], [the topic understood]...".

[GREETINGS]
A person can be greeted. A person is usually not greeted.

Before asking someone about something:
	if the noun is not greeted:
		if the noun is a person listed in the Table of Greetings, say "[greeting entry][paragraph break].  .  . Now that we are aquainted, I proceed with my original question about [the topic understood]:";
		now the noun is greeted;
	continue the action.

Table of Greetings
person	greeting
Janitor	"Hello, Sir."
Greta	"I approach the two figures by the bar. Greta looks up from her Martini glass, blue light from the bar bouncing of her face."

[Table of CONVERSATION TABLES]
A person has a table name called the Reply Table.
The Reply Table of Janitor is Table of Janitor Topics.
The Reply Table of Greta is Table of Greta Topics.
[...]

Instead of asking a person (called suspect) about something:
	repeat through the Reply Table of the suspect:
		if topic understood matches topic entry:
			say "[reply entry][paragraph break]";
			rule succeeds;
	if the suspect is a person listed in Table of Non-responses, say "[Non-response entry][paragraph break]" instead.

Table of Non-responses
person	Non-response
Janitor	"Not now, pal."
Greta	"What an interesting topic... *Takes a sip*"


Table of Janitor Topics 
topic	reply
"weather"	"'Really lad, talking about the weather on such a bland day', he shakes his head."
"love"	"'One letter is allowed to stand for another very stars."

Table of Greta Topics
topic	reply
"weather"	"'Not quite the furnace you came out of in CA.'"
"love"	"'Love...something about the bottom of a bottle.'"

And here is the part where a talk mode is activated, prompting the player to finish his talk to command with a topic, without having to type out “talk to x about y” again (based on StJohnLimbo’s answer). Talk mode will stay activated until a different type of command is registered:

[Talk mode]
Talk mode is a truth state that varies.
Interlocutor is a person that varies. 

Understand "talk to [something]", "speak to [something]", "interrogate [something]" as talking to. Talking to is an action applying to one visible thing.

Check talking to:
	if the noun is not a person, say "[one of]Talk to me, [noun][or]You're my only friend, [noun][cycling]." instead.

Questioning is an action applying to one thing. Understand "question [something]" as questioning. Instead of questioning:
	if the noun is a person, try talking to the noun instead;
	otherwise say "I'm starting to question everything. Myself, the [noun], the universe."

Carry out talking to:
	now interlocutor is noun;
	now talk mode is true.
	
Report talking to:
	say "[one of]But what do I want to talk about?[or]But what should I ask them about?[or]What would be a good thing to ask them about?[or]But what do I want to talk about?[at random]".

Topic-proposing is an action applying to one topic.
Understand "[text]" as topic-proposing when talk mode is true.

Check topic-proposing:
	if the interlocutor is not greeted:
		if the interlocutor is a person listed in the Table of Greetings, say "[greeting entry][paragraph break].  .  . [one of]Now that we are aquainted, I proceed with my original question about [the topic understood]:[or]I turn to the subject of [the topic understood]:[or]I remember that I wanted to ask about [the topic understood]:[at random][paragraph break]";
		now the interlocutor is greeted;
	if the topic understood is not a topic listed in the Reply Table of the interlocutor:
		if the interlocutor is a person listed in Table of Non-responses, say "[Non-response entry][paragraph break]" instead.

Carry out topic-proposing a topic listed in the Reply Table of the interlocutor:
	say "[reply entry][line break]".

[This next rule notifies the player when he does something other than propose a topic when talking to someone.]
Before doing anything other than topic-proposing:
	if talk mode is true:
		say "(leaving the conversation)[line break]";
	now talk mode is false.

I haven’t looked too much into extensions (besides basic screen effects). This process has definitely made me more comfortable with tables.

2 Likes