Blockland Forums > Modification Help

A looping tick?

Pages: (1/1)

otto-san:

I hardly understand how this would work.

I know that if I don't do it correctly, it will cause an infinite loop and crash.

But there IS a way to do this without a crash.

Anyone know?

Chrono:

Example code:

--- Code: ---function loopingfunctionname(%possibleArgs)
{
cancel($uniqueFunctionScheduleNameHere);
//stuff here
$uniqueFunctionScheduleNameHere = schedule(MS FOR TICKS, 0, loopingFunctionName, %possibleArgs);
}
loopingFunctionName(%PossibleArgs);
--- End code ---


otto-san:


--- Quote from: Chrono on August 12, 2010, 10:43:30 PM ---Example code:

--- Code: ---function loopingfunctionname(%possibleArgs)
{
cancel($uniqueFunctionScheduleNameHere);
//stuff here
$uniqueFunctionScheduleNameHere = schedule(MS FOR TICKS, 0, loopingFunctionName, %possibleArgs);
}
loopingFunctionName(%PossibleArgs);
--- End code ---

--- End quote ---

Oh cool. I'll try that, thanks!

:D

Pages: (1/1)

Go to full version