# Trouble with NPC-initiated Conversation Nodes

Hi there. I’ve been puttering around with conversation in I7 using Eric Eve’s Conversation Package, and I’ve run into a dilemma of sorts. I’ve solved it, maybe, but I’m not sure I solved it well.

The scenario is this: the player rings a doorbell, and a turn later an NPC answers it and says, “May I help you?” The player has something in mind to discuss already, so this action should start in a conversation node, with suggested topics.

The code I had was something like this:

[code]Ringing is an action applying to one visible thing. Understand “ring [something]” as ringing. The doorbell can be rung. The doorbell is not rung.

say “Ding![line break]”;
now the doorbell is rung;
Anna opens the door in one turn from now.

At the time when Anna opens the door:
say “The doorknob turns and the door opens. Anna steps out.”;
move Anna to Porch;
initiate conversation with Anna at intro-node;
continue the action.

intro-node is a closed convnode.
The tell-suggestions are { envelope }.
The other-suggestions are { yes-no-suggestion }.

node-introduction for intro-node:
[/code]
All well and good. The problem is that the conversation is initiated with Anna the turn after the door opens:

[code]>ring bell
Ding!

z
Time passes.

The doorknob turns and the door opens. Anna steps out.

z

(You could say yes or no; or tell her about the incriminating envelope.)
[/code]
Whereas what I want is for the node-introduction message and the topic list to happen in the turn Anna steps out.

To add to my confusion, even though the node-introduction hasn’t printed, the conversation has actually already started:

[code]>z
Time passes.

The doorknob turns and the door opens. Anna steps out.

hello, Anna
You are already talking to Anna.

(You could say yes or no; or tell her about the incriminating envelope.)
[/code]
This was quite frustrating for a while – the example game in Conversation Nodes’ documentation shows a character immediately launching into conversation when the player enters, but apparently this doesn’t work when it’s the NPC doing the entering.

My solution so far has been to add a new variation of “initiate conversation” that doesn’t schedule the change for the end of the turn:

```To plunge into a/-- conversation with (new-speaker - a person) at/in/using/with (new-node - a convnode): now the current interlocutor is new-speaker; now the node of the current interlocutor is the new-node; now the node-timer is the node-time of the current node; follow the node-introduction rules for the current node. ```
And then we “plunge into conversation with Anna at intro-node”.

The question is: is there a better way to do this? Is there something that was already in Conversation Node that I’m missing? (More than likely.)

Hmm. Too long a question for a first post?

I don’t know why you aren’t getting an answer. Perhaps there aren’t a lot of people using the Conversation package?

Paul.

That, and the fact that the package (while undeniably impressive) may also be one of the most complex, interdependency-wise. Also, given the impending release of Alabaster’s conversation system, it could be that some authors who might otherwise pick Conversation Package are keeping their options open for the moment.

The Conversation Nodes documentation says:

Here, Eric Eve uses an after rule to initiate the conversation with Sarah.

”Continue the action" means that after this After Going Rule has run, Inform will continue through the rulebooks for the going action. The rulebooks are processed in the order: before rules; instead rules; check rules; carry out rules; after rules; report rules.

So, when the player goes into the Lounge, the check going rules are run, the carry out going rules are run, the above after rule is run (which prepares to switch the node at the end of the turn), the report going rule is run (which prints the room description), and then at the end of the turn the node is switched and the node-introduction rule runs.

However, you initiate the conversation with Anna inside an “At the time when”-phrase.
I’m not sure, but it may be that these, like every turn rules, are themselves processed at the very end of the turn. So that what your code does is setting the event Anna opens the door to occur at the end of the next turn. The player then performs an action and all the rulebooks for it are run; and after that the event takes place – Inform says ”The doorknob turns” etc., moves Anna to the porch and switches the node, and – finds that the turn is already ended. “Continue the action” here does no work, since there is no action to continue. The node-introduction can’t run at the end of the rule since the turn is already ended.

As I said I’m not sure if this is the correct explanation, but if I’m wrong perhaps the post can provoke someone to sort things out.

That sounds plausible. I’ve frequently run into problems with the order of events between Every Turn, At the Time When, When a scene begins or ends, when play begins, and when the story ends.

…returning very belatedly (Christmas Eve, no less). Well, okay, that clears some things up. I didn’t even think about the question of where “At the time when…” was in the event chain compared to “After going to X for the first time…” in the docs.

I think for the time being I’ll stick with my (hopefully not too hacky) solution. I’m also one of the ones interested in the Alabaster conversation framework, but I’ll have to use what’s available.

Thanks for the help!