TorqueScript Reference
Public Member Functions | Static Public Member Functions | List of all members
SimObject Class Reference

Inherits ConsoleObject.

Inherited by ActionMap, AssetBase, AssetManager, AssetQuery, AssetTagsManifest, BehaviorInstance, BehaviorTemplate, ConsoleLogger, EventManager, FileDialog, FileObject, ModuleManager, ParticleAssetEmitter, PickingSceneController, PopupMenu, RemoteDebuggerBase, RenderProxy, SceneObjectSet, SimComponent, SimSet, SimXMLDocument, StreamObject, Taml, UndoManager, and ZipObject.

Public Member Functions

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 ()
 

Static Public Member Functions

static S32 QSORT_CALLBACK compareFields (const void *a, const void *b)
 

Member Function Documentation

string call ( functionName  ,
[args] *   
)

Dynamically call a method on an object.

int clone ( [bool copyDynamicFields? = false] ?  )

Clones the object.

Parameters
copyDynamicFieldsWhether the dynamic fields should be copied to the cloned object or not. Optional: Defaults to false.
Returns
(newObjectID) The newly cloned object's id if successful, otherwise a 0.
static S32 QSORT_CALLBACK compareFields ( const void *  a,
const void *  b 
)
static
void delete ( )

Use the delete method to delete this object. When an object is deleted, it automatically: Unregisters its ID and name (if it has one) with the engine. Removes itself from any SimGroup or SimSet it may be a member of. (eventually) returns the memory associated with itself and its non-dynamic members. Cancels all pending obj.schedule() events. For objects in the GameBase, ScriptObject, or GUIControl hierarchies, an object will first: Call the onRemove() method for the object's namespace

Returns
No return value.
void dump ( )

Use the dump method to display the following information about this object: All engine and script registered console methods (including parent methods) for this object, all Non-Dynamic Fields AND all Dynamic Fields

Returns
No return value
void dumpClassHierarchy ( )
const char* getClassName ( )
string getClassNamespace ( )
string getDynamicField ( index  )
int getDynamicFieldCount ( )
string getField ( int  index)

Gets the name of the field at the given index.

int getFieldCount ( )

Gets the number of persistent fields on the object.

const char* getFieldType ( fieldName  )
const char* getFieldValue ( fieldName  )
int getGroup ( )

Use the getGroup method to determine if this object is contained in a SimGroup and if so, which one.

Returns
Returns the ID of the SimGroup this shape is in or zero if the shape is not contained in a SimGroup
int getId ( )

Use the getId method to get the numeric ID of this shape.

Returns
Returns the unique numeric ID of this shape.
See Also
getName, setName

Referenced by nameToID().

string getInternalName ( )

returns the objects internal name

const char* getName ( )
string getProgenitorFile ( )

Gets the progenitor file responsible for this instances creation.

Returns
The progenitor file responsible for this instances creation.
string getSuperClassNamespace ( )
int getType ( )

Use the getType method to get the type for this object. This type is an integer value composed of bitmasks. For simplicity, these bitmasks are defined in the engine and exposed for our use as global variables. To simplify the writing of scripts, a set of globals has been provided containing the bit setting for each class corresponding to a particular type.

Returns
Returns a bit mask containing one or more set bits.
See Also
getClassName
bool isChildOfGroup ( )

returns true, if we are in the specified simgroup - or a subgroup thereof

bool isMemberOfClass ( string  classname)

returns true if this object is a member of the specified class

bool isMethod ( const char *  methodName)
bool isMethod ( string method  name)
bool isTimerActive ( )

Checks whether the periodic timer is active for this object or not.

Returns
Whether the periodic timer is active for this object or not.
bool save ( fileName  ,
[selectedOnly] ?   
)
int schedule ( time  ,
command  ,
[arg] *   
)

Use the schedule method to schedule an action to be executed upon this object time milliseconds in the future. The major difference between this and the schedule console function is that if this object is deleted prior to the scheduled event, the event is automatically canceled. times should not be treated as exact since some 'simulation delay' is to be expected. The minimum resolution for a scheduled event is \32 ms, or one tick. schedule does not validate the existence of command. i.e. If you pass an invalid console method name, the schedule() method will still return a schedule ID, but the subsequent event will fail silently.

Parameters
timeTime in milliseconds till action is scheduled to occur.
commandName of the command to execute. This command must be scoped to this object (i.e. It must exist in the namespace of the object), otherwise the schedule call will fail.
arg1...argNThese are optional arguments which will be passed to command. This version of schedule automatically passes the ID of obj as arg0 to command.
Returns
Returns an integer schedule ID.
See Also
See the schedule console function and its corresponding helper functions.
void setClassNamespace ( )
bool setFieldValue ( fieldName  ,
value   
)
void setInternalName ( string  InternalName)
void setName ( newName  )
void setProgenitorFile ( file  )

Sets the progenitor file responsible for this instances creation.

Parameters
fileThe progenitor file responsible for this instances creation.
Returns
No return value.
void setSuperClassNamespace ( )
bool startTimer ( callbackFunction  ,
float  timePeriod,
[repeat] ?   
)

Starts a periodic timer for this object. Sets a timer on the object that, when it expires, will cause the object to execute the onTimer() callback. The timer event will continue to occur at regular intervals until setTimerOff() is called.

Parameters
callbackFunctionThe name of the callback function to call for each timer repetition.
timePeriodThe period of time (in milliseconds) between each callback.
repeatThe number of times the timer should repeat. If not specified or zero then it will run infinitely
Returns
No return Value.
void stopTimer ( )

Stops the periodic timer for this object.

Returns
No return Value.