Another couple of newbie questions on conversation

I’m getting very frustrated by two things.
Firstly, doing something as simple as “say hello to Barry”. Now, if I type this in the story, the default message “There is no reply” appears. If I try it on an inanimate object, then it tells me I can only do it to animate objects. Both of those indicate that it’s understanding the phrase I’m typing, and “say” as a verb.
However, I want to put some simple instructions in my code so that Barry will respond if I “say hello to Barry”. But I can’t work out how to do this. Everything I try throws up error messages and won’t run. I initially thought something like:
After saying “hello” to Barry:
say "Barry replies, ‘Hi there’ "

would work, but it doesn’t. I have implemented some of the example code for “talking to”, which works fine. This is it:
Understand “talk to [someone]” as talking to. Understand “talk to [something]” as talking to. Talking to is an action applying to one visible thing.
After talking to Barry:
say “He scowls and says, ‘Haven’t you got something better to be doing?’”

I have tried to modify that for “saying” but it just gets confused. I have scoured the documentation, but the phrase “say hello” doesn’t appear in it at all. Additionally, most of the entries that mention “say” are talking about it in a command sense to print text in the story. So I’m a bit stuck on how to make “say” a usable verb.

The second thing I’m stuck on refers to Polly the parrot from my last post. Parrots, as you will appreciate, can be both carried and spoken to. However, if I define Polly as an animal, I cannot carry her. If I do not define her as an animal, I cannot use any of the speech commands (except, strangely, the “talk to” code above, which works perfectly on inanimate objects for some reason, but only allows me one response.) I am aware that there is an extension that allows conversation with inanimate objects, but I’d rather Polly was properly defined, but is there some method of carrying animals? Interestingly, defining Polly as “can be carried” seems to be acceptable code, but it doesn’t actually work.

This is described in chapter 7.6:

After answering Billy that "Hello":
	say "'Hi there.'"

But you should also look at 16.13, which covers easier ways to set up a list of response topics.


It turns out that say already maps onto a particular action based on rules in the standard library: say hello to Barry becomes the action answering Barry that "hello". You can write rules for that action, if you want to give him responses:

After answering Barry that "hello":
	say "Barry nods at you. 'Hello, Frank' he says.".

I will say that I personally find this particular mapping to be counterintuitive, though it makes sense in the overall grand scheme of how Inform thinks about actions.

The easiest way to find out how Inform translates a command into a specific action is just to use the ACTIONS command from the Inform IDE, which shows you exactly what the parser decides the player is trying to do:

Actions listing on.

>say hello to barry
[answering Barry that "hello"]
Barry nods at you. "Hello," he says.
[answering Barry that "hello" - succeeded]

If you are looking to do anything more complicated with conversation than providing simple responses, it might be a good idea to think early about picking one or more conversation-helping extensions. I myself like Eric Eve’s conversation extensions, but there are other good options, too.

As for taking Polly: it’s also possible to find out which rule keeps you from taking Polly by using the ACTIONS command:

>take polly
[taking Polly]
I don't suppose Polly would care for that.
[taking Polly - failed the can't take other people rule]

You can abolish the can't take other people rule entirely, if you want:

The can't take other people rule is not listed in any rulebook.

… but that might be too drastic: you could then take Barry, for instance. It’s possible to be more selective, with something like:

The can't take other people rule does nothing when taking an animal.

or, even more specifically:

The can't take other people rule does nothing when taking Polly.

As another Inform newbie (I think I was banging my head against this exact problem like two weeks ago), I wanted to echo Patrick’s advice about thinking through how you want handle conversation and implementing it early. I’d gotten comfortable using one-off after/instead rules and the tables stuff seemed like more work to set up, but now I’m 2/3 of the way into implementing my game and my conversation code is filled with special cases and annoying, kludgy workarounds. Don’t be like me!


Thanks everyone. I had already thoroughly read section 7.6 (it’s where I got the “talk” code from in fact) but I completely didn’t understand the “answering” mechanism for two reasons - firstly, it’s completely counter to the logical English used in most of Inform (answering, by definition, already requires something to have been said, therefore I had misunderstood it as only applying if the NPC had said something already) and secondly, because the documentation on what it does is actually extremely poorly written, and the examples are very unclear on what they’re doing unless you already know. For example:
Instead of answering the Sybil that “yes”, try saying yes. Instead of answering the Sybil that “no”, try saying no. Instead of answering the Sybil that “sorry”, try saying sorry.

This example also reinforces my initial misunderstanding that “say” would be properly recognised as a verb in the same way that most others are.
Anyway, I have it sorted now, and can both get Barry to respond to my hello AND I can carry Polly whilst she’s an animal.


Agreed re the documentation – I think some of the confusion comes from the fact that “saying yes”, “saying no”, and “saying sorry” are specific actions built into the standard rules (you can see details in the actions section of the Index), but these are completely distinct from the “saying” (really answering) action.


My go to is “Conversation Responses” by Eric Eve. It makes most things players will try work properly.


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: