How to implement a comma based NPC´s dialogue system à la Infocom?

Hello, everyone.

I was searching for this, but I am not able to find what I am looking for.

I would like to implement a dialogue system similar to Infocom´s. In other words: the NPC´s name followed by a comma and the message. “Name, X”. Thank you!

1 Like

The comma format is used for giving instructions to other characters. In Writing with Inform (the documentation in the IDE), this is at sections 12.3 through 12.5.

2 Likes

Thank you, Phil.

I see, this is for giving instructions to other NPC´s. I thought this structure was valid also for any kind of conversation, but I suppose I was wrong.

It’s typical to use TELL X ABOUT Y or ASK X ABOUT Y for conversation. There’s also SAY X, but that’s less often used because it’s so freeform.

There are a number of conversation extensions to try (and I definitely would try one or more):

Threaded Conversations by Chris Conley
Clues and Conversations by Brian Rushton (Mathbrush)
Conversation Package by Eric Eve

2 Likes

I am using the three you mentioned. I will look into the extensions you kindly suggested. Thank you again!

1 Like

By default, if you say NPC, SOMETHING (where SOMETHING isn’t a valid command), it’ll get turned into the “answering it that” action. So if you attach your dialogue code to this action you can use this syntax right out of the box.

3 Likes

Ah I wasn’t aware of that. Thanks.

Thanks, Daniel. Could you give a code example?

The Temple is a room.
The Oracle of Delphi is a woman in the temple.
Instead of answering the Oracle of Delphi that a topic:
    say "'[the topic understood]', you say, hoping for divinely-inspired insights into the future…".
Test me with "oracle, my crops are failing".
2 Likes

Thank you, Daniel. Unfortunately, I don´t know why but it didn´t work for me.

I entered the following code, but when I try “mayordomo, reciclaje” there is no answer from the NPC.

Reciclaje is a thing.

Instead of answering the mayordomo that "reciclaje":
	say "¿Qué me dice del reciclaje?- digo inquisitivamente al mayordomo…";

This worked great for me. Maybe you forgot to say Mayordomo was a person? Because I made that mistake for one second.

Here’s my code (copying yours):

`"Sandbox" by mathbrush

Toyroom is a room.

The mayordomo is a person in toyroom
	
Reciclaje is a thing.

Instead of answering the mayordomo that "reciclaje":
	say "'¿Qué me dice del reciclaje'?- digo inquisitivamente al mayordomo…";`

and here’s the result:

Toyroom
You can see a mayordomo here.

>mayordomo, reciclaje
"¿Qué me dice del reciclaje"?- digo inquisitivamente al mayordomo…
>

Edit: also, you don’t need ‘reciclaje’ to be a thing to talk about it. ‘Answering it that’ only looks at the text you type in, not if it corresponds to anything in the world.

3 Likes

Thank you, Brian.

No, the mayordomo is a person in my game, so that doesn´t seem to be the problem. Maybe I have another line of code interfering with the command. I will check if there is something like that messing with this instruction.

The one other thing I can think of is that Inform has a character limit to comands, so if you have a command that starts with the same letters (like ‘reciclar’ or something), inform might be cutting off the end of the word and thinking you’re ordering the guy to recycle.

2 Likes

I suppose it is something else, but who knows? The code its long and maybe there are some other things interfering. If I can´t find the problem maybe I could stick to say, tell, ask…

Thanks everyone for all the help!

1 Like

Try using the ACTIONS command, then talking to the NPC. That will let us see what the parser thinks you’re doing.

2 Likes

Thanks!

This is the message I get:

actions

Actions listing on.

mayordomo, reciclaje

[answering el mayordomo that "

[** Programming error: tried to read from -->-1 in the array “parse”, which has entries 0 up to 60 **]

mayordomo , reciclaje"]

No hay respuesta.

[answering el mayordomo that "

[** Programming error: tried to read from -->-1 in the array “parse”, which has entries 0 up to 60 **]

mayordomo , reciclaje" - succeeded]

1 Like

Now that absolutely should not be happening. That means something’s broken inside the parser so it’s setting “the topic understood” to an invalid snippet.

If you make a new project, and just put Brian’s code into it exactly as shown above, do you get the same error?

1 Like

If you’re using the Spanish language extension, maybe that is interfering in some way?

2 Likes

I was hoping it wasn´t that, but maybe it´s that.

1 Like

It gives an error, yes.

Problem. You wrote ‘Use interactive fiction language elements’ : but the ability to activate or deactivate compiler elements in source text has been withdrawn, in favour of a new system with Inform kits.


Problem. You wrote ‘Use interactive fiction language elements’ : again, the ability to activate or deactivate compiler elements in source text has been withdrawn.

Problems occurring in translation prevented the game from being properly created. (Correct the source text to remove these problems and click on Go once again.)