InternalName overview ?
by Orion Elenzil · in Torque Game Engine · 05/01/2007 (10:06 am) · 2 replies
Hey all - can someone give me a brief overview of what the "internalName" field of SimBase ?
i see this in the code but i'm still a bit blank:
tia,
ooo
i see this in the code but i'm still a bit blank:
//----------------------------------------------------------------------------- // Set the internal name, can be used to find child objects // in a meaningful way, usually from script, while keeping // common script functionality together using the controls "Name" field. //-----------------------------------------------------------------------------
tia,
ooo
About the author
#2
ooooh,
the key is that findObjectByInternalName() only searches children of the SimGroup.
.. as opposed to the normal object name which is global.
thanks.
05/01/2007 (4:50 pm)
Hey Bank, thanks.ooooh,
the key is that findObjectByInternalName() only searches children of the SimGroup.
.. as opposed to the normal object name which is global.
thanks.
Associate Fyodor -bank- Osokin
Dedicated Logic
.findObjectByInternalName( string InternalName ) -> handle
Returns the handle to the object in the SimGroup with the given internal name (set by SimObject::setInternalName()).
Usage
First, we create some objects that we will add to the SimGroup:
==>$f0 = new SimObject() { internalName = "Apple" ; } ; ==>$f1 = new SimObject() { internalName = "Pear" ; } ; ==>$f2 = new SimObject() { internalName = "Orange" ; } ; ==>$f3 = new SimObject() { internalName = "Fig" ; } ; ==>$f4 = new SimObject() { internalName = "Persimmon" ; } ;With that preliminary done, we can now create the SimGroup and add the objects.The only method this class introduces is exercised here. Note that the return value of findObjectByInternalName() is the handle to the object. We can recover the internal name from the handle to convince ourselves that the function executed as we expected.
Here is a different way to utilize the new method.
Quite good explanation. I found it useful while working with some complicated GUI's.