TorqueScript Reference

- Main Page
- Related Pages
- Modules
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | List of all members
BehaviorTemplate Class Reference

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
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)
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]*)
Boolean | save (fileName, [selectedOnly]?)
void | addFieldFilter (fieldName)
void | removeFieldFilter (fieldName)

## Member Function Documentation

Boolean addBehaviorField | ( | fieldName | ,
|  | desc | ,
|  | type |
| ) |  |

Adds a named BehaviorField to a Behavior Template

Parameters

  fieldName | The name of this field
  desc | The Description of this field
  type | The DataType for this field (default, int, float, Point2F, bool, enum, Object, keybind, color)
  defaultValue | The Default value for this field
  userData | An 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.

Boolean addBehaviorInput | ( | inputName | ,
|  | label | ,
|  | description |
| ) |  |

Adds a behavior input.

Parameters

  inputName | The input name to use.
  label | The short label name to show in the editor.
  description | The long description to show in the editor.

Returns
  Whether the input was added or not.

Boolean addBehaviorOutput | ( | outputName | ,
|  | label | ,
|  | description |
| ) |  |

Adds a behavior output.

Parameters

  outputName | The output name to use.
  label | The short label name to show in the editor.
  description | The long description to show in the editor.

Returns
  Whether the output was added or not.

Integer createInstance | ( |  | ) |

Create an instance of this behavior.

Returns
  (BehaviorInstance inst) The behavior instance created

String getBehaviorField | ( | int | fieldIndex | ) |

Gets a tab-delimited description of the behavior field.

Parameters

  fieldIndex | The 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.

Integer getBehaviorFieldCount | ( |  | ) |

Get the number of behavior fields.

Returns
  Returns the number of behavior fields.

String getBehaviorFieldDescription | ( | int | fieldIndex | ) |

Gets the description of the field.

Parameters

  fieldIndex | The index of the behavior field.

Returns
  Returns the field description.

String getBehaviorFieldUserData | ( | int | fieldIndex | ) |

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

Parameters

  fieldIndex | The index of the behavior field.

Returns
  Returns a string representing the user data of this field

String getBehaviorInput | ( | int | inputIndex | ) |

Gets a comma-delimited description of the behavior input.

Parameters

  inputIndex | The 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.

Integer getBehaviorInputCount | ( |  | ) |

Get the number of behavior inputs.

Returns
  Returns the number of behavior inputs.

String getBehaviorOutput | ( | int | outputIndex | ) |

Gets a comma-delimited description of the behavior output.

Parameters

  outputIndex | The 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.

Integer getBehaviorOutputCount | ( |  | ) |

Get the number of behavior outputs.

Returns
  Returns the number of behavior outputs.

Boolean hasBehaviorInput | ( | inputName |  | ) |

Gets whether the behavior has the behavior input or not.

Parameters

  inputName | The input name to check.

Returns
  Whether the behavior has the behavior input or not.

Boolean hasBehaviorOutput | ( | outputName |  | ) |

Gets whether the behavior has the behavior output or not.

Parameters

  outputName | The output name to check.

Returns
  Whether the behavior has the behavior output or not.