Dialogs
From Web-Adventure-Kit-Wiki
The dialogs are defined in the file adventure/dialogs/Dialogs.xml. The first thing you need to do is create a <Dialog> tag and set and ID to start the dialog later from a Puzzle Controller. The <Dialog> structure is pretty lineal and it is divided by topics of conversation. Inside a topic you define who says what in a specific order. There is only one special section inside the <Dialog> and is the <Startup> where you define a topic of conversation to be played when the Dialog starts.
Contents |
[edit] Dialog tag
Id: Is an unique identification name to reference this dialog later from Puzzles Controller by using the dialog manager method: StartDialog.
[edit] Topic
Topic: A topic is a way to group one or more speakers in a conversation arranged by question or statement and answer. A topic is formed by <Say> tags (explained below).
[edit] Properties
say: If this property flag is true the player's character will repeat the selected dialog option.
visible: If this property flag is false the topic is completely invisible to the player in the dialog menu. This is used to hide this option and you want to activate this dialog option after some event in the game.
id: Identification is a property which is optional for the Topic tag. You must set a Topic id when you want reference it from scripting to do something or use it as target in a Topic Action. (explained below).
[edit] Say tag
Is where you set the string to say and you associate that text to a character id (previously defined in Characters.xml) which is set in the “speaker” property.
[edit] Actions
WAK dialog system has some common built-in actions designed to have a better control of the dialog flow in the game. An action is executed after a topic was played. You set an action to a topic setting the action in the “action” property inside the tag. And when is necessary you use the “target” property to give to the action the required argument. As is shown in the image below remarked with yellow.
After the treasure topic is played the topic below will be activated and shown in the dialog menu.
[edit] Exit:
Usage: action=”exit”
Description: Ends the current dialog.
[edit] Go to:
Usage: action=”goto” target=”DialogIdToGo”
Description: Used to jump between dialogs menu, In case you want to make sub menus you must create another dialog and specify the id of that dialog in the target property.
[edit] Back:
Usage: action=”back”
Description: Used to go back to the previous menu when you previously used the “goto” action to came to the current dialog menu.
[edit] Action:
Usage: action=”action” target=”MethodInPuzzleController”
Description: In the case that you want to have complex interactions after a topic is played you can call a method in one of your puzzle controllers.
[edit] Activate:
Usage: action=”activate” target=”TopicIdToActivate”
Description: Activates a hidden Topic (previously set with visible=”false”) and shows it in the dialog menu.
[edit] Non interactive Dialogs
Some times you want to play a non interactive dialog between characters or a monologue played by a player controlled character. In these cases you have to create a new Dialog with only one topic inside the <Startup> tag and with an Exit action like it is shown in the example below:





