Game Development Community

Schedule as a member function

by Ricardo Arango · in Technical Issues · 10/08/2008 (8:30 am) · 3 replies

Hi,

I am having problems using the schedule member function. It never gets called. My code is something like this:

datablock StaticShapeData(SS)
{
  .
  . 
   category = "SSCategory";	
};

function SSCategory::onAdd(%this, %obj){
   %tempID = %obj.schedule(2000, 'memberFunction'); // this is returning an ID
}

function SSCategory::memberFunction(%obj){
  // It never comes here
}

I have looked everywhere, older posts and documentation (objID.schedule( t , methodName, arg0, ... , argN ), and I think my code is correct. So is there any reason why it shouldn't work?

I have no problem getting to work with normal functions instead of member function.

Thanks

#1
10/08/2008 (9:30 am)
You appear to be scheduling the wrong object.

The "SSCategory" namespace is associated with the object contained in the variable "%this", but you are scheduling the method to be called on the object contained in the variable "%obj".

For the method SSCategory::memberFunction() to be called on %obj, %obj must have SSCategory in it's namespace.
#2
10/08/2008 (9:54 am)
Ok,

I tried this:

datablock StaticShapeData(SS)
{
  .
  . 
   category = "SSCategory";	
};

function SSCategory::onAdd(%this, %obj){
   %tempID = %this.schedule(2000, 'memberFunction', %obj); // this is returning an ID
}

function SSCategory::memberFunction(%this, %obj){
  // It never comes here
}

Same thing, didn't work
#3
10/08/2008 (12:42 pm)
OK, found the problem.

memberFunction should be in between double quotes "", not single quotes ''