Project

General

Profile

Timer » History » Revision 11

Revision 10 (Per Amundsen, 03/23/2018 10:33 AM) → Revision 11/17 (Per Amundsen, 03/23/2018 10:34 AM)

_Added in 1.9.0_ 

 */timers [off]* 
 */timer[n|name] [off]* 
 */timer[n|name] [-cdehimopr] [time] <repetitions> <interval> <code>* 

 Creates a timer that runs <code> at an interval. 

 If you are connected to server when the timer is started, it defaults to being a online timer, otherwise it will be a offline timer. 

 A offline timer will continue to run even if the server is disconnected, while a online timer will stop the timer when disconnected. 

 _$identifiers and %vars in the <code> are evaluated at the creation time of the timer, to evaluate during the timer tick, the $ and % must be combined like this $ $+ identifier, % $+ varname._ 

 *Switches* 

 -c - TODO 
 -d - TODO 
 -e - Execute the code associated with a timer. 
 -h - Create a high-resolution timer. 
 -i - Dynamically associates itself with the active connection. 
 -m - Treat the interval parameter as milliseconds instead of seconds. 
 -o - Create a offline timer. 
 -p - Pause a timer. 
 -r - Resume a timer. 

 *Parameters* 

 [off] - Turns of a timer. 
 [n|name] - The name or index of the timer. 
 [time] - Executes the timer at the specified time in HH:MM (24 hour) format. 
 <repetitions> - The amount of timer the timers should repeat itself. An repetition value of '0' will repeat for ever. 
 <interval> - The delay between two consecutive timer executions 
 <code> - Code to be executed.  

 *Example* 

 <pre> 
 alias example { 
   ; Create a variable and set value to 5. 
   var %reps = 5 
 
   ; Call the timer %reps times after 1 second delay. 
   .timer %reps 1 countdown  
 
   ; Print the first count. 
   count-down 
 } 

 alias -l countdown { 
   echo -ag Count: $timer($ltimer).reps 
 } 

 ; Simple timer that sends a reply after 10 seconds. 
 on *:TEXT:hi:#freenode:{ timer 1 10 msg $chan Hello, $nick $+ ! } 
 </pre>