Question about the Script command "Parent::" Please help !
by Vince Gee · in Torque 3D Professional · 02/06/2012 (9:20 am) · 2 replies
Ok,
I'm talking about the torquescript command Parent::function()
But I need to be able to do it from the c++.
So I have a sim Object handle, I want to call a function in the parents namespace.
I would really appreciate it if someone could post some code on how to do this, I've been screwing around with it for a while with no luck for days.
Vince
I'm talking about the torquescript command Parent::function()
But I need to be able to do it from the c++.
So I have a sim Object handle, I want to call a function in the parents namespace.
I would really appreciate it if someone could post some code on how to do this, I've been screwing around with it for a while with no luck for days.
Vince
About the author
www.winterleafentertainment.com
Torque Owner Demolishun
DemolishunConsulting Rocks!
// use whatever function you want or string representation char * fname = "func"; // make sure it has a parent if(object->parent){ // make sure the function exists as there is no error returned I think if(object->parent->isMethod(fname)){ // call the function // where: char* argv[] = {"func", "", "2"}; // first two args are required, last one is the first arg. // You can find this documented on line 574 of console.h char* argv[] = {fname, "", "2"}; char *ret = Con::execute(object->parent, len(argv), argv); } }That should do it!