Communicate between engine code and script
by Nocera Luciano · in Torque Game Engine · 03/20/2006 (1:38 am) · 2 replies
I add a new class into the engine code which includes consoleMethods. I call those consoleMethods from script to start a new thread to calculate some data, and then return those data back to script function in certain times.
I am wondering if is there a way to transfer the data to script from the engine thread, or a way to call a script function from engine thread?
I am wondering if is there a way to transfer the data to script from the engine thread, or a way to call a script function from engine thread?
#2
function ActionScript::inScriptAddPeerPlayer(%this, %var){
echo("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
aiAddPlayer(%var);
}
// ******* Declare P2P Handle **********
$pphandle = new pphandle();
$pphandle.callOther();
In the engine code, I have a callOther() function in class PPHandle that create another object named "actionScript" of class ActionScript, which is also inherited from SimObject. I execute this in one of actionScript's function callBack():
Con::executef(this,2, "inScriptAddPeerPlayer", "tester");
So the sequence is:
1) create $pphandle in script
2) $pphandle.callOther();
3) Create Object in class pphandle: ActionScript actionScript = new ActionScript();
3) actionScript.callBack();
There comes an error:
Con::execute - 0 has no namespace
Any suggest what is going on there?
03/23/2006 (4:48 pm)
Sorry for another newbie problem. This is my script:function ActionScript::inScriptAddPeerPlayer(%this, %var){
echo("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
aiAddPlayer(%var);
}
// ******* Declare P2P Handle **********
$pphandle = new pphandle();
$pphandle.callOther();
In the engine code, I have a callOther() function in class PPHandle that create another object named "actionScript" of class ActionScript, which is also inherited from SimObject. I execute this in one of actionScript's function callBack():
Con::executef(this,2, "inScriptAddPeerPlayer", "tester");
So the sequence is:
1) create $pphandle in script
2) $pphandle.callOther();
3) Create Object in class pphandle: ActionScript actionScript = new ActionScript();
3) actionScript.callBack();
There comes an error:
Con::execute - 0 has no namespace
Any suggest what is going on there?
Torque 3D Owner Stephen Zepp