Project

General

Profile

Timer » History » Version 12

Per Amundsen, 01/20/2019 11:11 PM

1 1 Per Amundsen
_Added in 1.9.0_
2
3
*/timers [off]*
4
*/timer[n|name] [off]*
5
*/timer[n|name] [-cdehimopr] [time] <repetitions> <interval> <code>*
6
7 2 Per Amundsen
Creates a timer that runs <code> at an interval.
8
9
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.
10
11 3 Per Amundsen
A offline timer will continue to run even if the server is disconnected, while a online timer will stop the timer when disconnected.
12 2 Per Amundsen
13 10 Per Amundsen
_$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._
14 8 Per Amundsen
15 1 Per Amundsen
*Switches*
16
17
-c - TODO
18
-d - TODO
19 6 Per Amundsen
-e - Execute the code associated with a timer.
20
-h - Create a high-resolution timer.
21 1 Per Amundsen
-i - Dynamically associates itself with the active connection.
22 6 Per Amundsen
-m - Treat the interval parameter as milliseconds instead of seconds.
23
-o - Create a offline timer.
24
-p - Pause a timer.
25 12 Per Amundsen
-P - Pause a timer.
26 6 Per Amundsen
-r - Resume a timer.
27 1 Per Amundsen
28
*Parameters*
29
30
[off] - Turns of a timer.
31
[n|name] - The name or index of the timer.
32 7 Per Amundsen
[time] - Executes the timer at the specified time in HH:MM (24 hour) format.
33 1 Per Amundsen
<repetitions> - The amount of timer the timers should repeat itself. An repetition value of '0' will repeat for ever.
34
<interval> - The delay between two consecutive timer executions
35
<code> - Code to be executed. 
36
37
*Example*
38
39
<pre>
40
alias example {
41 4 Per Amundsen
  ; Create a variable and set value to 5.
42
  var %reps = 5
43 1 Per Amundsen
 
44 5 Per Amundsen
  ; Call the timer %reps times after 1 second delay.
45 4 Per Amundsen
  .timer %reps 1 countdown 
46 1 Per Amundsen
 
47 4 Per Amundsen
  ; Print the first count.
48 1 Per Amundsen
  count-down
49
}
50 4 Per Amundsen
51
alias -l countdown {
52
  echo -ag Count: $timer($ltimer).reps
53 1 Per Amundsen
}
54 11 Per Amundsen
55
; Simple timer that sends a reply after 10 seconds.
56
on *:TEXT:hi:#freenode:{ timer 1 10 msg $chan Hello, $nick $+ ! }
57 1 Per Amundsen
</pre>