Contains all classes that define commands that can be executed from within AI scripts.

Package Specification

The dds.control.simulation.ai package contains all classes that define commands that can be executed from within AI scripts. There should NOT be any classes within this package that cannot be executed as a command from a script. This is because this entire package gets loaded as a set of commands into each AIScript, and we don't want to run into bizzare problems caused by superfluous classes.

Command Specification

You can also implement BeanShell commands as compiled classes instead of scripts if you wish. Your class name must simply be the name of the command (matching case as well) and it must implement one or more static invoke() methods who's signatures match a pattern. The first two arguments of the invoke() method must be the bsh.Interpreter and bsh.CallStack objects that provide context to all BeanShell scripts. Then any number (possibly zero) of arguments, which are the arguments of the command may follow. BeanShell will select the appropriate method based on the usual rules for methods selection. To write a comand that has a return value simply change the return type of the invoke method that you're writing.

Example Zero Arguments:

public static void invoke( Interpreter env, CallStack callstack ) {
    ...
}

Example Two Arguments (String, float):

public static void invoke( Interpreter env, CallStack callstack, String str, 
        float number ) {
    ...
}

NOTE: When getting a result of a script-defined function from a compiled class you must store the result in a script variable and then get the value of that variable. It is good convention to use the $_ variable. See the following example:

eval("$_ = isTriggered();");
final Object result = get("$_");