TorqueScript Reference
Public Member Functions | List of all members
BehaviorTemplate Class Reference

#include <behaviorTemplate_ScriptBinding.h>

Inherits SimObject.

Public Member Functions

Boolean addBehaviorField (fieldName, desc, type, [defaultValue, userData])
 
Boolean addBehaviorInput (inputName, label, description)
 
Boolean addBehaviorOutput (outputName, label, description)
 
Integer createInstance ()
 
String getBehaviorField (int fieldIndex)
 
Integer getBehaviorFieldCount ()
 
String getBehaviorFieldDescription (int fieldIndex)
 
String getBehaviorFieldUserData (int fieldIndex)
 
String getBehaviorInput (int inputIndex)
 
Integer getBehaviorInputCount ()
 
String getBehaviorOutput (int outputIndex)
 
Integer getBehaviorOutputCount ()
 
Boolean hasBehaviorInput (inputName)
 
Boolean hasBehaviorOutput (outputName)
 
- Public Member Functions inherited from SimObject
void assignFieldsFrom (SimObject)
 
Integer clone ([copyDynamicFields=false]?)
 
void delete ()
 
Integer getId ()
 
void setName (newName)
 
String getName ()
 
String getClassNamespace ()
 
String getSuperClassNamespace ()
 
void setClassNamespace (nameSpace)
 
void setSuperClassNamespace ()
 
Boolean isMethod (string methodName)
 
String call (methodName, [args] *)
 
void dumpClassHierarchy ()
 
void dump ()
 
Boolean isMemberOfClass (string classname)
 
String getClassName ()
 
String getFieldValue (fieldName)
 
Boolean setFieldValue (fieldName, value)
 
Boolean setEditFieldValue (fieldName, value)
 
Integer getDynamicFieldCount ()
 
String getDynamicField (index)
 
Integer getFieldCount ()
 
String getField (int index)
 
void setProgenitorFile (file)
 
String getProgenitorFile ()
 
Integer getType ()
 
String getFieldType (fieldName)
 
void setInternalName (string InternalName)
 
String getInternalName ()
 
Boolean isChildOfGroup (groupID)
 
Integer getGroup ()
 
Boolean startTimer (callbackFunction, float timePeriod, [repeat]?)
 
void stopTimer ()
 
Boolean isTimerActive ()
 
Integer schedule (time, command, [arg] *)
 
void startListening (SimObject)
 
void stopListening (SimObject)
 
void addListener (SimObject)
 
void removeListener (SimObject)
 
void removeAllListeners ()
 
void postEvent (String eventName, String data)
 
Boolean save (fileName, [selectedOnly]?)
 
void addFieldFilter (fieldName)
 
void removeFieldFilter (fieldName)
 

Member Function Documentation

◆ addBehaviorField()

Boolean addBehaviorField ( fieldName  ,
desc  ,
type   
)

Adds a named BehaviorField to a Behavior Template

Parameters
fieldNameThe name of this field
descThe Description of this field
typeThe DataType for this field (default, int, float, Point2F, bool, enum, Object, keybind, color)
defaultValueThe Default value for this field
userDataAn extra data field that can be used for custom data on a per-field basis
Usage for default types
-enum: a TAB separated list of possible values
-object: the scene-object type that are valid choices for the field. The object types observe inheritance, so if you have a SceneObject field you will be able to choose t2dStaticSrpites, t2dAnimatedSprites, etc.
Returns
Whether the field was added or not.

◆ addBehaviorInput()

Boolean addBehaviorInput ( inputName  ,
label  ,
description   
)

Adds a behavior input.

Parameters
inputNameThe input name to use.
labelThe short label name to show in the editor.
descriptionThe long description to show in the editor.
Returns
Whether the input was added or not.

◆ addBehaviorOutput()

Boolean addBehaviorOutput ( outputName  ,
label  ,
description   
)

Adds a behavior output.

Parameters
outputNameThe output name to use.
labelThe short label name to show in the editor.
descriptionThe long description to show in the editor.
Returns
Whether the output was added or not.

◆ createInstance()

Integer createInstance ( )

Create an instance of this behavior.

Returns
(BehaviorInstance inst) The behavior instance created

◆ getBehaviorField()

String getBehaviorField ( int  fieldIndex)

Gets a tab-delimited description of the behavior field.

Parameters
fieldIndexThe index of the behavior field.
Returns
A tab-delimited description of the behavior field of the format <Name><Type><DefaultValue> or an empty string if behavior field is not found.

◆ getBehaviorFieldCount()

Integer getBehaviorFieldCount ( )

Get the number of behavior fields.

Returns
Returns the number of behavior fields.

◆ getBehaviorFieldDescription()

String getBehaviorFieldDescription ( int  fieldIndex)

Gets the description of the field.

Parameters
fieldIndexThe index of the behavior field.
Returns
Returns the field description.

◆ getBehaviorFieldUserData()

String getBehaviorFieldUserData ( int  fieldIndex)

Gets the UserData associated with a field by index in the field list

Parameters
fieldIndexThe index of the behavior field.
Returns
Returns a string representing the user data of this field

◆ getBehaviorInput()

String getBehaviorInput ( int  inputIndex)

Gets a comma-delimited description of the behavior input.

Parameters
inputIndexThe index of the behavior input.
Returns
A comma-delimited description of the behavior input of the format <Name>,<Label><,Description> or an empty string if behavior input is not found.

◆ getBehaviorInputCount()

Integer getBehaviorInputCount ( )

Get the number of behavior inputs.

Returns
Returns the number of behavior inputs.

◆ getBehaviorOutput()

String getBehaviorOutput ( int  outputIndex)

Gets a comma-delimited description of the behavior output.

Parameters
outputIndexThe index of the behavior output.
Returns
A comma-delimited description of the behavior output of the format <Name>,<Label><,Description> or an empty string if behavior output is not found.

◆ getBehaviorOutputCount()

Integer getBehaviorOutputCount ( )

Get the number of behavior outputs.

Returns
Returns the number of behavior outputs.

◆ hasBehaviorInput()

Boolean hasBehaviorInput ( inputName  )

Gets whether the behavior has the behavior input or not.

Parameters
inputNameThe input name to check.
Returns
Whether the behavior has the behavior input or not.

◆ hasBehaviorOutput()

Boolean hasBehaviorOutput ( outputName  )

Gets whether the behavior has the behavior output or not.

Parameters
outputNameThe output name to check.
Returns
Whether the behavior has the behavior output or not.