DI-Guy SDK Documentation  13.7.1
diguySignal Class Reference

#include <diguySignal.h>

Public Member Functions

General Functions

All functions in this section are callable from:

  • C++
  • Script
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:

  • C++
  • Script
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.

bdiScenarioSignalm_signal
 A pointer to internal data. More...
 
class bdiScenarioSignal
 
bdiScenarioSignalget_scripted_object ()
 
 diguySignal (bdiScenarioSignal *signal)
 A private constructor. More...
 

Detailed Description

A signal from the User interface that can be used to trigger logic.

Member Enumeration Documentation

anonymous enum

This is an enumeration of the different callbacks that can be registered with add_callback() and add_callback_script().

Usable From:

  • C++
  • Script
Enumerator
CALLBACK_ID_PRE_TRIGGER 
CALLBACK_ID_POST_TRIGGER 

Constructor & Destructor Documentation

diguySignal::diguySignal ( bdiScenarioSignal signal)
private

A private constructor.

Member Function Documentation

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:

  • C++
  • Script
  • Decision Bead
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:

  • C++
  • Script
  • Decision Bead
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:

  • C++
  • Script
  • Decision Bead
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:

  • C++
  • Script
  • Decision Bead
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.

Parameters
info_texttext 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.

Parameters
callbackpointer to function with prototype diguySignalCallback (typedefed above)
callback_idinteger id of when this callback is to be called
callback_paramsnot currently used; pass NULL
callback_user_datapointer 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:

  • C++
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.

Parameters
callback_idinteger id of when this callback is to be called
callbackpointer to function with prototype diguySignalCallback (typedefed above)

Returns:

0 on success, -1 on failure

Callable From:

  • C++
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.

Parameters
callback_idinteger id of when this callback is to be called
callback_user_datapointer for user's own use

Returns:

0 on success, -1 on failure

Callable From:

  • C++
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.

Parameters
callback_idinteger id of the callback
callback_scriptscript text of callback to be added
callback_script_typethe 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:

  • C++
  • Script
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.

Parameters
callback_idinteger id of the callback
callback_scriptscript text of callback previously added
callback_script_typethe 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:

  • C++
  • Script
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:

Parameters
callback_idinteger id of callback
handler_namename 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.

Parameters
callback_idinteger id of callback
handler_namename of the event handler to map
unmap_all_matchespass 0 to unmap only the first match, pass 1 to unmap all matches

Returns:

0 on success, -1 on failure

bdiScenarioSignal* diguySignal::get_scripted_object ( )
inline

Friends And Related Function Documentation

friend class bdiScenarioSignal
friend

Member Data Documentation

bdiScenarioSignal* diguySignal::m_signal
private

A pointer to internal data.


The documentation for this class was generated from the following file: