I know it seems complicated with all these attributes, but we will break it down slowly.
You can see that there are 3 main components: <Dialogues> ,<Dialogue> and <TextLine>. We will review them one by one.
<Dialogues>
Contains all the <Dialogue> nodes (i.e. all the dialogues of the game), you only need one <Dialogues> node in your file, it doesn't have any attributes (yet).
<Dialogue>
Will correspond to one dialogue of your game. It contains one or several lines of dialogue.
Attributes:
- id [mandatory]: it's the name of the dialogue. It must be unique so you can call the right dialogue, using the function dialogue. Doing something like Call dialogue("id")
- key_next [mandatory]: The key code of the keyboard key to go to the next text line once the current one is display.
- key_faster [facultative]: The key code of the keyboard key to display the text immediately.
- key_up [facultative]: Only put if there will be choices in this dialogue. The key code of the keyboard key to select the first choice above the current choice selected.
- key_down [facultative]: Only put if there will be choices in this dialogue. The key code of the keyboard key to select the first choice below the current choice selected.
- key_skip [facultative]: The key code of the keyboard key to skip and end the current dialogue.
- skip_function [facultative]: The name of a function that will be called when the user skip the dialogue.
- first_line_id [mandatory]: the id of the first <TextLine> to be displayed.
- typing_sound [facultative]: The name of the sound effect to be played while the text is typed. The sound will be looped during this time.
<TextLine>
Correspond to one dialogue line and its properties. The text that will be displayed must be put between the two XML tags, like this <TextLine> text <TextLine>.
In your text, you can include variable names between brackets, that will then be replaced by their value. <TextLine> You have {gold} gold left <TextLine>
The variable has to be a key of the dictionary "DialoguesVariables".
Attributes:
- id [mandatory]: It must be unique and different than 'end'.
- id_next [mandatory]: The id of the text line to be displayed after the current one. Must be set to 'end' to end he dialogue.
- box_animation [facultative]: The animation of the dialogue box playing during the text line. If not given it will be the same as the previous text line (if it is the first text line and no animation is given it will be "Default").
- avatar_animation [facultative]: The animation of the avatar playing during the text line. If not given it will be the same as the previous text line (if it is the first text line and no animation is given it will be "Default").
- type [facultative]: For now, two values are possible, 'wait' and 'choice'.
If 'wait' is given, the text won't change until the global variable wait is set to 0.
If 'choice' is given the next line will be a choice line. The player will have to choose among different answers.
Here is an example of a <TextLine> with a 'choice' type.
<TextLine id='0' id_next='1' type='choice' choice_number='2'>
<Choice id_next='2'> Yes. </Choice>
<Choice id_next='3'> No. </Choice>
</TextLine>
- choice_number [mandatory if type is 'choice']: The number of choices of this dialogue line.
- begin_function [facultative]: The name of a function that will be called at the beginning of the text line.
- end_function [facultative]: The name of a function that will be called when all the text of the text line is displayed (not when the text line changes).
- end_dialogue_function [facultative]: The name of a function that will be called when the dialogue is over (when the dialogue box is destroyed). Only useful when the id of the textline is 'end'
NEW!
You can now put commands inside of your text, just like this:
"My text[wait] line is[pause] amazing."
By default I just included a wait and a pause functions but you can add any functions you want. For
"Another text line,[hello] another command."
In your project file you just have to create a function named "command_hello"
Conclusion
I hope you will find this useful, and tell me if there is a point you want me to clarify :)