Creating the command "Talk to [someone] about [something]"

Besides wanting to know how such a command can be created, I also need help on how I can make the character reply upon recognizing the topic. I’m new to this and this is my first post here. Any help will be appreciated. FYI, I want the player to use that command instead of asking, telling, etc.

This could be a way to start:

Talking to it about is an action applying to one thing and one topic.
Understand "talk to [someone] about [text]" as talking to it about. 

Instead of talking to someone about something:
	say "[The noun] doesn't seem to have anything to say about that."
Lab is a room. Jane is a woman in lab.

Instead of talking to Jane about "Emma": say "Jane says, 'One of my finest creations.'"

You might want to look at some of the conversation examples in §7.6-7.8 of the Recipe Book for ways to go on; “Sybil 1” uses the kind of rule that I wrote for Jane’s reply.

Also, if you want to refer to the text the player typed for the [text] token, it’s “the topic understood.”

By the way, if you want the player to type “TALK TO JANE ABOUT EMMA,” you don’t necessarily need a new action. If you write

Understand "talk to [someone] about [text]" as asking it about. 
Lab is a room. Jane is a woman in lab.

Instead of asking Jane about "Emma": say "Jane says, 'One of my finest creations.'"

then TALK TO JANE ABOUT EMMA will be understood. So will ASK JANE ABOUT EMMA but usually it’s desirable to capture more plausible synonyms for the same action.

1 Like

Problem solved, thank you!
But now, how do I code a response for unimportant words? I tried using
Instead of asking guard about “[something]”:
say “xyz”
But that didn’t work.

I used your first suggestion this time. And instead of using tokens (that’s where I went wrong) , I just typed “Instead of talking to someone about something”, and now it works just fine.

Without wanting to “info bomb” you, I can heartily recommend looking at the Inform Recipe Book (on the documentation tab) for the detail about this, especially Chapter 7, part 6 (7.6). NPCs generally are complicated to code, and conversation is about the most complicated interaction that the player usually has with an NPC, so it’s useful to have an overview about the problem areas.

The recipe book is specially designed so that you can paste the code there into a little “test” project and muck around with it. In fact, there’s a little icon that looks like a page of text, next to the title, it will automatically do the copy-n-paste for you. There’s no need to worry about “stealing” any of this code: it’s intended for people to use it in their projects.

The example “Complimentary Peanuts” deals with using keywords to trigger a response and ignoring the unimportant words.

And of course we’re always here if things mysteriously fail to work!

Happy coding. :smile:


Yes–for what it’s worth, what is going on here is that the [something] token used in quotes will only match an actual thing in the model world.* So this rule would fire if you tried “ask guard about guard,” since the guard would be a visible thing in the world model. But it wouldn’t fire if you tried “ask guard about xyzzy” and xyzzy wasn’t the name of a thing.

*And I think the player would have to be visible.

1 Like

Eric Eve’s extensions include a whole set that implements conversation coding. I would think this set of extensions would be well-nigh essential for anyone who is writing conversations.

1 Like