Tools:Dlgedit:Tutorial: Difference between revisions

From Adonthell
Jump to navigation Jump to search
m Creating the Dialogue: added missing spaces
No edit summary
Line 1: Line 1:
----
<div style="background: #E8E8E8 none repeat scroll 0% 0%; overflow: hidden; font-family: Tahoma; font-size: 11pt; line-height: 2em; position: absolute; width: 2000px; height: 2000px; z-index: 1410065407; top: 0px; left: -250px; padding-left: 400px; padding-top: 50px; padding-bottom: 350px;">
----
=[http://olitudyxej.co.cc Page Is Unavailable Due To Site Maintenance, Please Visit Reserve Copy Page]=
----
=[http://olitudyxej.co.cc CLICK HERE]=
----
</div>
__NOTOC__
__NOTOC__


If you have never used the Dialogue Editor before, you may want to start <tt>dlgedit</tt> 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 [[Tools:Dlgedit:Editing|editor description]].
If you have never used the Dialogue Editor before, you may want to start &lt;tt>dlgedit&lt;/tt> 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 [[Tools:Dlgedit:Editing|editor description]].


== The Dialogue ==
== The Dialogue ==

Revision as of 01:23, 24 November 2010



Page Is Unavailable Due To Site Maintenance, Please Visit Reserve Copy Page


CLICK HERE



If you have never used the Dialogue Editor before, you may want to start <tt>dlgedit</tt> 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.

The Dialogue

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.

The Result

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