Game Development Community

is it possible to have a command like this %this.setTransform(talking$numberOfTalking.getTransform());

by BryceSquared · in Torque 3D Professional · 10/13/2009 (3:13 am) · 5 replies

I want to name objects in the scene and then make the game add them to a marker in game named like this talking1, talking2, etc and i can only think of this code for doing something like that:
%this.setTransform(talking$numberOfTalking.getTransform());

I was thinking of using cases but want it to be more dynamic than that.

#1
10/13/2009 (3:26 am)
Kinda:
// Fetch Object Name.
%talkingObject = "talking" @ $numberOfTalking;
// Set Transform.
%this.setTransform( %talkingObject.getTransform() );

// Short Hand, not 100% sure this works.
%this.setTransform( ( "talking" @ $numberOfTalking ).getTransform() );
In the above example when $numberOfTalking has a value of "2", %talkingObject will be equal to "talking2", then you can just reference the object as normal.

Remember that TS is string based - even objects are referenced from strings!
#2
10/13/2009 (3:28 am)
hmm interesting, I'll give that a try.

Thanks Phillip.
#3
10/13/2009 (3:31 am)
It's no good, i tried
%node = "talking" @ $numberOfTalking;
and I get a parse error.
#4
10/13/2009 (4:35 am)
This is not normal : this line seems to have a correct syntax.

if the error happened on this line, then the syntax error is generally located in the lines above.

Nicolas Buquet
www.buquet-net.com/cv/
#5
10/13/2009 (4:43 am)
Oops my mistake :P forgot the semi colon