![]() |
DI-Guy SDK Documentation
13.6
|
#include <diguySignal.h>
Public Member Functions | |
General Functions | |
All functions in this section are callable from:
| |
| const char * | get_name () |
| Returns the name of the object. More... | |
| int | set_name (const char *name) |
| This function sets the name of this object. More... | |
| const char * | get_type_name () |
| Returns the type name of the object. More... | |
| int | reset () |
| This function resets the signal. More... | |
| int | trigger () |
| This function triggers the signal. More... | |
| int | triggered () |
| Returns: Returns the number of times this signal has been triggered since the scenario started or since the last call to reset(). More... | |
| int | triggered_at_least_n_times (int n) |
| Returns: Returns 1 if the signal has been triggered at least n times, else returns 0. More... | |
| int | signal_palette_show () |
| This function causes the button for this signal to become visible in the DI-Guy Scenario Signal Palette. More... | |
| int | signal_palette_hide () |
| This function causes the button for this signal to become hidden in the DI-Guy Scenario Signal Palette. More... | |
| int | get_is_visible_in_signal_palette () |
| This function returns a flag specifying whether the signal's button is visible in the DI-Guy Scenario Signal Palette. More... | |
| const char * | get_info_text () |
| This function returns an optional signal description buffer. More... | |
| void | set_info_text (const char *info_text) |
| This function sets an optional signal description buffer. More... | |
Event Handler Functions | |
All functions in this section are callable from:
| |
| int | map_event_handler_to_callback_id (int callback_id, const char *handler_name) |
| This function maps the event handler with the given name to a callback id. More... | |
| int | unmap_event_handler_from_callback_id (int callback_id, const char *handler_name, int unmap_all_matches=0) |
| This function unmaps the event handler with the given name from a callback id. More... | |
Callback Functions | |
| enum | { CALLBACK_ID_PRE_TRIGGER = 1, CALLBACK_ID_POST_TRIGGER } |
| This is an enumeration of the different callbacks that can be registered with add_callback() and add_callback_script(). More... | |
| int | add_callback (int callback_id, diguySignalCallback *callback, void *callback_params=0, void *callback_user_data=0) |
| This function adds a user callback. More... | |
| int | remove_callback (int callback_id, diguySignalCallback *callback) |
| This function removes a user callback. More... | |
| int | remove_callback_with_user_data (int callback_id, void *callback_user_data) |
| This function removes a user callback. More... | |
| int | add_callback_script (int callback_id, const char *callback_script, const char *callback_script_type=NULL) |
| This function adds a user callback script. More... | |
| int | remove_callback_script (int callback_id, const char *callback_script, const char *callback_script_type=NULL) |
| This function removes a user callback script previously added with add_callback_script(). More... | |
Private Functions | |
The functions and variables past this point are for internal use only. No external access to them is expected or necessary. | |
| bdiScenarioSignal * | m_signal |
| A pointer to internal data. More... | |
| class | bdiScenarioSignal |
| bdiScenarioSignal * | get_scripted_object () |
| diguySignal (bdiScenarioSignal *signal) | |
| A private constructor. More... | |
A signal from the User interface that can be used to trigger logic.
| anonymous enum |
This is an enumeration of the different callbacks that can be registered with add_callback() and add_callback_script().
Usable From:
| Enumerator | |
|---|---|
| CALLBACK_ID_PRE_TRIGGER | |
| CALLBACK_ID_POST_TRIGGER | |
|
private |
A private constructor.
| const char* diguySignal::get_name | ( | ) |
Returns the name of the object.
This pointer will never be NULL.
Returns:
name of the signal
| int diguySignal::set_name | ( | const char * | name | ) |
This function sets the name of this object.
Returns:
0 on success, -1 on failure
| const char* diguySignal::get_type_name | ( | ) |
Returns the type name of the object.
This pointer will never be NULL.
Returns:
type name of the object
| int diguySignal::reset | ( | ) |
This function resets the signal.
The number of times the signal has been triggered will be set to 0.
Returns:
0 on success, -1 on failure
Callable From:
| int diguySignal::trigger | ( | ) |
This function triggers the signal.
If a sound is associated with the signal, it will be played. The number of times the signal has been triggered will be incremented by one.
Returns:
0 on success, -1 on failure
Callable From:
| int diguySignal::triggered | ( | ) |
Returns: Returns the number of times this signal has been triggered since the scenario started or since the last call to reset().
Callable From:
| int diguySignal::triggered_at_least_n_times | ( | int | n | ) |
Returns: Returns 1 if the signal has been triggered at least n times, else returns 0.
Callable From:
| int diguySignal::signal_palette_show | ( | ) |
This function causes the button for this signal to become visible in the DI-Guy Scenario Signal Palette.
This function is for DI-Guy Scenario only.
Returns:
0 on success, -1 on failure
| int diguySignal::signal_palette_hide | ( | ) |
This function causes the button for this signal to become hidden in the DI-Guy Scenario Signal Palette.
This function is for DI-Guy Scenario only.
Returns:
0 on success, -1 on failure
| int diguySignal::get_is_visible_in_signal_palette | ( | ) |
This function returns a flag specifying whether the signal's button is visible in the DI-Guy Scenario Signal Palette.
This function is for DI-Guy Scenario only.
Returns:
1 if the signal's button is visible, 0 if not
| const char* diguySignal::get_info_text | ( | ) |
This function returns an optional signal description buffer.
Returns:
pointer to info text
| void diguySignal::set_info_text | ( | const char * | info_text | ) |
This function sets an optional signal description buffer.
| info_text | text of info |
| int diguySignal::add_callback | ( | int | callback_id, |
| diguySignalCallback * | callback, | ||
| void * | callback_params = 0, |
||
| void * | callback_user_data = 0 |
||
| ) |
This function adds a user callback.
| callback | pointer to function with prototype diguySignalCallback (typedefed above) |
| callback_id | integer id of when this callback is to be called |
| callback_params | not currently used; pass NULL |
| callback_user_data | pointer for user's own use; DI-Guy will do nothing to the contents of this pointer beyond passing it back when the callback is invoked |
callback_id should be one of the following values:
CALLBACK_ID_PRE_TRIGGER
This callback will be called whenever the trigger() function is called, whether internally by DI-Guy of explicitly by the user in C++ or in a script. It will be called before the default handler of the function. There are no parameters for this callback.
CALLBACK_ID_POST_TRIGGER
This callback will be called whenever the trigger() function is called, whether internally by DI-Guy of explicitly by the user in C++ or in a script. It will be called after the default handler of the function. There are no parameters for this callback.
Callback Return Values:
Callbacks return a value of type diguyCallbackReturn, which will be DIGUY_CALLBACK_STOP or DIGUY_CALLBACK_CONTINUE. If the callback returns DIGUY_CALLBACK_STOP, the default handler of the function will not be called; the callback is asserting that it has done everything necessary for the function call. If the callback returns DIGUY_CALLBACK_CONTINUE, the default handler for the function will be called after the callback.
Returns:
0 on success, -1 on failure
Callable From:
| int diguySignal::remove_callback | ( | int | callback_id, |
| diguySignalCallback * | callback | ||
| ) |
This function removes a user callback.
All callbacks matching the specified callback_id and callback function will be removed.
| callback_id | integer id of when this callback is to be called |
| callback | pointer to function with prototype diguySignalCallback (typedefed above) |
Returns:
0 on success, -1 on failure
Callable From:
| int diguySignal::remove_callback_with_user_data | ( | int | callback_id, |
| void * | callback_user_data | ||
| ) |
This function removes a user callback.
All callbacks matching the specified callback_id and callback_user_data pointer will be removed.
| callback_id | integer id of when this callback is to be called |
| callback_user_data | pointer for user's own use |
Returns:
0 on success, -1 on failure
Callable From:
| int diguySignal::add_callback_script | ( | int | callback_id, |
| const char * | callback_script, | ||
| const char * | callback_script_type = NULL |
||
| ) |
This function adds a user callback script.
Callback scripts can be removed with remove_callback_script().
See diguyCharacter::add_callback_script() for an example of use.
| callback_id | integer id of the callback |
| callback_script | script text of callback to be added |
| callback_script_type | the type of script contained in callback_script |
If NULL is passed for callback_script_type, a default script type will be derived based on the default script interpreter of the scenario.
Lua specific:
When the script is called, the object for which it is being called will be in the callback_object global.
To pass NULL when calling from a lua script, use nil.
Returns:
0 on success, -1 on failure
Callable From:
| int diguySignal::remove_callback_script | ( | int | callback_id, |
| const char * | callback_script, | ||
| const char * | callback_script_type = NULL |
||
| ) |
This function removes a user callback script previously added with add_callback_script().
See diguyCharacter::remove_callback_script() for an example of use.
| callback_id | integer id of the callback |
| callback_script | script text of callback previously added |
| callback_script_type | the type of script contained in callback_script |
If NULL is passed for callback_script, all callback scripts whose ids match callback_id and whose types match callback_script_type will be removed.
If NULL is passed for callback_script_type, a default script type will be derived based on the default script interpreter of the scenario.
Lua specific:
To pass NULL when calling from a lua script, use nil.
Returns:
0 on success, -1 on failure
Callable From:
| int diguySignal::map_event_handler_to_callback_id | ( | int | callback_id, |
| const char * | handler_name | ||
| ) |
This function maps the event handler with the given name to a callback id.
This mapping will be saved in the .dss file and restored when the .dss file is loaded.
Mappings can also be made via the DI-Guy Scenario UI.
The event handler is one of the following:
| callback_id | integer id of callback |
| handler_name | name of the event handler to map |
Returns:
0 on success, -1 on failure
| int diguySignal::unmap_event_handler_from_callback_id | ( | int | callback_id, |
| const char * | handler_name, | ||
| int | unmap_all_matches = 0 |
||
| ) |
This function unmaps the event handler with the given name from a callback id.
| callback_id | integer id of callback |
| handler_name | name of the event handler to map |
| unmap_all_matches | pass 0 to unmap only the first match, pass 1 to unmap all matches |
Returns:
0 on success, -1 on failure
|
inline |
|
friend |
|
private |
A pointer to internal data.