Conversation - set scene, answer enquiries, force clues, reveal exit

Hi,

My player has just been moved to a new region, of which they know nothing about. The first room has little description and after their first turn, an invisible NPC appears (appears programmatically, but is invisible to the player) and says ‘hello’.

I’d like to set up a conversation framework where the player can ask a couple of basic questions (where are they, who are they, who is the NPC etc), and then program in a few topics for the NPC to offer clues to. I’d like to reveal an exit after a certain topic is discussed, unless this is bad practice?

Since the NPC is invisible and not (yet) named, I’m wondering how to handle this. Maybe this is too complicated and should be named. Looking for advice on that.

How best to handle a conversation that starts with ‘Hello’ from the NPC, pre-empts a few possible responses from the player, and then moves the conversation on to a few predefined topics? Is a basic topic table the way to go? And how do I reveal an exit after a certain topic is covered? I know an item can be assigned in one of the conversation table columns, but what about an exit?

Appreciate any suggestions or links to examples, thank you.

Hello:

For me, I might say that “A disembodied voice says, ‘Hello’.” This way, this prompts the player to say “ask the voice” or “ask the disembodied voice” something like that.

Are you wanting code for this?

You could just name the NPC “a disembodied voice” with a description “The voice seems to be coming from inside your head.” or “The voice crackles over what you assume are concealed speakers.” You’d want to write a rule like instead of doing anything except [talking actions] to disembodied voice: ... and tweak some stuff so it makes sense.

There is an extension “Inanimate Listners” (it may have been incorporated to I7?) to allow objects to be conversational interlocutors and behave appropriately like microphones or an intercom. If the voice is everywhere and you don’t want to deal with moving an NPC you might want to make a backdrop with the inanimate listener attached, or attach the conversation frob to the player somehow.

Then you can use regular ASK/TELL verbs, any conversation extension (I recommend Eric Eve’s “Conversation Responses”) or roll your own conversation. You can also use an extension like AW Freyr’s “Hybrid Choices” to make conversation menus with numbered selections the player can choose from that interact with the world model.

For NPC initiated commentary, you might want something like:

Last Report looking in the Billiard Room for the first time:
     say "The disembodied voice crackles: 'Ah, I see you have entered my gaming parlour! I'm sure you'll have questions about the rules. I'm here by your side as always - unless you'd like to dive in unspoiled...'"
3 Likes

And for secret doors, this is a good choice: extensions/Gavin Lambert/Secret Doors-v2.i7x at 10.1 · i7/extensions · GitHub

An extension seems to me like overkill for that. The can't go through undescribed doors rule is already in the Standard Rules. This is all you need:

The oak door is a privately-named undescribed door.
Understand "oak", "door" as the oak door when the oak door is described.

[ some insurance against inference or disambiguation prematurely revealing it ]
Does the player mean doing something to an undescribed thing that is not the player:
it is very unlikely. 

[ replace with some real means of making it described... ]
Instead of thinking, now the oak door is described.
2 Likes

Thank you all for the replies. I’ll be at my computer later this morning and go through each one. @mattdevins I’m ok for code with this, thank you.

In the meantime, @Zed - what is the mechanism behind ‘Instead of thinking’?

What defines ‘thinking’? Is this accepted in inform or are you suggesting it’s something I set up?

Thinking is just one action the player can type in (ie, it’ll execute when they type “think”), but in this context the suggestion is that it’s a placeholder for you to replace with anything that suits what you’re going for.

1 Like

OK, I installed Eric Eve’s Conversation Framework and Responses. For kicks I copied and pasted his included example, Bob’s Lost Wallet, which includes some family portraits as objects. I tried playing the game as though I was a new player, inputting what I think the average player may input. My worry is that unless someone is really familiar with text adventures, the player is going to struggle to strike up a conversation. For example, ‘where am I’ could quite easily be an expected input. See here:

There is static, and then a short silence before you hear a click. "Hello."

>hello
(addressing the Voice)
"Hello there, the voice!"

"Good morning," he replies.

>say hello to the voice
You are already talking to the Voice.

>how are you?
That's not a verb I recognise.

>where am i?
That's not a verb I recognise.

>where is my wallet
That's not a verb I recognise.

>ask voice about wallet
There is no reply.

Since the pasted example included the subject ‘lost wallet’ and portraits, I then tried further inputs and got these:

>portraits
That's not a verb I recognise.

>what are the portraits
That's not a verb I recognise.

>ask voice about portraits
There is no reply.

>lost wallet
That's not a verb I recognise.

>where is my lost wallet
That's not a verb I recognise.

>ask voice about lost wallet
There is no reply.

I intentionally chose inputs that the average player may use. It is not intuitive for the player to say “ask the voice about…” and I suspect by this point they’d have given up. Neither should I have to explain in long hand how to interact with the dismembered voice once they have been introduced to them. This is why I was wondering if a topic table would be a better implementation, but my worry there is that responses may be repeated.

I added this code:

	Response of the voice when asked about the voice:
	say "'I am noone."

But get this:

>who are you
That's not a verb I recognise.

>ask the voice who they are
I didn't understand that sentence.

I understand that Inform needs some conversational framework to work around, so I need to set up some rules to allow for this kind of input.

Any further thoughts?

Handling such free-form input is tricky because it’s hard to take into account all the numerous variations which players might type.

You could try to give them some guidance by suggesting possible conversation topics. That way, you can keep the freedom and openness of the ASK/TELL system, but can also nudge the players towards the right input format and towards relevant topics. Eric Eve’s extension “Conversation Suggestions” provides a way to do that.

You can additionally address free-form input by using the “Reading a command” activity (“§18.33. Reading a command” in the docs).

A short example demonstrating both methods:

Include Conversation Suggestions by Eric Eve.

The Lab is a room. The description is "A sterile-looking white room.".

The steel door is an undescribed door. It is south of the Lab and north of the Corridor.

The lab-work is a familiar proper-named thing. The printed name is "his current work".
Understand "his/-- current/-- work/experiments" as lab-work.

A lab assistant is a man in the Lab. "[One of]A lab assistant greets you with a friendly 'Hello'[or]The lab assistant is here[stopping]."
The ask-suggestions are {self-suggestion, lab-work}.

After quizzing the lab assistant about the lab assistant:
	say "'I'm assisting Dr. Praetorius with some experiments,' he says.";

After quizzing the lab assistant about lab-work:
	say "'Sorry, our experiments are secret. But totally harmless,' he reassures you. 'You can leave at any time, no problem.'[first time]As he speaks, a steel door is revealed in the southern wall.[only]";
	now the steel door is described;

After reading a command when the current interlocutor is the lab assistant:
	if the player's command matches "where am I":
		say "'You are in a laboratory,' the assistant says.";
		reject the player's command.

Output:

Lab
A sterile-looking white room.

A lab assistant greets you with a friendly “Hello”.

>hello
(addressing the lab assistant)
You say hello to the lab assistant.

(You could ask him about himself or his current work.)

>ask him about himself
“I’m assisting Dr. Praetorius with some experiments,” he says.

>where am I
“You are in a laboratory,” the assistant says.

>ask about work
“Sorry, our experiments are secret. But totally harmless,” he reassures you. “You can leave at any time, no problem.”
As he speaks, a steel door is revealed in the southern wall.

>s
(first opening the steel door)

Corridor

[…]

2 Likes

I think this is what I need, or at least some variation of it. I think this combined with a conversation table should work. Thank you.

1 Like

@StJohnLimbo do you have any idea how to capture a question mark in the command? I’m surprised it has responded in this way:

>where am i
"You are in a laboratory," the voice says.

>where am I?
That's not a verb I recognise.

There are several options. You could use regular expressions (see “§20.6. Regular expression matching” in the docs):

if the player's command matches the regular expression "where am I\b", case insensitively:

Or you could use Emily Short’s extension “Punctuation Removal”:

Include Punctuation Removal by Emily Short.

[...]

After reading a command when the current interlocutor is the lab assistant:
	remove stray punctuation;
	if the player's command matches "where am I":
		say "'You are in a laboratory,' the assistant says.";
		reject the player's command.

Another strategy to deal with ambiguity is to use “includes” rather than matches. For example, you might assume that a question including the word “where” is asking about the player’s location. That would work for “where am I?” “where are we?” “where is this?”. Of course, you’ll have to think carefully about what questions the player might ask, or if you want different responses for “where am I?” vs “where are you?”, etc.

Check asking Mysterious Voice about something:
	if the player's command includes "where":
		say "You are in the lab.".
1 Like

Welcome to the Wonderful World of parser ask/tell conversation. This has been a challenge for decades - how to give the player conversational freedom without straight up saying “here is the list of topics you can converse about and here’s how you have to phrase your command…”

In general a new player is going to struggle with a parser game no matter what. It’s a noble cause to try to account for every case and slap training wheels on every conversational gambit that doesn’t fall into the correct format, and try to make an NPC respond like a human (or at least a decent chat-AI) to anything but it becomes a Sisyphean task.

At some point it’s easier to tutorialize the player. This may involve giving Bob a default

Bob shrugs, unsure of what you mean.

When talking to a character, please phrase it as ASK BOB ABOUT [something], or TELL BOB ABOUT [something]."

response if the parser knows the error involves an interlocutor.

say hello to the voice
You are already talking to the Voice.

I believe the Eric Eve extensions have a format with an “interlocutor” as the conversational target and hello/goodbye commands trigger “greeting” and “leave-taking” actions as the systematic way of engaging or disengaging from a specific PC so the parser can infer who you’re talking to instead of using the name in every command. (Infocom often required you to address your interlocutor so it knew you were telling someone something SAILOR, PICK UP THE LAMP) so you’d SAY HELLO TO BOB (BOB, HELLO should also work) and then could proceed to ASK ABOUT WALLET, GIVE THE MYSTERIOUS AMULET, TELL ABOUT LOVECRAFTIAN MONSTER in continuous conversation without needing to specify Bob in every command.

how are you?
That’s not a verb I recognise.

where am i?
That’s not a verb I recognise.

where is my wallet
That’s not a verb I recognise.

The usual issue is the parser wants a verb and a noun and doesn’t understand conversational fragments that newbies type in in all cases, even outside conversation. If you start creating exceptions for every conversational fragment to account for an inexperienced player - especially in a game with lots of NPCs and conversations, you may end up doing a lot of work. If you expect your game will be played be new players, you might want to consider choosing a different conversational system than ask/tell even though Eric Eve’s systems go a good way toward simplifying it. The player literally just needs to learn how to phrase conversation the same way they need to learn to type NORTH instead of something like WALK IN THE DIRECTION OF THE KITCHEN.

In general, I find ask/tell a little janky for the amount of freedom it purportedly gives. In most cases, the operational commands ASK BOB ABOUT WALLET and TELL BOB ABOUT WALLET really don’t give differing information if there’s basically one sentence or paragraph of information the player needs to know. Unless really need it because you’re doing a mystery/detective game where there’s a critical difference between asking for information and offering information…again lots of busy work for little payoff.

I always found that Conversation Responses was the easiest and simplest extension to use.

Conversation Responses allows response rules for various conversational commands to be written in the following forms:

Response of Bob when asked about Bob:
Response of Bob when asked about “life”:
Response of Bob when told about “[money]”:
Response of Bob when asked about a container:
Response of Bob when asked about something fixed in place:
Response of Bob when told about Jim:
Response of Bob when shown the wallet:
Response of Bob when given the wallet:
Response of Bob when asked for the wallet:
Response of Bob when asked for “sympathy”:
Response of Bob when anwered that “probably”:
Response of Bob when saying yes:
Response of Bob when saying no:
Response of Bob when saying sorry:

This may seem to have little advantage over writing rules like “After asking Bob about life”, but it also allows the following forms for ask/tell or give/show:

Response of Bob when asked-or-told about “life”:
Response of Bob when asked-or-told about the wallet:
Response of Bob when given-or-shown the gold coin:

So I believe in this case you could use the “response when answered that” construction

Response of Bob when answered that "[whereami]": [...]

Understand "where am I" and "what is this place" and "where are we" as whereami.

^^I have totally probably botched this construction - I think there’s a way to combine multiple text snippets to be recognized as a token.

Welcome to the Wonderful World of deciding whether to deal with punctuation in commands, or just tutorializing your inexperienced player not to do that. :scream: :laughing:

While this may seem gruff, sometimes players just need to learn how game controls work. On a console game there’s no problem saying “Press the X button to interact” and you wouldn’t expect someone to say “well, what if I want use my TV remote? What about my toaster; will any of these buttons over here make me jump if I put in a slice of bread and…?” No, you do it this way…

2 Likes

Thank you for this comprehensive reply, @HanonO. There’s a lot for me to be getting on with there. I’m particularly interested in extending the

Response of Bob when answered that "[whereami]": [...]

Understand "where am I" and "what is this place" and "where are we" as whereami.

code. With a number of [one of] responses, this could be quite dynamic. I just need to get it working properly.

1 Like

OK, I think I have it working:

Whereami is a thing. Understand "where am I" and "what is this place" and "where are we" as "[whereami]".

After reading a command when the player is in (room-name):
	if the player's command matches "[whereami]":
		say "'You are in a laboratory,' the voice says.";
		reject the player's command.
1 Like

This part appears to be redundant. You can probably remove it.

You can instead understand “whatever” as “[whereami]”, which creates it as an understanding token rather than as an actual object to be manipulated in the world.

2 Likes

I tried without the first part and it threw an error. Just the “understand” part doesn’t work on its own, unless I got the syntax wrong.

Ok, so that’s two votes for removing the first part. I’ll try those suggestions later on this morning. Thank you, both.