|
TorqueScript Reference
|
Inherits SimObject.
Inherited by ModuleDefinition, and NameTags.
Public Member Functions | |
| void | add (obj1,[obj2]*) |
| void | bringToFront (object) |
| void | callOnChildren (string method,[string args]*) |
| void | clear () |
| void | deleteObjects () |
| int | findObjectByInternalName (string name,[bool searchChildren]?) |
| int | getCount () |
| int | getObject (index) |
| bool | isMember (object) |
| void | listObjects () |
| void | pushToBack (object) |
| void | remove (obj1,[obj2]*) |
| void | reorderChild (SimObject child1, SimObject child2) |
Public Member Functions inherited from SimObject | |
| string | call (functionName,[args]*) |
| int | clone ([bool copyDynamicFields?=false]?) |
| void | delete () |
| void | dump () |
| void | dumpClassHierarchy () |
| const char * | getClassName () |
| string | getClassNamespace () |
| string | getDynamicField (index) |
| int | getDynamicFieldCount () |
| string | getField (int index) |
| int | getFieldCount () |
| const char * | getFieldType (fieldName) |
| const char * | getFieldValue (fieldName) |
| int | getGroup () |
| int | getId () |
| string | getInternalName () |
| const char * | getName () |
| string | getProgenitorFile () |
| string | getSuperClassNamespace () |
| int | getType () |
| bool | isChildOfGroup () |
| bool | isMemberOfClass (string classname) |
| bool | isMethod (const char *methodName) |
| bool | isMethod (string method name) |
| bool | isTimerActive () |
| bool | save (fileName,[selectedOnly]?) |
| int | schedule (time, command,[arg]*) |
| void | setClassNamespace () |
| bool | setFieldValue (fieldName, value) |
| void | setInternalName (string InternalName) |
| void | setName (newName) |
| void | setProgenitorFile (file) |
| void | setSuperClassNamespace () |
| bool | startTimer (callbackFunction, float timePeriod,[repeat]?) |
| void | stopTimer () |
Additional Inherited Members | |
Static Public Member Functions inherited from SimObject | |
| static S32 QSORT_CALLBACK | compareFields (const void *a, const void *b) |
A container for a sequence of unique SimObjects. Torque2D will automatically remove references to any SimObjects as they are deleted.
A SimSet is an ordered set of references to SimObjects. As the name implies, a SimObject can appear no more than once within a particular SimSet. Attempting to add an object to a SimSet twice will not change the SimSet nor warn you. However, a SimObject can be a member of any number of SimSets and acts independently of any SimSet it is in.
A Simset merely references your SimObjects. The deletion of a SimSet does not affect the SimObjects it holds, and removing a SimObject from a SimSet does not delete the SimObject.
If a SimSet contains a SimObject and that SimObject is deleted, that SimObject will also be automatically removed from the SimSet. This is one of its most powerful features.
Note that only SimObjects can be held in SimSets. Strings, for instance, can not. But, because SimObject is the base class for almost all script classes, you can add any script class to a SimSet.
The SimSet's member objects are stored initially in the order of insertion (add()), and can be removed (remove()), retrieved (getObject()), and queried (isMember()). The SimSet can have all its members counted (getCount()), printed (listObjects()), and removed (clear()). A member can be reordered via bringToFront() and pushToBack(), or re-ordered relative to another via reorderChild().
Creating and Adding
We create the SimSet, then create objects to put in it, then we add them all in.
Uniqueness
Continuing the above example, each member of the SimSet appears exactly once: the SimSet is a mathematically proper set.
Re-ordering
The members of a SimSet are well ordered. Let us move a different object to the front.
Now we move a different member to the back.
Finally, we move the Fig member to precede Pear. Note that all of the other members retain their relative order.
Removing
| void add | ( | obj1 | , |
| [obj2] * | |||
| ) |
| void bringToFront | ( | object | ) |
| void callOnChildren | ( | string | method, |
| [string args] * | |||
| ) |
Call a method on all objects contained in the set.
| method | The name of the method to call. |
| args | The arguments to the method. |
| void clear | ( | ) |
Clears the Simset This does not delete the cleared SimObjects.
| void deleteObjects | ( | ) |
Deletes all the objects in the SimSet.
| int findObjectByInternalName | ( | string | name, |
| [bool searchChildren] ? | |||
| ) |
Returns the object with given internal name
| name | The internal name of the object you wish to find |
| searchChildren | Set this true if you wish to search all children as well. |
| int getCount | ( | ) |
| int getObject | ( | index | ) |
| bool isMember | ( | object | ) |
| void listObjects | ( | ) |
Prints the object data within the set
| void pushToBack | ( | object | ) |
Sends item to back of set. If the SimObject is not in the set, do nothing.
| void remove | ( | obj1 | , |
| [obj2] * | |||
| ) |
1.8.3.1