Author Topic: Stopping a loop command  (Read 662 times)

Say I had something like
Code: [Select]
function x()
{
echo("y");
x();
}

How could I end this loop with another function?

The only way I know of is modifying the first function (x) within the second one, at which point my script messes up cause I'm too nub to know how to fix it at that point. :|

Code: [Select]
function x()
{
echo("y");
if(!$X_disabled){
   x();
}|
}
function x_off()
{
$X_disabled=1;
}
function x_on()
{
$X_disabled=0;
}

Do this
function x()
{
 echo("y");
 $x::loop = schedule(desire time in mileseconds,0,x);
}
to cancel it do this
cancel("$x::loop");
FU
Code: [Select]
function x()
{
echo("y");
if(!$X_disabled){
   x();
}|
}
function x_off()
{
$X_disabled=1;
}
function x_on()
{
$X_disabled=0;
}