DI-Guy Lua AI SDK
 All Classes Files Functions Variables Groups Pages
luaScheduleEvents Class Reference

Public Member Functions

Standard infrastructure
 init_package ()
 Standard per-package init function, called at time 0 ADAM CHECK: all functions in this package. More...
 
 reset_package ()
 Standard per-package reset function. More...
 
 update_package ()
 Standard per-package update function. More...
 
Messages and minds
 send_message (lua_character, message, fraction, params)
 Sends a message to given character. More...
 
 queue_message (lua_character, message, fraction, delay, params)
 Queues a message that will go to send_message() at a future time. More...
 
 get_lua_minds (group_name, lua_class_name)
 looks up lua_characters having the given lua package name in the given diguyCharacterGroup More...
 

Schedule event helper functions

 get_schedule_event_actions (package_name)
 Get all the schedule event actions that are provided by the named package, if any exist. More...
 
 get_schedule_event_roles (package_name, action_name)
 Get all the schedule event roles that are provided by the named package, if any exist. More...
 
 get_schedule_event_args (package_name, action_name, role_name, arg_num)
 Get all the argument options that are in the named package, for a particular action, role, and argument number, if any exist. More...
 
 get_schedule_event_param_desc (package_name, action_name, role_name, arg_num)
 Get information about a particular schedule event argument. More...
 
 add_location_table (the_table, action_name, action_func, role_list, location_list)
 A helper function for populating a schedule event table entry that issues a location-related command. More...
 
static do_schedule_action (lua_class_name, group, message_string, location, percent, time_window, params)
 Executes the action for a schedule event. More...
 

Internal infrastructure

 test_schedule_event_roles (entry, desired_role_name)
 Verify that a schedule event table handles the desired role. More...
 
 trigger_event (package_name, action_name, role_and_group_name, params)
 Launch a schedule event once it has been triggered. More...
 
static build_event_table (the_package)
 Creates the schedule event table and attaches it to package. More...
 
static add_package_signals_to_table (the_package)
 Extracts schedule-able signals from package and adds them to event table. More...
 
static handle_signal (the_package, action_name, role, group, real_action_name, percent, time_window)
 Does an action based on a schedule-able signal. More...
 

Member Function Documentation

luaScheduleEvents::add_location_table ( the_table  ,
action_name  ,
action_func  ,
role_list  ,
location_list   
)

A helper function for populating a schedule event table entry that issues a location-related command.

Parameters
the_tableschedule event table from character package
action_namethe action
action_functhe function to be run when event is triggered
role_lista table containing string values
location_lista table containing location values
static luaScheduleEvents::add_package_signals_to_table ( the_package  )
static

Extracts schedule-able signals from package and adds them to event table.

Uses luaMyPackage:get_schedule_signals(), if specified

The results resemble the event table found in luaSimpleSoldier. The signals are packaged in this form as well.

Part of internal schedule editor workings

Parameters
the_packagename of package
static luaScheduleEvents::build_event_table ( the_package  )
static

Creates the schedule event table and attaches it to package.

Uses the table returned by luaMyPackage:export_schedule_events() and luaMyPackage:get_schedule_signals()

The results resemble the event table found in luaSimpleSoldier. The signals are packaged in this form as well.

Part of internal schedule editor workings

Parameters
the_packagename of package
Returns
event table
static luaScheduleEvents::do_schedule_action ( lua_class_name  ,
group  ,
message_string  ,
location  ,
percent  ,
time_window  ,
params   
)
static

Executes the action for a schedule event.

Meant to be called by schedule event handler function specified in luaYourCharacterPackage. See comments of get_schedule_event_actions() for explanation of event table

Parameters
lua_class_namename of luaYourCharacterPackage
groupname of character group
message_stringa message that process_message() in luaYourCharacterPackage
knowshow to handle
locationa location string that process_message() knows how to handle
percentthe percent of characters in the class/group that will
executethe action
time_windowthe number of seconds over which characters will receive the message
paramsa string containing comma-separated parameters (OPTIONAL)
Returns
true or false
luaScheduleEvents::get_lua_minds ( group_name  ,
lua_class_name   
)

looks up lua_characters having the given lua package name in the given diguyCharacterGroup

update_package() processes the message queue.

Parameters
group_namename of character group
lua_class_namename of Lua class
Returns
table of lua characters
luaScheduleEvents::get_schedule_event_actions ( package_name  )

Get all the schedule event actions that are provided by the named package, if any exist.

Requires that the package provide an export_shedule_events() function

Example of event table entry in a package:

{
action_name = "Sample Action",
func = luaMyPackage.do_sample_event,
role = { "Pedestrians" },
arg_func = luaMyPackage.fill_sample_event_args,
arg1_name = "locations",
arg1_desc = "locations",
arg2_name = "percentage",
arg2_desc = "Percentage",
arg2_default = "100",
arg3_name = "time_window",
arg3_desc = "Time Window",
arg3_default = "1",
},
Parameters
package_name
Returns
string containing comma-separated list of actions
luaScheduleEvents::get_schedule_event_args ( package_name  ,
action_name  ,
role_name  ,
arg_num   
)

Get all the argument options that are in the named package, for a particular action, role, and argument number, if any exist.

See comments of get_schedule_event_actions() for explanation of event table

Parameters
package_name
action_name
role_name
arg_numcurrently between 1 and 3 (may change)
Returns
string containing comma-separated list of choices for given argument number
luaScheduleEvents::get_schedule_event_param_desc ( package_name  ,
action_name  ,
role_name  ,
arg_num   
)

Get information about a particular schedule event argument.

See comments of get_schedule_event_actions() for explanation of event table

Parameters
package_name
action_name
role_name
arg_numcurrently between 1 and 3 (may change)
Returns
string containing comma-separated list of: argument's name, user-readable name, default choice
luaScheduleEvents::get_schedule_event_roles ( package_name  ,
action_name   
)

Get all the schedule event roles that are provided by the named package, if any exist.

See comments of get_schedule_event_actions() for explanation of event table

Parameters
package_name
action_name
Returns
string containing comma-separated list of roles
static luaScheduleEvents::handle_signal ( the_package  ,
action_name  ,
role  ,
group  ,
real_action_name  ,
percent  ,
time_window   
)
static

Does an action based on a schedule-able signal.

Part of internal schedule editor workings

Parameters
the_packagename of package
action_nameought to be "Trigger Signal"
rolethe name of the Lua class
groupought to be "all"
real_action_nameequivalent to the signal name
percent
time_windownumber of seconds over which actions will be launched for a character group
luaScheduleEvents::init_package ( )

Standard per-package init function, called at time 0 ADAM CHECK: all functions in this package.

luaScheduleEvents::queue_message ( lua_character  ,
message  ,
fraction  ,
delay  ,
params   
)

Queues a message that will go to send_message() at a future time.

update_package() processes the message queue.

Parameters
lua_characterthe character
messagethe message
fractionwhat fraction of the time to send the message
delayhow many seconds to delay for
paramsthe message parameters
luaScheduleEvents::reset_package ( )

Standard per-package reset function.

luaScheduleEvents::send_message ( lua_character  ,
message  ,
fraction  ,
params   
)

Sends a message to given character.

Parameters
lua_characterthe character
messagethe message
fractionwhat fraction of the time to send the message
paramsthe message parameters
luaScheduleEvents::test_schedule_event_roles ( entry  ,
desired_role_name   
)

Verify that a schedule event table handles the desired role.

Part of internal schedule editor workings

Parameters
entryentry from schedule event table
desired_role_name
Returns
true or false
luaScheduleEvents::trigger_event ( package_name  ,
action_name  ,
role_and_group_name  ,
params   
)

Launch a schedule event once it has been triggered.

This fires off the handler function that has been specified in the package's schedule event table.

Part of internal schedule editor workings

Parameters
package_name
action_name
role_and_group_namestring containing comma-separated pair
paramsstring containing the three chosen arguments, comma-separated
luaScheduleEvents::update_package ( )

Standard per-package update function.

Makes sure that any queued schedule event messages that have come due are sent.


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