dialog Class Reference
The lowlevel dialog class.
More...
#include <dialog.h>
List of all members.
Public Member Functions |
| dialog (character_base *npc) |
| Default constructor.
|
| ~dialog () |
| Destructor.
|
bool | init (string fpath, string name, PyObject *args) |
| Load and instanciate the dialog object.
|
bool | reload (string fpath, string name, PyObject *args) |
| This method is similar to init.
|
void | run (u_int32 index) |
| Run the dialogue.
|
PyObject * | get_instance () |
| Returns the Python dialog instance.
|
u_int32 | npc_color () |
| Returns the color to be used for displaying the NPC's speech.
|
const string & | npc_portrait () |
| Returns the image to be displayed next to the NPC's speech.
|
const string & | npc_name () |
| Returns the name to be displayed under the NPC's portrait.
|
u_int32 | text_size () |
| Returns the number of text lines available at this point of the dialoge.
|
string | text () |
| Iterates over the dialogue's text.
|
Detailed Description
The lowlevel dialog class.
It is the link between Python dialogue scripts and the dialogue GUI . As such it is responsible for loading dialogue scripts and for stepping through the dialogue according to the player's input and the current state of the game. After each step, the resulting dialogue text is available for display through the GUI.
Definition at line 44 of file dialog.h.
Constructor & Destructor Documentation
Default constructor.
- Parameters:
-
| npc | The npc this dialogue is assigned to. |
Definition at line 34 of file dialog.cc.
Member Function Documentation
bool dialog::init |
( |
string |
fpath, |
|
|
string |
name, |
|
|
PyObject * |
args | |
|
) |
| | |
Load and instanciate the dialog object.
- Parameters:
-
| fpath | full path to the dialogue. |
| name | name of the dialogue class. |
| args | arguments to pass to the dialogue class |
- Returns:
- true in case of success, false otherwise.
- See also:
- reload()
Definition at line 48 of file dialog.cc.
bool dialog::reload |
( |
string |
fpath, |
|
|
string |
name, |
|
|
PyObject * |
args | |
|
) |
| | |
This method is similar to init.
But unlike init, it will correctly handle dialogues that have changed on disk since they were first imported. This function can safely be called several times, although the dialogue will be reset each time.
- Parameters:
-
| fpath | full path to the dialogue. |
| name | name of the dialogue class. |
| args | arguments to pass to the dialogue class |
- Returns:
- true in case of success, false otherwise.
- See also:
- init()
Definition at line 107 of file dialog.cc.
void dialog::run |
( |
u_int32 |
index |
) |
|
Run the dialogue.
Executes one step of the conversation. Afterwards the NPC's speech and possible reactions of the player can be retrieved via the text() method.
- Parameters:
-
| index | the index of the chosen alternative from the previous list of text. |
Definition at line 139 of file dialog.cc.
PyObject* dialog::get_instance |
( |
|
) |
[inline] |
u_int32 dialog::npc_color |
( |
|
) |
[inline] |
Returns the color to be used for displaying the NPC's speech.
- Returns:
- the NPC's color.
Definition at line 114 of file dialog.h.
const string& dialog::npc_portrait |
( |
|
) |
[inline] |
Returns the image to be displayed next to the NPC's speech.
- Returns:
- name of the image.
Definition at line 122 of file dialog.h.
const string& dialog::npc_name |
( |
|
) |
[inline] |
Returns the name to be displayed under the NPC's portrait.
- Returns:
- name of the NPC.
Definition at line 130 of file dialog.h.
u_int32 dialog::text_size |
( |
|
) |
[inline] |
Returns the number of text lines available at this point of the dialoge.
- Returns:
- the number of available dialogue texts. 0 if the dialogue is finished.
- See also:
- text()
Definition at line 141 of file dialog.h.
Iterates over the dialogue's text.
Depending on the current state of the dialogue, there can be multiple alternatives. The first string is always the NPC's speech. Any following strings are the player's possible reactions. The value passed to the run () method is the (zero-based) index of the alternative chosen by the player.
- Returns:
- the next string in the list of text, or the empty string "" when the end of the array of strings has been reached.
- See also:
- text_size()
Definition at line 127 of file dialog.cc.
The documentation for this class was generated from the following files: