Define a function which repeatedly schedules itself to be invoked after a bit of time, passing a constantly increasing number as an argument.
For example:
function foo( %ticks )
{
cancel( $foo );
echo( %ticks );
$foo = schedule( 1000, 0, foo, %ticks++ );
}
This will display a number that increases every second in the console.