(Created page with "The '''/timer command''' can be used to create a general purpose timer. A timer is a way to execute code at some specific interval or time and delay. Timers can be named and u...") |
m |
||
Line 1: | Line 1: | ||
− | The '''/timer command''' can be used to create a general purpose timer. A timer is a way to execute code at some specific interval or time and delay. Timers can be named and unnamed. Unnamed timers will get the lowest numeric timer index available. Named timers are specifically useful if you need to recall that timer at a later period - to pause it, resume it, or simply reset it. Starting a timer with a name that already exists will override the old timer. Timers only get execute on the main mIRC message loop. I.E. after the alias/event are complete. | + | The '''/timer command''' can be used to create a general purpose timer. A [[timer]] is a way to execute code at some specific interval or time and delay. [[Timers]] can be named and unnamed. Unnamed timers will get the lowest numeric timer index available. Named timers are specifically useful if you need to recall that timer at a later period - to pause it, resume it, or simply reset it. Starting a timer with a name that already exists will override the old timer. Timers only get execute on the main mIRC message loop. I.E. after the alias/event are complete. |
== Synopsis == | == Synopsis == |
Revision as of 23:42, 9 April 2014
The /timer command can be used to create a general purpose timer. A timer is a way to execute code at some specific interval or time and delay. Timers can be named and unnamed. Unnamed timers will get the lowest numeric timer index available. Named timers are specifically useful if you need to recall that timer at a later period - to pause it, resume it, or simply reset it. Starting a timer with a name that already exists will override the old timer. Timers only get execute on the main mIRC message loop. I.E. after the alias/event are complete.
Synopsis
/timers [off] /timer[n|name] [off] /timer[n|name] [-cdeomhipr] [time] <repetitions> <interval> <code>
Switches
Creation Manipulators
- -o - Creates a offline timer
- -c - Creates a catch-up timer
- -h - Creates a high-resolution timer
Attributes
- -m - Treats the interval parameter as milliseconds instead of seconds
- -d - Keeps the order of all -d timers
- -i - Dynamically associates itself with the active connection
Manipulator
- -e - Executes the code associated with a timer
- -p - Pauses a timer
- -r - Resumes a timer
Parameters
- [off] - A literal 'off' keyword, used to turn off a timer.
- [n|name] - The name or index of the timer
- [time] - Time to activate the timer, for example '15:30' for 3:30PM
- <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
Below is a simple count down timer that uses a call-back alias once per second:
alias example { ; start cou var %reps = 5 ; call the timer %reps times after 1 second delay each .timer %reps 1 count-down ; print the first count count-down } alias -l count-down { echo -a Count: $timer($ltimer).reps }
The above code will generate the following output:
Count: 5 Count: 4 Count: 3 Count: 2 Count: 1 Count: 0
A more basic example of a message being delayed for 3 seconds:
on *:text:!foo:#foo:{ ; delay the message for 3 seconds timer 1 3 msg #foo Bar! }
A repetition of '0' can also be used to mean an repeat for ever:
alias cur_time { timer 0 1 echo -s $!time(hh:nn:ss) }
Compatibility
Added: mIRC 3.3, 3.4
Added On: 21/06/95
Note: Individual switches were not taken into consideration.