
|
|
This file was automatically generated from diguyInteractionMachine.h. Do not edit this file directly; the changes will be lost.Includes: declspec_diguy.h
Contents:
diguyInteractionMachine objects give DI-Guy Scenario users a way of providing interactive, UI-driven input to a scenario that can change the way a scenario progresses.
Interaction machines in DI-Guy Scenario are good for presenting users with simple yes-or-no questions, and also "dialog tree" type conversations with characters in a scenario.
It is called a "machine" because it is implemented as a straight-forward state machine. A state machine has some number of "states" it can be in. Each state responds to some number of inputs, which can advance the machine to a new state or end the interaction.
Graphically, interaction machines are represented as dialog boxes in DI-Guy Scenario. There are three areas to the dialog: the top, called the header, which provides a one-line title for the machine; the middle, which shows informational text of the current state; and the bottom, which presents the user with options they can click to proceed to a new state.
Example:
As an example, suppose that there is an interaction machine called "converse_with_victim". It has four states:
- "begin_conversation"
- "asked_about_injury"
- "goodbye"
- "angry_goodbye"
This example doesn't describe all info and inputs that this machine needs, but does give an example of some of them.
When the interaction starts the machine is in the state "begin_conversation". The user is presented with a dialog that has the header "Talking with victim". The info portion of the dialog is set to: "An accident victim is standing in front of you, looking disoriented." The inputs presented are:
If the user selects input 1, the machine proceeds to the state "asked_about_injury", where new info is presented telling the user about any injuries the victim may have, and new inputs that present further questions the user can ask of the victim or actions the user can take. (Note that not all inputs need to be conversation or questions; inputs can also describe actions that the user may take.)
If the user selects input 2, the machine proceeds to the state "angry_goodbye", where new info tells that user that the victim is angry at being ignored. There is one input, "Ok", that ends the interaction and closes the interaction machine.
class diguyInteractionMachine
|
class BDI_DECLSPEC_diguy diguyInteractionMachine { public: const char* get_name(); int begin_interaction(const char* initial_state = NULL, const char* initial_input = NULL); int end_interaction(); int get_interaction_is_active(); void set_pause_scenario_while_active(int pause_while_active); int get_pause_scenario_while_active(); void reinitialize(); void reset(); void set_interaction_subject(diguyCharacter* interaction_subject); diguyCharacter* get_interaction_subject(); int update_ui(); enum { UI_APPEARANCE_CONVERSATION = 0, UI_APPEARANCE_INFO, UI_APPEARANCE_NOTIFICATION, UI_APPEARANCE_3, UI_APPEARANCE_4, UI_APPEARANCE_COUNT }; int set_initial_ui_appearance(int initial_ui_appearance); int get_initial_ui_appearance(); int set_ui_appearance(int ui_appearance); int get_ui_appearance(); void set_initial_heading(const char* initial_heading); const char* get_initial_heading(); void set_heading(const char* heading); const char* get_heading(); void set_heading_visible(int heading_visible); int get_heading_visible(); void set_heading_color_bg(int ui_appearance, float r, float g, float b, float a = 1.0f); void set_heading_color_fg(int ui_appearance, float r, float g, float b, float a = 1.0f); void set_heading_font(int ui_appearance, const char* font_family, int font_point_size, int font_is_bold = 0, int font_is_italic = 0); void set_initial_info(const char* initial_info); const char* get_initial_info(); void set_info(const char* info); const char* get_info(); void set_info_visible(int info_visible); int get_info_visible(); void set_info_color_bg(int ui_appearance, float r, float g, float b, float a = 1.0f); void set_info_color_fg(int ui_appearance, float r, float g, float b, float a = 1.0f); void set_info_font(int ui_appearance, const char* font_family, int font_point_size, int font_is_bold = 0, int font_is_italic = 0); int get_num_states(); const char* get_state_id_at_index(int index); void clear_states(); int add_state(const char* state_id, const char* entry_script); int remove_state(const char* state_id); int rename_state(const char* old_state_id, const char* new_state_id); int set_state_entry_script(const char* state_id, const char* entry_script); int set_begin_state_entry_script(const char* entry_script); const char* get_current_state(); void set_current_state(const char* new_current_state, int run_entry_script = 1); void clear_inputs(); int add_input(const char* input_id, const char* input_string, const char* resulting_state = "", int int_param_0 = 0); int remove_input(const char* input_id); int get_num_inputs(); const char* get_input_id(int index); const char* get_input_string(const char* input_id); const char* get_input_resulting_state(const char* input_id); int get_input_int_param_0(const char* input_id); int select_input(const char* input_id); const char* get_last_selected_input(); void set_last_input_variable(const char* last_input_variable); const char* get_last_input_variable(); void set_inputs_visible(int visible); int get_inputs_visible(); void set_input_shortcuts_visible(int visible); int get_input_shortcuts_visible(); void set_inputs_font(int ui_appearance, const char* font_family, int font_point_size, int font_is_bold = 0, int font_is_italic = 0); void set_inputs_color_bg(int ui_appearance, float r, float g, float b, float a = 1.0f); void set_inputs_color_fg(int ui_appearance, float r, float g, float b, float a = 1.0f); int set_current_settings_index(int current_settings_index); void set_input_response_script(const char* script);
| General Functions |
function diguyInteractionMachine::get_name |
Prototype:
Description:const char* get_name();
Returns the name of the object. This pointer will never be NULL.Returns:
name of the objectCallable From:
- C++
- Script
function diguyInteractionMachine::begin_interaction |
Prototype:
Description:int begin_interaction(const char* initial_state = NULL, const char* initial_input = NULL);
This function begins the interaction.
The interaction UI will appear in DI-Guy Scenario.
The interaction can be ended by calling end_interaction(), or by the current state being changed to "end" through an input selection or a call to set_current_state().Arguments:
initial_state initial state that interaction will be in initial_input initial input that will be returned by get_last_selected_input() in the first state By default, initial state will be "begin". By default, initial input will be "begin".Returns:
0 on success, -1 on failureCallable From:
- C++
- Script
function diguyInteractionMachine::end_interaction |
Prototype:
Description:int end_interaction();
This function ends the interaction.
The interaction UI will be hidden in DI-Guy Scenario.
Note that this call does not run the entry script of the "end" state. Call set_current_state("end") to end the interaction and run the entry script of the "end" state when doing so.Returns:
0 on success, -1 on failureCallable From:
- C++
- Script
function diguyInteractionMachine::get_interaction_is_active |
Prototype:
Returns:int get_interaction_is_active();
1 if interaction is active and visible, 0 if notCallable From:
- C++
- Script
function diguyInteractionMachine::set_pause_scenario_while_active |
Prototype:
Description:void set_pause_scenario_while_active(int pause_while_active);
This function sets whether the scenario is paused while the interaction is active.
If the scenario is to be paused, the current playback mode will be saved when the interaction begins, the playback mode will be changed to DIGUY_SCENARIO_PLAYBACK_MODE_STOP, and the original playback mode will be restored when the interaction ends.
If the scenario is not to be paused, beginning and ending the interaction will have no effect on the playback mode.
The default is to not pause the scenario.Arguments:
Callable From:
pause_while_active pass 1 to pause scenario when interaction is active, 0 to not change playback mode
- C++
- Script
function diguyInteractionMachine::get_pause_scenario_while_active |
Prototype:
Returns:int get_pause_scenario_while_active();
1 if playback mode will be paused, 0 if notCallable From:
- C++
- Script
function diguyInteractionMachine::reinitialize |
Prototype:
Description:void reinitialize();
This function resets the interaction to a clean state. It will:
Callable From:
- set the initial heading to ""
- set the initial info text to ""
- remove all inputs
- reset ui appearances
- set all other parameters to default values It will also do an implicit reset() call.
- C++
- Script
function diguyInteractionMachine::reset |
Prototype:
Description:void reset();
This function resets the interaction to a reset state. It will:
Callable From:
- set the UI appearance text to initial_ui_appearance
- set the heading to be initial_heading
- set the info text to initial_info
- set the current state to "begin"
- C++
- Script
function diguyInteractionMachine::set_interaction_subject |
Prototype:
Description:void set_interaction_subject(diguyCharacter* interaction_subject);
This function stores a pointer to the passed character in the interaction machine. Access to the character is then possible in state scripts by calling get_interaction_subject().Arguments:
Callable From:
interaction_subject pointer to character that is to by the interaction's primary subject
- C++
- Script
function diguyInteractionMachine::get_interaction_subject |
Prototype:
Returns:diguyCharacter* get_interaction_subject();
value set by set_interaction_subject()Callable From:
- C++
- Script
| UI Functions |
function diguyInteractionMachine::update_ui |
Prototype:
Description:int update_ui();
This function updates the visible interaction UI in DI-Guy Scenario. May calls that change visible settings of the UI will not take effect until this function is called.Callable From:
- C++
- Script
enumeration |
Description:enum { UI_APPEARANCE_CONVERSATION = 0, UI_APPEARANCE_INFO, UI_APPEARANCE_NOTIFICATION, UI_APPEARANCE_3, UI_APPEARANCE_4, UI_APPEARANCE_COUNT };
This enumeration lists the indices used for various UI appearance calls. These indices should be used when calling:
and equivalent functions for info and inputs.
Each UI appearance can have different colors and font settings, potentially giving the scenario user a visual cue that the interaction is showing a conversation, showing generation information, or providing an important notification,Callable From:
- C++
- Script
function diguyInteractionMachine::set_initial_ui_appearance |
Prototype:
Description:int set_initial_ui_appearance(int initial_ui_appearance);
This function sets the UI appearance that will be used after a begin_interaction() or reset() call.
The default is UI_APPEARANCE_CONVERSATION.Arguments:
Callable From:
initial_ui_appearance initial UI appearance
- C++
- Script
function diguyInteractionMachine::get_initial_ui_appearance |
Prototype:
Returns:int get_initial_ui_appearance();
initial UI appearance as set by set_initial_ui_appearance()Callable From:
- C++
- Script
function diguyInteractionMachine::set_ui_appearance |
Prototype:
Description:int set_ui_appearance(int ui_appearance);
This function sets the current UI appearance that should be used for the interaction.
The new setting will not take effect until the next call to update_ui().
Call update_ui() for new setting to take effect.Arguments:
Callable From:
ui_appearance new current UI appearance
- C++
- Script
function diguyInteractionMachine::get_ui_appearance |
Prototype:
Returns:int get_ui_appearance();
current UI appearance; default is value returned by get_initial_ui_appearance()Callable From:
- C++
- Script
| Heading Functions |
function diguyInteractionMachine::set_initial_heading |
Prototype:
Description:void set_initial_heading(const char* initial_heading);
This function sets the heading text that will be shown after after a begin_interaction() or reset() call.
The default is "", or show nothing.Arguments:
Callable From:
initial_heading initial heading text
- C++
- Script
function diguyInteractionMachine::get_initial_heading |
Prototype:
Returns:const char* get_initial_heading();
initial heading text as set by set_initial_heading()Callable From:
- C++
- Script
function diguyInteractionMachine::set_heading |
Prototype:
Description:void set_heading(const char* heading);
This function sets the current heading text that will be shown.
Call update_ui() for new setting to take effect.Arguments:
Callable From:
heading heading text to be shown
- C++
- Script
function diguyInteractionMachine::get_heading |
Prototype:
Returns:const char* get_heading();
current heading text as set by set_heading()Callable From:
- C++
- Script
function diguyInteractionMachine::set_heading_visible |
Prototype:
Description:void set_heading_visible(int heading_visible);
This function sets whether the heading will be visible.
Call update_ui() for new setting to take effect.Arguments:
Callable From:
heading_visible 1 for visible, 0 for invisible
- C++
- Script
function diguyInteractionMachine::get_heading_visible |
Prototype:
Returns:int get_heading_visible();
whether heading is visibleCallable From:
- C++
- Script
function diguyInteractionMachine::set_heading_color_bg |
Prototype:
Description:void set_heading_color_bg(int ui_appearance, float r, float g, float b, float a = 1.0f);
This function sets the background color of the heading.
Call update_ui() for new setting to take effect.Arguments:
Callable From:
ui_appearance which UI appearance this changes r, g, b, a RGBA colors, from 0.0 to 1.0
- C++
- Script
function diguyInteractionMachine::set_heading_color_fg |
Prototype:
Description:void set_heading_color_fg(int ui_appearance, float r, float g, float b, float a = 1.0f);
This function sets the foreground/font color of the heading.
Call update_ui() for new setting to take effect.Arguments:
Callable From:
ui_appearance which UI appearance this changes r, g, b, a RGBA colors, from 0.0 to 1.0
- C++
- Script
function diguyInteractionMachine::set_heading_font |
Prototype:
Description:void set_heading_font(int ui_appearance, const char* font_family, int font_point_size, int font_is_bold = 0, int font_is_italic = 0);
This function sets the font characteristics of the heading.
Call update_ui() for new setting to take effect.Arguments:
ui_appearance which UI appearance this changes font_family font family font_point_size point size of font font_is_bold pass 1 for bold, 0 for normal font_is_italic pass 1 for italic, 0 for normal On Windows, the default font family is ""MS Shell Dlg", and the default point size is 10.Callable From:
- C++
- Script
| Info Functions |
function diguyInteractionMachine::set_initial_info |
Prototype:
Description:void set_initial_info(const char* initial_info);
Similar to set_initial_heading(), but for info instead.
Note that the info text can use simple HTML-style tags. For example:
- for a paragraph break:
- for bold text: bold
- for underlined text: bold
- for italicized text: bold
The default is "", or show nothing.
function diguyInteractionMachine::get_initial_info |
Prototype:
Description:const char* get_initial_info();
Similar to get_initial_heading(), but for info instead.
function diguyInteractionMachine::set_info |
Prototype:
Description:void set_info(const char* info);
Similar to set_heading(), but for info instead.
function diguyInteractionMachine::get_info |
Prototype:
Description:const char* get_info();
Similar to get_heading(), but for info instead.
function diguyInteractionMachine::set_info_visible |
Prototype:
Description:void set_info_visible(int info_visible);
Similar to set_heading_visible(), but for info instead.
function diguyInteractionMachine::get_info_visible |
Prototype:
Description:int get_info_visible();
Similar to get_heading_visible(), but for info instead.
function diguyInteractionMachine::set_info_color_bg |
Prototype:
Description:void set_info_color_bg(int ui_appearance, float r, float g, float b, float a = 1.0f);
Similar to get_heading_visible(), but for info instead.
function diguyInteractionMachine::set_info_color_fg |
Prototype:
Description:void set_info_color_fg(int ui_appearance, float r, float g, float b, float a = 1.0f);
Similar to set_heading_color_fg(), but for info instead.
function diguyInteractionMachine::set_info_font |
Prototype:
Description:void set_info_font(int ui_appearance, const char* font_family, int font_point_size, int font_is_bold = 0, int font_is_italic = 0);
Similar to set_heading_font(), but for info instead.
| State Functions |
States in an interaction machine represent the various states the machine can be in. The current state is typically changed by the user selecting inputs via the UI, but can also be changed by calling set_current_state().
New interaction machines always have the required "begin" and "end" states.
function diguyInteractionMachine::get_num_states |
Prototype:
Returns:int get_num_states();
number of states in the interaction machineCallable From:
- C++
- Script
function diguyInteractionMachine::get_state_id_at_index |
Prototype:
Returns:const char* get_state_id_at_index(int index);
string id of state with given index; the returned pointer will never be NULLCallable From:
- C++
- Script
function diguyInteractionMachine::clear_states |
Prototype:
Description:void clear_states();
This function removes all existing states from the interaction machine.
Default new states named "begin" and "end" are then automatically added. These default states do not have an entry script, but one can be added later with the set_state_entry_script() or set_begin_state_entry_script() functions.
More new states can be added using the add_state() function.Callable From:
- C++
- Script
function diguyInteractionMachine::add_state |
Prototype:
Description:int add_state(const char* state_id, const char* entry_script);
This function adds a new state to the interaction machine. Each state must have a unique state_id (name of the state).Arguments:
Returns:
state_id name of the new state entry_script script text that will be run every time this new state is entered
0 on success, -1 on failureCallable From:
- C++
- Script
function diguyInteractionMachine::remove_state |
Prototype:
Description:int remove_state(const char* state_id);
This function removes the specified state from the interaction machine.
The required "begin" and "end" states cannot be removed.Arguments:
Returns:
state_id name of state to remove
0 on success, -1 on failureCallable From:
- C++
- Script
function diguyInteractionMachine::rename_state |
Prototype:
Description:int rename_state(const char* old_state_id, const char* new_state_id);
This function renames the specified state. Each state must have a unique state_id (name of the state).
The required "begin" and "end" states cannot be renamed.Arguments:
Returns:
old_state_id name of state to rename new_state_id new name of state
0 on success, -1 on failureCallable From:
- C++
- Script
function diguyInteractionMachine::set_state_entry_script |
Prototype:
Description:int set_state_entry_script(const char* state_id, const char* entry_script);
This function sets the entry script of this state. Each time the specified state is entered, the entry script will be run.Arguments:
Returns:
state_id name of state to modify entry_script new entry script
0 on success, -1 on failureCallable From:
- C++
- Script
function diguyInteractionMachine::set_begin_state_entry_script |
Prototype:
Description:int set_begin_state_entry_script(const char* entry_script);
This function sets the entry script of the required "begin" state.Arguments:
Returns:
entry_script new entry script
0 on success, -1 on failureCallable From:
- C++
- Script
function diguyInteractionMachine::get_current_state |
Prototype:
Description:const char* get_current_state();
This function returns the current state the interaction machine is in.Returns:
name of current state; the returned should never be NULLCallable From:
- C++
- Script
function diguyInteractionMachine::set_current_state |
Prototype:
Description:void set_current_state(const char* new_current_state, int run_entry_script = 1);
This function sets the current state of the interaction machine. The entry script of the new state will be run by default, but can optionally be skipped.
If the new state is "end", the interaction will end, as if the end_interaction() call is made, once the entry script of the "end" state entry script is run.Arguments:
Returns:
new_current_state new current state run_entry_script pass 1 to run the new state's entry script, 0 to not
0 on success, -1 on failureCallable From:
- C++
- Script
| Input Functions |
function diguyInteractionMachine::clear_inputs |
Prototype:
Description:void clear_inputs();
This function removes all inputs from the interaction machine. New inputs can be added by calling add_input().Callable From:
- C++
- Script
function diguyInteractionMachine::add_input |
Prototype:
Description:int add_input(const char* input_id, const char* input_string, const char* resulting_state = "", int int_param_0 = 0);
This function adds a new input to the interaction machine. Each input must have a unique input_id (name of the input).
If the resulting state is "end", the interaction will end, as if the end_interaction() call is made, once the entry script of the "end" state entry script is run.Arguments:
Returns:
input_id name of the new input input_string text that will be shown in the UI resulting_state state id of the state the interaction machine will change to if this new input is selected int_param_0 an optional integer parameter that can be interpreted in the new state's entry script
0 on success, -1 on failureCallable From:
- C++
- Script
function diguyInteractionMachine::remove_input |
Prototype:
Description:int remove_input(const char* input_id);
This function removes the specified input.Arguments:
Returns:
input_id name of input to rename
0 on success, -1 on failureCallable From:
- C++
- Script
function diguyInteractionMachine::get_num_inputs |
Prototype:
Returns:int get_num_inputs();
how many inputs there areCallable From:
- C++
- Script
function diguyInteractionMachine::get_input_id |
Prototype:
Returns:const char* get_input_id(int index);
input id of the input at the specified index; see add_input()Callable From:
- C++
- Script
function diguyInteractionMachine::get_input_string |
Prototype:
Returns:const char* get_input_string(const char* input_id);
input string of the specified input; see add_input()Callable From:
- C++
- Script
function diguyInteractionMachine::get_input_resulting_state |
Prototype:
Returns:const char* get_input_resulting_state(const char* input_id);
resulting state of the specified input; see add_input()Callable From:
- C++
- Script
function diguyInteractionMachine::get_input_int_param_0 |
Prototype:
Returns:int get_input_int_param_0(const char* input_id);
integer parameter 0 of the specified input; see add_input()Callable From:
- C++
- Script
function diguyInteractionMachine::select_input |
Prototype:
Description:int select_input(const char* input_id);
This function "manually" selects the specified input. Most of the time inputs are selected via the UI.
A side effect of selecting an input is almost always that the interaction machine will be put into a new state.Arguments:
input_id input id of input that should be selected The passed input id must be a current available input of the interaction machine.Returns:
0 on success, -1 on failureCallable From:
- C++
- Script
function diguyInteractionMachine::get_last_selected_input |
Prototype:
Returns:const char* get_last_selected_input();
input id of the last selected input; state entry scripts can use this information to make decisions based on how the state was enteredCallable From:
- C++
- Script
function diguyInteractionMachine::set_last_input_variable |
Prototype:
Description:void set_last_input_variable(const char* last_input_variable);
This function sets the name of the scenario-level variable in which the name of the last selected input will be recorded. State entry scripts can then read determine which input caused the interaction machine to entry the state.Arguments:
Returns:
last_input_variable name of scenario-level variable
0 on success, -1 on failureCallable From:
- C++
- Script
function diguyInteractionMachine::get_last_input_variable |
Prototype:
Returns:const char* get_last_input_variable();
name of last input variable; empty string ("") if there is noneCallable From:
- C++
- Script
function diguyInteractionMachine::set_inputs_visible |
Prototype:
Description:void set_inputs_visible(int visible);
This function sets whether the inputs section of the UI will be visible. The inputs will be visible by default.Arguments:
Callable From:
visible pass 1 to make inputs visible; 0 to not
- C++
- Script
function diguyInteractionMachine::get_inputs_visible |
Prototype:
Returns:int get_inputs_visible();
whether the inputs section of the UI will be visibleCallable From:
- C++
- Script
function diguyInteractionMachine::set_input_shortcuts_visible |
Prototype:
Description:void set_input_shortcuts_visible(int visible);
This function sets whether a "shortcut" for each input will be visible in the UI, before the input text.
Currently the shortcuts are limited to numbers; the first input will be prefixed by "1.", the second by "2.", etc.
Input shortcuts are visible by default.Arguments:
Callable From:
visible pass 1 to make shortcuts visible; 0 to not
- C++
- Script
function diguyInteractionMachine::get_input_shortcuts_visible |
Prototype:
Returns:int get_input_shortcuts_visible();
whether the input shortcuts will be visible in the UICallable From:
- C++
- Script
function diguyInteractionMachine::set_inputs_font |
Prototype:
Description:void set_inputs_font(int ui_appearance, const char* font_family, int font_point_size, int font_is_bold = 0, int font_is_italic = 0);
Similar to set_heading_font(), but for inputs instead.
function diguyInteractionMachine::set_inputs_color_bg |
Prototype:
Description:void set_inputs_color_bg(int ui_appearance, float r, float g, float b, float a = 1.0f);
Similar to set_heading_color_bg(), but for inputs instead.
function diguyInteractionMachine::set_inputs_color_fg |
Prototype:
Description:void set_inputs_color_fg(int ui_appearance, float r, float g, float b, float a = 1.0f);
Similar to set_heading_color_fg(), but for inputs instead.
| Deprecated Functions |
The following functions are deprecated.
As these functions will disappear in a future version of DI-Guy.
function diguyInteractionMachine::set_current_settings_index |
Prototype:
int set_current_settings_index(int current_settings_index);
function diguyInteractionMachine::set_input_response_script |
Prototype:
void set_input_response_script(const char* script);
ALL RIGHTS RESERVED.
These coded instructions, statements, and computer programs contain unpublished proprietary information of Boston Dynamics and are protected by Copyright Laws of the United States. They may not be used, duplicated, or disclosed in any form, in whole or in part, without the prior written consent from Boston Dynamics.
RESTRICTED RIGHTS LEGEND
Use, duplication, or disclosure by the government is subject to restrictions as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights in Technical Data and Computer Sofware clause at DFARS 252.227-7013 and/or in similar or successor clauses in the FAR, or the DOD or NASA FAR Supplement, or to subparagraphs (c)(1) and (c)(2) of the Commercial Computer Software--Restricted Rights at 48 CFR 52.227-19, as applicable. Unpublished-rights reserved under the Copyright Laws of the United States.
Contractor/Manufacturer is:
Boston Dynamics/78 Fourth Avenue/Waltham MA 02451.