The KSirc Handbook
Prev | Chapter 5. Programming Your Sirc Client | Next

# 5.5. Timers

It is possible in sirc to specify an action to be done but delayed, a certain number of seconds later, just like with ircII's `/timer` function. This is only precise up to the second.

To do this, you call the function `&timer` with the number of seconds to wait as the first argument, and the string to be evaluated as the second argument.

A third argument can be supplied; it needs to be a non-zero number, and will be used as the reference number for the timer. Setting a timer when another with the same reference number exists will delete the first timer. If no number is specified, the timer cannot be deleted.

To delete a timer with reference number `$n`, call `&deltimer($n);`

This is simple enough, but if you really need an example, here comes: to print "hello" in 10 seconds, you'd do `&timer(10, "&tell('hello')");`

If you want to be able to cancel it, you'd do `&timer(10, "&tell('hello')", 6);` and then to cancel it you'd do `&deltimer(6);` It goes without saying that the '6' is arbitrary.

Prev | Home | Next
Userhost requests | Up | Adding file handles to the main select() loop