How can the Start( ) function be triggered by a certain period of time rather than a new coming tick?

 

How can the Start( ) function be triggered by a certain period of time rather than a new coming tick?

For instance, a time of 10 seconds.

Can any one with kindness help me?

Or More precisely, how can I perform a function(instead of Start( )) recurrsively triggered by a certain period of time?

 

If you want a purely time-based activation, you would be better off putting your code into a Script and loop with the Sleep function.


No new tick means nothing has changed, so what are you trying to achieve?

 
void runEveryTenSeconds() {
static int timer = 0;

if (timer + 10 < Seconds()) return;
timer = Seconds();

.. Do stuff

}

void start() {
runEveryTenSeconds();
}

Assuming start() is run every tick, runEveryTenSeconds() will run once every 10 second time period (assuming ticks are coming in). This method should suffice for most usages.
 
int start(){
   while ( !IsStopped()){

      ...run your code...

       Sleep(10000);
   }
   return(0);
}
Reason: