Author Topic: How does one go about making a console command repeat until cancelled?  (Read 550 times)

This may go in help, but it doesn't seem like it would... Any help would be greatly appreciated.

function A()
{
 if($A==1)
 {
  schedule(DELAY,0,a);
 }
}
function Tog()
{
 if($A==0)
 {
 $A=1;
 a();
 }
 else
 {
  $a=0;
 }
}


This would be the setup to repeat talking Hello! every 1000 ms (1 second):

Code: [Select]
function rc() { talk("Hello!"); $rc = schedule(1000,0,rc); }
To start it:

Code: [Select]
rc();
To stop it:

Code: [Select]
cancel($rc);

Thanks Truce, that was just what I needed.