Menu based conversations

I tried simple chat but it seems too well… simple. The problem I’m having is I need full control over what conversation choices lead where and to have the flow of the conversation modify certain variables.

I’ll second the recommendation of Michael Martin’s quips extensions. His example included with the extension is illustrative and amusing, too.

Why wouldn’t that be possible with Simple Chat? Its conversations are built up out of rules, and you can put absolutely any code you want in those rules.

Well maybe it’s just how it’s programmed. Maybe a table based system would be better? I really wish I had something visual I could work with when writing out the conversations… because what I’m planning is very interwoven.

Complex conversations can definitely be a challenge. Standard text editors often do not lend well to displaying the nodes in a way that makes total sense.

If using tables is good enough, you could try storing your conversation content in them. It should be compatible with most existing conversation systems. You would have to use something like “say content in row 5 of table of jamesconv” to take text from the table. This way, you can separate the code from the bodies of text. That’s just one way to keep things a little cleaner.

1 Like

I’ve always felt the table-based systems offer less control over what choices are available and where they lead, because the tables are usually difficult to alter dynamically. (Whereas both versions of Simple Chat use a rulebook to set up choices, so you can specify exactly what you want in any given situation.)

If you’re looking for a visual way to edit the conversation, though, that’s well beyond the scope of any possible extension - it would have to be a separate app outside the IDE.

Depending on what the non-conversational parts of your game require, perhaps you could go all the way to a choose-your-own-adventure format? Twine features a visual editor that lets you see how the nodes are structured.

Soooo… I don’t think I quiet understand how simple chat works, the documentation isn’t very clear… any one mind writing up a quick tutorial?

A comprehensive tutorial is a bit much to ask, I think. What are you trying to do and which part is it that you don’t know how to make?

Here’s a quick example. First I’ll just paste over the whole thing, then go over the important points.

Talking to is an action applying to one thing.
Understand "talk to [something]" as talking to.
Carry out talking to: say "We've got nothing to talk about."

Jimmyhello, jimmychat1 are chat nodes.
jimmychat2 is a sc-once chat node.

Instead of talking to jimmy, run a conversation from jimmyhello.

Report giving text for jimmyhello: say "You exchange some pleasant greetings with Jimmy." instead.
Carry out finding responses to jimmyhello: link to jimmychat1; link to jimmychat2.

Report giving link to jimmychat1: say "Insult Jimmy! " instead.
Report giving text for jimmychat1: say "'You're a real DWEEB, Jimmy! Heh heh!' you say to him.[paragraph break]Jimmy doesn't seem to care." instead.

Report giving link to jimmychat2: say "Ask how he's doing lately. " instead.
Report giving text for jimmychat2: say "'How's it hanging, Jimmy my man?' you ask him.[paragraph break]'I'm just trying to write my great American novel,' he replies." instead.
Carry out finding responses to jimmychat2: link to jimmychat1.

The “talking to” action is not strictly required by simple chat. To actually start the conversation, we need to trigger the line ‘run a conversation from’, which can be caused by nearly any action, text token, or phrase.

Now simple chat needs chat nodes which act as the waypoints in the conversations. In my example, there are three nodes of two different types. A regular “chat node” will always remain active until your code manually tells it to become inactive. A “sc-once chat node” will automatically become inactive after the player chooses it. (There is also sc-shown-once but you probably won’t use that very much.)

Now the rules that describe the behavior of the chat nodes themselves is where it gets a little complicated. Each chat node needs two or three specific rules depending on where it is in the conversation tree.

  1. “Report giving link” rule. This will appear as the menu text presented to the player when this node can be chosen.

  2. “Report giving text for” rule. This is where the content of the conversation plays out when it is chosen. You can also insert other code before or after the ‘say’ to control the activation of nodes and other things. Good for those instances where a decisive conversation choice can effect the world in some way.

  3. “Carry out finding responses to” rule: This defines the player’s possible choices to continue the conversation from this node. If you do not link to any other chat nodes, the conversation will end.

Note how some of the rules for the chat nodes have “instead” in them. These insteads are necessary because without them, simple chat will print unnecessary errors.

Thank you, that was very helpful.

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.)

I really like your activity based chat (now that I know how to work it :stuck_out_tongue:), very simple syntax makes me happy.

I have tried this example with your extension but get the following error:

It is from the extension itself.

Can you help please.

This is an old, old extension that I haven’t ever used, so fair warning I don’t really know whether this will be a dead end, but I was able to get the extension to compile by changing this line:

To give text for (C - a chat node): carry out the giving text for activity with C.

To:

To give text for (C - a chat node): carry out the giving text activity with C.

(Deleting the second “for”).

Thanks, I will give it a go.

Can you perhaps guide me with a menu type conversation but with different outcomes?

As I am still new to this, I am having trouble setting up a basic menu-based conversation.
I am still trying to figure out how this coding language works, so any advice will be great.

This again for my Meeting Room project i told you about.

Say the presenter talks to the audience and they can ask questions but from a menu.

Each option can spark a different reaction from the presenter or a different outcome in the story line.

Thanks

The extension I’ve used is Quip-Based Conversation by Michael Martin, which itself relies on Reactable Quips by the same author. There’s full documentation for each of those (just read below the code in both extensions and you’ll see that, including examples), but to give you a flavor, here’s what the code for a short conversation would look like:

Include quip-based conversation by Michael Martin.

Kitchen is a room.  The cook is a person in the kitchen.   The greeting of the cook is cook-greeting.  The litany of the cook is the table of cook conversation.  The plate of food is nowhere.

Table of Quip Texts (continued)
quip	quiptext
cook-greeting	"'What are you doing in the kitchen?' the cook demands."
cook-getout	"'Now get out of my kitchen.'"
cook-poofed	"'A likely story,' he says with narrowed eyes."
cook-philosophical	"'Heaven save me, a philosopher,' he mutters, reaching for his cleaver."
cook-hungry	"'Oh.  That's all right then,' the cook says, and hands you a plate of food."
cook-thanks	"'You are welcome.  Now get out of my kitchen.'" 

Table of Cook Conversation
prompt				response	enabled
"'Beats me, I just poofed into existence here.'"				cook-poofed	1
"'What are any of us doing anywhere?'"				cook-philosophical	1
"'I'm looking for food, of course.'"				cook-hungry	1
"'Cheers!'"				cook-thanks	0  

After quipping when the current quip is cook-hungry:
	Now the player has the plate of food;
	Enable the cook-thanks quip;
	disable the cook-poofed quip;
	disable the cook-philosophical quip;
	Now the greeting of the cook is cook-getout.

I’ve also heard of people using Hybrid Choices by AW Freyr, and Eric Eve’s Conversation Framework, though don’t have personal experience with those.

1 Like

Thanks for this code.
I can use this in my project but instead of the two chat nodes you have for “Insult Jimmy” and “Ask how he is doing”, that is opposite of each other I want to use this as a question answer where you can use both options but if both was used the conversation should opt out.
I am not sure how that code looks as I only get it to loop all the time.

How can I get something like the below to work?

nathan-chat-alicia-2 is choose-once chat node with quip "([italic type]Alicia[roman type]) I’m glad we had time to meet up.". "([italic type]Nathan[roman type]) Me too. So, what’s going on?".
Rule for finding responses to nathan-chat-alicia-2:
	if greeted-peter is false:
		link to nathan-chat-alicia-3; link to nathan-chat-alicia-1a;
		now greeted-peter is true;
	otherwise:
		link to nathan-chat-alicia-3; link to nathan-chat-alicia-2a.

I know this is probably not correct but I want to bring a third person into the conversation.
So far it works well but at some stage I need to refer to the third person’s second response. The problem is there are already two references for two other quips.

So, is it possible to bring in an if-otherwise statement like I tried above?
The one above does not work.

Can you please advise on how I can get this to work?

Below is the error:

Answered in the other thread.

Thanks, I will check it out.

I think I will manage to get it to work now.