Game Development Community

schedule waittime

by USC CTIN · in Torque Game Builder · 01/12/2010 (8:53 pm) · 3 replies

for the 'waittime' argument for a schedule(), does it round up to a multiple of 32?

so is:

%this.schedule(33, myFunc);

...the same as

%this.scheudle(64, myFunc);

...etc?

And so is

%this.scheudle(0, myFunc);

...calling the method right away? and...

%this.scheudle(1, myFunc);

...actually 32 milliseconds?

#1
01/12/2010 (10:37 pm)
The "waittime" is actually milliseconds, so really 32 and 64 would be about the same, really, quick, hard to measure milliseconds but for processing 32 would start before 64. I do not believe the engine rounds the time, let alone round it by 32. If it did setting a time of 1000 would be worthless. If you actually do a test, set an echo function, schedule the first one for 5000, and the next for 10000. You will notice the time is 5 seconds apart.
#2
01/12/2010 (11:03 pm)
the reason why 33 is the same as 64 is that the ticktime is 32ms.
Events are only processed at that timeslices so 32, 64, 96, ..., but happen in the order of the "real schedule milliseconds"


Normally that should not have any direct impact as there is normally nothing that changes that groundbreaking in such a short amount of time that it has significant consequences.
#3
01/19/2010 (4:03 pm)
So it does round up to a multiple of 32, great.

I do this kind of stuff all the time:

// call from somewhere  
%this.explode(0);


////////
function ship::explode(%this, %count)
{
   //animate 
   %this.owner.setImageMap("ship" @ %count @ "imageMap");

   %count++;

   if(%count < 50)
      %this.schedule(100, explode, %count);



}

...so the value for waittime is very important.