Con::executef problem
by Vince Gee · in Torque Game Engine · 01/30/2006 (1:33 pm) · 1 replies
Ok, I've modified the Celestial class to calc some date stuff and I added to my code
Con::executef(this,2,"onDayChange",GetTime() );
In the updatesunpositioin function, I've traced it on the C++ side and I know it's getting called.
Then I added a file called
TimeFunctions.cs
and added to game.cs
exec("./TimeFunctions.cs");
Then in TimeFunctions.cs I have this function...
function Celestials::onDayChange(%this,%day)
{
error("Time Called");
messageAll('time','Current Date is %1.',%day);
}
But it never seems to get triggered.
I've also tried
function SunCycles::onDayChange(%this,%day)
{
error("Time Called");
messageAll('time','Current Date is %1.',%day);
}
So what am I doing wrong?
Vince
Con::executef(this,2,"onDayChange",GetTime() );
In the updatesunpositioin function, I've traced it on the C++ side and I know it's getting called.
Then I added a file called
TimeFunctions.cs
and added to game.cs
exec("./TimeFunctions.cs");
Then in TimeFunctions.cs I have this function...
function Celestials::onDayChange(%this,%day)
{
error("Time Called");
messageAll('time','Current Date is %1.',%day);
}
But it never seems to get triggered.
I've also tried
function SunCycles::onDayChange(%this,%day)
{
error("Time Called");
messageAll('time','Current Date is %1.',%day);
}
So what am I doing wrong?
Vince
About the author
www.winterleafentertainment.com
Torque 3D Owner Stephen Zepp
1) You need to provide in your Con::executef() call as the first parameter the objectID of the calling object...in this case, you would have two parameters after the "onDayChange" one.
2) What is the class of the actual this pointer in the location you are performing the Con::executef()? If, for example, it's "Celestial", then your script namespace should be the same...if it's "CelestialsObject", again it needs to be the same.
3) You need to set the number of parameters properly. In your case, it should be 3 (once you add in the missing parameter for the %this value.