Menu based conversations

Here’s the same conversation in my version of the extension (Activity-based Simple Chat here: pastebin.com/CrrHxXVy )

"My Simple Chat" by Shadow Wolf

Include Activity-based Simple Chat by Shadow Wolf.

Talking to is an action applying to one visible thing.
Understand "talk to [someone]" as talking to.
Report talking to: say "You have nothing to say.".


The Apartment is a room. Jimmy is a man in the Apartment.

Instead of talking to Jimmy, start a conversation with jimmy-hello.

Jimmy-hello is a chat node. "You exchange some pleasant greetings with Jimmy."

Rule for finding responses to jimmy-hello:
	link to jimmy-chat-1; link to jimmy-chat-2.
	
jimmy-chat-1 is a chat node with quip "Insult Jimmy! ". 
"'You're a real DWEEB, Jimmy! Heh heh.' you say to him.[paragraph break]Jimmy doesn't seem to care."

jimmy-chat-2 is a choose-once chat node with quip "Ask how he's doing lately. ".
"'How's it hanging, Jimmy my man?' you ask him.[paragraph break]'I'm just trying to write my Great American Novel,' he replies."

Rule for finding responses to jimmy-chat-2:
	link to jimmy-chat-1.

Things to note:

Chat nodes are things rather than values. This allows us to assign properties to chat nodes. In particular, the “quip” property is what will (usually) be printed as a menu choice, and the “initial appearance” property contains the response. Inform automatically assigns a plain double-quoted string as the initial appearance of the most recently created thing. So for most simple quip-response nodes, you don’t need to write rules to print the text.

“Finding responses to” is an activity rather than an action. So you don’t have to worry about instead/check/carry out/report rules. You can just write a simple “rule for”, and you can put any code you need in that rule (e.g. allow some choices and not others based on the game world state or previous choices.)

“Giving text for” is an activity as well. The default rule is to print the initial appearance. You can either override this by providing a more specific “rule for giving text” (if the text is going to vary based on the game state), or write before/after rules (if all you want to do is change some flags or whatever).

If the quip’s text is going to change based on game state, you can add rules to the “Showing the link to” activity.

Because these are activities rather than actions, there is no need to include the “instead” keyword in every rule. (Activities execute only the most specific “rule for”, actions execute all applicable “carry out” rules, hence the need for “instead” to override that.)

There are some additional features as well - you can customize the prompt (on a per-node basis, even!), and you can define a followup for a node that’s immediately executed, without showing a menu.

(Additionally, since chat nodes are things, you can define more specialized kinds of chat nodes with additional rules, which could be useful.)