The TalkDialogue system is an implementation of the Talk system that focuses on the dialogue between NPC and player.

Dialogue Tree (DT) is the meat of the TalkDialogue system, and is the syntax that is used in order to parse the dialogue and make use of them in a logical tree, the DT.

I’ve incorporated the design I made in 2015 which seems to be still the best way to incorporate multi-choice type of dialogue that can be expressed in a linear fashion in a relatively unobtrusive way.

DT as Dictionary

The DT will be described in a C2 Dictionary. It will use Rex’s CSVToDictionary to source a text file that is properly formatted for DT.

Topics and Choices

The 2 main concepts in DTs are Topics and Choices. Topics are the main areas, while Choices are the pathways to Topics. It’s not always necessary to have a Choice to lead to a Topic, since a Topic is able to switch to another one on its own without a Choice.

Usually, however, the Choices reflect the Topics.

Topicsaccomps and Choiceaccomps

The ‘accomps’ of both Topics and Choices is the conditional priority to display a particular Topic or Choice depending on the accomps. The examples will be the best way to explain this.


Topics, Choices, Topicsaccomps, and Choicesaccomps must be declared in the following respective keys:


So for example:

topicsaccomps|pedro upset
choicesaccomps|met eugie,pedro upset

The declaration collects the keywords so that the querying-key can be constructed in C2.

Entry point

The first topic is usually intro. And this must be initialised as well.


Because it stored in a Dictionary, this is modifiable by the game, so it can change based on anything.

Also, Topicsaccomps is also a conditional that exists within the TalkDialogue file. Topicsaccmp is covered below.

Topic/Choice syntax

Topic and Choices have similar syntax. The base syntax is:


The <key> portion is expanded to be tokenised by full-stop/period (.).


topic.intro.$.string.1|My name is Pedro.

The first token is the ‘topic‘ keyword to denote that this is a Topic.

Second token is the Topic identifier/term itself. And this goes back to the Topic declaration. This Topic term must exist in the declaration because this is what will be used to find valid Topics.

Third token is the Topic condition. When is is a ‘$’ it means that this entry is the default to use, or more accurate, there is no accomps needed to make this Topic condition displayable.

However if there is a Topic condition that is specified, for example:

topic.intro.pedro upset.string.1|So you want some of my stinky food, esse?

Where ‘pedro upset’ is the condition, and if ‘pedro upset’ is found in the accomps, then this would be the Topic that will show if ‘intro’ was called.

The fourth token is the the directive. A directive is a clear identifier of what is being specified about this Topic.

string‘ refers to the data that will be displayed as text. But before the data, there are modifiers.

string.vars‘ refer the the possible variations of text that can be displayed for this Topic. This can be omitted if there is only 1 variation.

string.#‘ is the actual string to be displayed. At the minimum, ‘1’ is specified, meaning this is the first (if not only) text to display.

choices‘ is a subset of the Topic. This indicates the Choice terms that will be displayed in the choice area in the TalkDialogue gui for when this Topic comes up.

Note that by default, all Choices are included without having to specify anything. However, it is possible to exclusively include and exclude Choices.

To exclude a Choice, use the ! modifier:


So this displays all choices except ‘outside’, ‘runaways’, and ‘burritos’.

When only particular Choices are needed, then you must explicitly write the terms:


This displays only one Choice, which is ‘exit’.


As already described above, Topicsaccomps is the conditional display of a Topic. This allows multiple versions of a single Topic to be displayed based on the global accomps Dictionary.

An example:

topic.intro.pedro upset.string.vars|1
topic.intro.pedro upset.string.1|So you want some of my stinky food, esse?
topic.intro.pedro upset.choices.1|!burritosbad

The third token is the condition. A non-default condition must have its other parameters populated again, just like above, where the vars, string and choices parameters were filled out even though the default intro had already been.

Topic func

A Topic function is actually a directive.

topic.burritosgood.$.string.1|Glad you appreciated it. Here's something else you might appreciate.

In the last line, func was defined as PedroNotUpset, and PedroGiveSecPass. This relates directly into C2 functions which is called. In the C2 function, PedroNotUpset() will remove any previous accomps that would have written ‘pedro upset’ so that Topics or Choices do not test success against the accomp. PedroGiveSecPass() might add an secpass item to the INV.

Topic exit

The Topic exit directive tells TalkNPC that this is the last Topic and the NPC is terminating the dialogue (vs a Choice exit, which is the player terminating the dialogue).

topic.burritosbad.$.string.1|Yeah, well you stink, too.

When exit is defined, it must have the integer 1 as the value in the Dictionary.


Now to Choices’ specific stuff. For the most part, Choices are the same kind of entity as Topic, and follow the token meanings.

The main difference would be that Choices are subordinate to Topics, and so do not have a topic directive, as Topics have choice directives.

Choice exit vs Topic exit

In regards to the exit function for both Choice and Topic, there are two ways to go about it. A Choice can lead to a Topic that exits, or can direct to exit the conversation the moment the Choice is pressed.

An example of a Choice to a exit Topic:

choice.exit.$.string.1|Ok, thanks, Pedro. I'll see you around.

Note that Choice ‘exit’ is implicitly tied to the Topic ‘exit’. When Choice ‘exit’ is pressed, it will immediately head to the Topic ‘exit’ and display “Adios” or “Bye”. Then because the exit directive is present, the TalkDialogue gui will display some sort of exit button to wait until the player has finished reading the text.

An example of a Choice that immediately exits:


When the Choice is presented, it is only “Bye”, and because this Choice has an exit directive, it will not try to find a topic called ‘exitnow’. Instead, upon choosing this Choice, the TalkDialogue gui will immediately terminate the dialogue.

Topic nexttopic directive

A Topic itself could be a ‘dead-end’, so it’s advantageous to have a way to jump to another Topic afterwards. nexttopic is the directive to use. Example:

topic.batterywhere.$.string.1|Wish I could tell you, but that's going to land me in deep in jail. Avoid jail. Nothing good can come of it.

When ‘batterywhere’ is reached and the display string presented, when the nexttopic directive is detected, then it prompts the TalkDialogue gui with a ‘Next’ button, waiting for the user to finish reading the message before heading off to the specified Topic.

%d bloggers like this: