Adonthell
0.4
|
The lowlevel dialog class. More...
#include <dialog.h>
Public Member Functions | |
dialog (character_base *npc) | |
Default constructor. More... | |
~dialog () | |
Destructor. More... | |
bool | init (string fpath, string name, PyObject *args) |
Load and instanciate the dialog object. More... | |
bool | reload (string fpath, string name, PyObject *args) |
This method is similar to init. More... | |
void | run (u_int32 index) |
Run the dialogue. More... | |
PyObject * | get_instance () |
Returns the Python dialog instance. More... | |
u_int32 | npc_color () |
Returns the color to be used for displaying the NPC's speech. More... | |
const string & | npc_portrait () |
Returns the image to be displayed next to the NPC's speech. More... | |
const string & | npc_name () |
Returns the name to be displayed under the NPC's portrait. More... | |
u_int32 | text_size () |
Returns the number of text lines available at this point of the dialoge. More... | |
string | text () |
Iterates over the dialogue's text. More... | |
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.
dialog::dialog | ( | character_base * | npc) |
bool dialog::init | ( | string | fpath, |
string | name, | ||
PyObject * | args | ||
) |
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.
fpath | full path to the dialogue. |
name | name of the dialogue class. |
args | arguments to pass to the dialogue class |
void dialog::run | ( | u_int32 | index) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
string dialog::text | ( | ) |
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.