Game Development Community

Con:executef

by gamer · in Torque Game Engine · 04/12/2006 (5:25 pm) · 3 replies

When calling a torque script function from c++ I use
Con::executef(this, 2,"myfunc",Con::getIntArg(myIntVar));
to convert an int variable and pass it to myfunc, I use Con::getIntArg(). But I can't find a function that converts nonprimitive datatypes, such as a Point3F.
any idea?
thanks

#1
04/12/2006 (5:37 pm)
You could do

Con::executef(this, 4,"myfunc", Con::getFloatArg(myPoint3F.x), Con::getFloatArg(myPoint3F.y), Con::getFloatArg(myPoint3F.z))
#2
04/12/2006 (5:40 pm)
Or if you want it as a space seperated string

char* pBuffer = Con::getReturnBuffer(64);

dSprintf(pBuffer, 64, "%f %f %f", myPoint3F.x, myPoint3F.y, myPoint3F.z); 

Con::executef(this, 2,"myfunc", pBuffer);
#3
04/12/2006 (5:44 pm)
I see, so there's no complex type other than primitives(string,int,etc) that I can pass in to the torque script? I guess that make sense.
thanks.