Confusion in conversations with talk/ask

Hi,

I’m using Inform for Windows 10.1.2.20220830. It’s been a while (many years) since I last used Inform and I’m struggling a bit on some basic conversation. I had all this working when I didn’t create additional rules, though I think my code is unnecessarily verbose. Now I want to include multiple commands in a conversation, with responses based on ownership of an item in the inventory:

I have a man called a fisherman (inclusion of ‘a’ so it prints correctly). I have set a rule so ‘a fisherman’, ‘the fisherman’ or ‘fisherman’ are all accepted.

I want the player to either ‘ask’ or ‘talk to’ the fisherman about a particular subject. The subject is ‘weather’, but can be covered by ‘clouds’ or ‘sky’. However, his response is different if you are holding the fishing rods.

I’ve included this at the beginning of the story:

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

But I get this:

>ask fisherman about weather
There is no reply.

>talk to fisherman about weather
I only understood you as far as wanting to talk to fisherman.

>ask the fisherman about the weather
"Last night's squall was fierce and ...(correct response).

>ask the fisherman about sky
There is no reply.


Here is the remainder of my code:

In the end of dock is a man called a fisherman. Understand "the fisherman" or "fisherman" as fisherman.

Instead of telling someone about something, try asking the noun about it. Instead of answering the noun that something, try asking the noun about it.

Weather is a privately-named thing. Understand "clouds/the weather/sky" as "[weather]". 

Check asking about "weather/clouds/sky":
	If the player has the collection of fishing rods,
	say "The fisherman looks at you disapprovingly and you feel a flush of shame. 'Why don't you mind your own business, and I'll mind mine?', he says. With that, he turns his back on you and continues fishing." instead.
	
Check asking about "the weather/weather/clouds/sky":
	If the player does not have the collection of fishing rods,
	say "'Last night's squall was fierce and..." instead.

‘Talking to’ only gets so far. ‘Fisherman’ is ignored, I have to type ‘the fisherman’. My alternative words for weather (eg ‘sky’) are ignored. I have tried adding:

Check talking about "the weather/weather/clouds/sky":

… and that throws an error.

I’m just a little confused. Can anyone help me:

  1. Set up the correct rule so the player can type either ‘ask the’ or ‘talk to’
    (It would be nice if when the player types ‘talk to the fisherman’ it returned ‘about what?’ and the player could just type ‘weather’ and they get the correct response)
  2. Allow ‘fisherman’, 'the fisherman, ‘a fisherman’ etc
  3. Any definition of ‘weather’ (‘the weather’, ‘sky’, ‘clouds’) to be used
  4. The correct code to check when any variation of weather is inputted either with ‘ask about’ or ‘talk to’ is used in conjunction with ownership of the item (fishing rods).

I’m not sure if this warrants a topic table, but that’s a bit further down the line, I think. Thanks in advance.

This means that you must include “the” in order for it to match. Try "weather/clouds/sky" instead. The key point here is that slashes only alternate single words, so what you wrote can match any of the following:

the weather
the weather
the clouds
the sky

You can probably just remove this line. The command parser normally ignores “the” if you type it, and “fisherman” is the default thing that will be understood as the fisherman.

You haven’t defined anything that can match this command. You’ve defined “talk to [someone]”, but that’ll only match “talk to fisherman”.

You would need to define talking like this for that command to work:

Understand "talk to [someone] about [something]" as talking to it about. Understand "talk to [something] about [something]" as talking to it about. Talking to it about is an action applying to two visible things.

(Also, you likely want touchable things rather than visible things, though I’m not certain about that.)

Or if “talk to … about …” doesn’t need any different logic from “ask … about …” you could just make it a synonym:

Understand "talk to [someone]" as asking it about.
Understand "talk to [something]" as asking it about.

I think this line will also enable your “about what?” requirement but I’m not certain:

Understand "talk to [someone]" as asking it about.

I’m not sure I understand what you’re asking for with point 4.

3 Likes

Hi @Celtic_Minstrel , thanks for the reply. I think we’ve managed to capture the different definitions of weather now, but talking still falls short and asking gets no reply. This is what I have now:

Understand "talk to [someone] about [something]" as talking to it about. Understand "talk to [something] about [something]" as talking to it about. Talking to it about is an action applying to two visible things.

Understand "talk to [someone]" as asking it about.
Understand "talk to [something]" as asking it about.

In the end of dock is a man called a fisherman. 

Instead of telling someone about something, try asking the noun about it. Instead of answering the noun that something, try asking the noun about it.

Weather is a privately-named thing. Understand "clouds/weather/sky" as "[weather]". 

Check asking about "weather/clouds/sky":
	If the player has the collection of fishing rods,
	say "The fisherman looks at you disapprovingly..." instead.
	
Check asking about "the weather/weather/clouds/sky":
	If the player does not have the collection of fishing rods,
	say "'Last night's squall was fierce..." instead.

This is what it is returning:

>talk to fisherman about the weather
You can't see any such thing.

>talk to a fisherman about the weather
You can't see any such thing.

