If you have never used the Dialogue Editor before, you may want to start dlgedit now and follow the instructions you find below. This way, you will be guided through the creation of a small example dialogue, in order to get you accustomed to using the editor. For a full description of its functionality, see the editor description.
This is a very simplistic dialogue we want to model, but you will see that it is sufficient to demonstrate the basic functionality of the Dialogue Editor.
Npc : "Hello, I am Eric." Player: "I am Kai." or "Goodbye!" Npc: "Nice to meet you." "Fare well." Player: "Goodbye!" Npc: "Fare well."
Creating the Dialogue
Dialogues start with a NPC line, so that is what we add first. Simply left-click on the dialogue area of the editor. A dialog window pops up that allows you to enter the text of the node. As you see, NPC is selected as default, so simply enter the line of dialogue (â€Hello, I am Eric.â€) and press OK. What you will see when moving the cursor over the newly created node is the following:
Now we add the playerâ€™s response. To do this, left-click on the circle. It will appear in red to signal that it is the selected node. Now left-click on a location a bit further down. Again the Edit window pops up, this time with Player preselected, just as we want it. Enter the text (â€I am Kai.â€) and press OK.
Your screen should look like this. The NPC node is still selected, therefore drawn red, and the Player node is drawn blue, to distinguish it from NPC nodes. The arrow between them symbolizes the flow of the dialogue.
Since the player shall have two possible responses, we have to create another Player node, somewhere next to the first one. (â€Goodbye!â€) Voila, the first two lines of dialogue are already done.
Now right-click on an empty spot to deselect the NPC node and then select the first Player node. It will be outlined red. Left-click somewhere below it, enter the appropriate text (â€Nice to meet you.â€), confirm with OK and repeat the same for the second Player node (â€Fare wel l.â€).
If your display shows something similar, youâ€™ve done it :-). Now lines 4 and 5 of the Dialogue have to follow, but, as you have already noticed, they are just the same as a part of the existing dialogue. Would be nice if we could reuse that part, eh? Well, we can. All we need to do is linking the right nodes.
Okay, lets dot it: Deselect the Player node and select the bottom left NPC node (or the node corresponding to that one on your screen). Then simply left-click on the Player node that needs to follow. And this is the complete dialogue:
If you want to change a node at any later point, you can bring up the Edit window for the selected node by pressing the middle mouse button or Enter on your keyboard. To delete a node or arrow, select it and press Delete.
Of course this is a most minimalistic example, and there are many advanced techniques yet to be explored, like adding custom code to your dialogue. But at least you should have learned how to operate the program. For detailed descriptions of the remaining features refer to the following chapters.
Now save (File->Save) and compile (Dialogue->Compile) the dialogue. Youâ€™ll get a .py file, the Python dialogue script that is used by the engine to display the dialogue. Usually, you will never have to deal with that file directly, but at least you should know that it exists. In our example it will look similar to the following:
import dialogue # -- pygettext support def _(message): return message class untitled (dialogue.base): text = [None,\ _("Hello, I am Eric."),\ _("I am Kai."),\ _("Goodbye!"),\ _("Nice to meet you."),\ _("Fare well.")] # -- (speaker, code, ((text, operation, condition), ...)) dlg = [\ (None, -1, ((1, 0, -1), )),\ ("Default", -1, ((2, 0, -1), (3, 0, -1), )),\ (None, -1, ((4, 0, -1), )),\ (None, -1, ((5, 0, -1), )),\ ("Default", -1, ((3, 0, -1), )),\ ("Default", -1, ())] def __init__(self, p, n): self.namespace = globals () self.the_player = p self.the_npc = n
As you can see, it contains all the lines of text we just entered (prepared for translation via GNU gettext), the structure of the dialogue and a small initialization routine.
Refer to the Adonthell Engine Architecture documentation if you would like to get an even better understanding of the dialogue engineâ€™s inner workings