>talk to fisherman about weather
You can't see any such thing.

>talk to a fisherman about weather
You can't see any such thing.

>ask fisherman about weather
There is no reply.

>ask fisherman about sky
There is no reply.

>talk to fisherman
There is no reply.

Would it work to make it:

Understand "talk to [someone] about [any thing]" as asking it about.

[This is cut out because it's unnecessary. I replace it with the line below it.]
[Understand "talk to [someone]" as asking it about.]

Report talking to something:
	

In the end of dock is a man called a fisherman. 

Instead of answering the noun that something, try asking the noun about it.

The weather is a privately-named thing. Understand "clouds/weather/sky" as the weather. 

Check asking a fisherman about the weather:
	If the player has the collection of fishing rods:
		say "The fisherman looks at you disapprovingly..." instead;
	otherwise:
		say "'Last night's squall was fierce..." instead.

[What's the difference between with "the" and without it?]

It might not work, but it should help.

2 Likes

This is still requiring an article, and has a redundant occurrence of “weather”. Remember, slashes only alternate words, so that pattern will match any of the following:

the weather
the clouds
the sky

But will not match any of the following:

weather
clouds
sky

2 Likes

Hi, thanks for getting back to me. I’m not at my computer right now so I’ve not been able to try your suggestions. I’ll do so tomorrow. In the meantime I came across Claude AI. Have any of you tried it to perform Inform enquiries? This is what Claude came up with, and again, I’ve not tried this yet as I’m on my phone. I’ll reply again tomorrow.

The rusty key is a thing.

The fisherman is a man in the Harbor. "A grizzled fisherman stands by the docks."

Asking it about is an action applying to one visible thing and one topic.

Understand "ask [someone] about weather/sky/clouds" as asking it about.
Understand "talk to [someone] about weather/sky/clouds" as asking it about.

Asked topic is a truth state that varies.

The asked topic rule is listed first in the specificity rules for asking it about.

This is the asked topic rule:
    if the topic understood matches the topic "weather/sky/clouds":
        now asked topic is true;
    otherwise:
        now asked topic is false.
        
This is the asking it about rule:
    if the noun is the fisherman and asked topic is true:
        if the player has the rusty key:
            carry out the key-holder weather talk activity with the noun;
        otherwise:
            carry out the no-key weather talk activity with the noun;
    otherwise:
        say "[We] converse about [the topic understood]."
        
To key-holder weather talk (this is the key-holder weather talk activity):
    say "[The noun] notices the rusty key you're holding and says, 'Ah, I see you have the key! The weather has been perfect for a spot of exploring lately, if you catch my drift.'"

To no-key weather talk (this is the no-key weather talk activity):
    say "[The noun] looks you up and down, sees you don't have the key, and does a little jig. 'No key, no weather report for you!' he chuckles."

There are some obvious issues with that, and some weird pointless things that it’s doing, so I think I wouldn’t recommend using AI-written Inform code.

2 Likes

Yeah, my sense of the last time this came up was that pretty much all the tools had real issues dealing with any of the IF-specific languages. And looking at the code above, I feel pretty confident that it’d take at least as much time and mental energy to try to clean this mess up as it would to just write the code correctly yourself.

Fair enough, I haven’t tried it yet. It could be a way of learning some of the correct syntax if Inform throws up useful error messages. (I did something similar with Chatgpt and JavaScript, getting as far as making a parser and a few functions, but it was a lot of to-ing and fro-ing.)

I really don’t think Inform would be able to make enough sense of the code above to provide coherent error messages; browsing the examples in the recipe book or publicly-released source for games doing similar stuff to what you’re interested sure seems to me like it would be much more efficient than fighting through this dog’s breakfast.

You are correct. I broke it with Inform pulling an undefined error!

So, back to the topic in hand. I have managed to capture ‘clouds’, ‘weather’ and ‘sky’ to mean the same thing, and I can ‘ask’ about it, but I still cannot 'talk ’ about it.

Shouldn’t this capture both ask and talk…

Check asking about the "weather/clouds/sky":
	If the player has the collection of fishing rods,
	say "Last night's squall was fierce..." instead.

…if I have declared talking as being the same as asking:

Understand "talk to [someone] about [something]" as talking to it about. Understand "talk to [something] about [something]" as talking to it about. Talking to it about is an action applying to two visible things.

Understand "talk to [someone]" as asking it about.
Understand "talk to [something]" as asking it about.

Instead Inform tells me it can’t see the weather when I talk to:

>talk to fisherman about clouds
You can't see any such thing.

>ask fisherman about clouds
"Last night's squall was fierce...

>talk to the fisherman about weather
You can't see any such thing.

I have tried including:

Check talking to about the "weather/weather/clouds/sky":

But that throws an error and surely that is unnecessary anyway.

You haven’t. What you’ve declared is that talking to someone is the same as asking (without specifying a subject), but talking to someone about a specified subject is its own action.

Understand "talk to [someone] about [something]" as talking to it about.
Understand "talk to [something] about [something]" as talking to it about.
Talking to it about is an action applying to two visible things.

If you don’t need talking about something to be its own action, you can just do this instead:

Understand "talk to [someone] about [text]" as asking it about.
Understand "talk to [something] about [text]" as asking it about.
1 Like

OK, that was the bit that was throwing me. I was being too specific when the simpler talk to [someone] about [text]
was all I needed. Thank you, that is now working. Much appreciated, @Celtic_Minstrel

Finally, going back to my alternative names for weather, I have success if I don’t put ‘the’ in front of clouds or sky, but if I input

>ask the fisherman about the clouds
There is no reply.

Understand "clouds/weather/sky" as "[weather]". 

How do I allow for ‘the’ to be included?
[I edited this post because ‘the’ doesn’t work in front of any of them, including ‘weather’. I have changed my declaration of ‘weather’ as a privately-named thing to ‘the weather’ but that makes no difference]

Hmm, I guess [text] disables the behaviour of automatically ignoring articles. You could do this:

Understand "clouds/weather/sky" or "the clouds/weather/sky" as "[weather]". 

Or if you want to support “the weather” but not “the clouds” and “the sky”:

Understand "clouds/weather/sky" or "the weather" as "[weather]".

Note that both of these mean your check rule needs to become this:

Check talking to about "[weather]":

Defining a token that you don’t use won’t do anything useful!

Hmm, I guess [text] disables the behaviour of automatically ignoring articles. You could do this:

Understand "clouds/weather/sky" or "the clouds/weather/sky" as "[weather]". 

Or if you want to support “the weather” but not “the clouds” and “the sky”:

Understand "clouds/weather/sky" or "the weather" as "[weather]".

Note that both of these mean your check rule needs to become this:

Check talking to about "[weather]":

Defining a token that you don’t use won’t do anything useful!


Alternatively…

If you want to declare the weather as an object (or thing) which is not privately-named, then you could do the following:

  • Use [anything] instead of [text] in the lines for understanding the action
  • Instead of as "[weather]" for the above understand line, use as weather (no quotes or brackets).

This method shouldn’t require you to include a variation with an article – since it’s matching a thing, the parser should automatically ignore articles.

1 Like

Changing [text] to [anything] threw an error.

It seems

The weather is a privately-named thing. Understand "clouds/weather/sky" or "the clouds" or "the sky" as weather. 

is being ignored completely due to the check line:

Check asking about "the weather/clouds/sky":
	If the player does not have the collection of fishing rods,
	say "'Last night's squall was fierce 

If I do the above, only ‘the weather’, ‘the clouds’ etc is allowed. Not including ‘the’ returns no reply. If I change this to:

Check asking about "weather/clouds/sky":

now I can ask without ‘the’. But if I include ‘the’, it returns no reply.

What I need is something like:

Check asking about the "weather/clouds/sky" or "the weather/clouds/sky:

but Inform won’t allow this.

Hello! I’m pretty new at this. But for my game I did a table similar to below when asking. I changed it to suit your fisherman scenario. Not sure if it does exactly what you want. Hope it helps…

The field is a room.

The fisherman is a man in the field.

Understand "man" as fisherman when the location is the field.
Understand "fishermen" as fisherman when the location is the field.

Table of Fisherman's Conversations
topic	response
"weather"	"'Lovely isn't it?"
"rain"	"'Grab an umbrella and keep fishing,' he chuckles."
"clouds"	"'Looks like rain,' the fisherman says, peering upwards."
"fish"	"He smiles grimly. 'Haven't had so much as a nibble lately.'"

Instead of asking fisherman about something:
	if the topic understood is a topic listed in the Table of Fisherman's Conversations:
		say "[response entry][paragraph break]";
	otherwise:
		say "The fisherman yawns. 'You're talking to the wrong guy,' he mutters.";

Understand "talk to [someone] about [text]" as asking it about.
1 Like

Hi Zeth, thanks for posting. Yes, I did consider introducing a topic instead, which makes it a little easier, but I want to ensure that the player can say talk as well as ask, and that they can include “the” in front of the topic (“the weather”). Also their reponse changes according to the player holding an item. I may introduce another character so I can test this from scratch.

Another solution is to forget ‘talk’ altogether, but I’m trying to second-guess new players who might be more inclined to type ‘talk’ instead of ‘ask’. Maybe that’s making things more complicated than they need to be.

Ah yes! I think my code also maps ‘talk’ to ‘ask’, so both should work I think. I might be wrong. And you could put extra entries into the table so you could have ‘weather’ and ‘the weather’. I suppose it’s not all that elegant though.

I used your code as a template, thank you, and was able to include any iteration of ‘the’, be it ‘the fisherman’ or ‘the rain’. It works with and without, which is great.

The only problem I have now is that I can’t ‘ask’ anything. It replies ‘You can only do that to something animate.’

Scrap that. I forgot to define my character as a man. OK, so it seems topics based on your template work. Much appreciated, @Zeth . I think I can put this to bed!

1 Like