Project

General

Profile

Timer » History » Version 9

Per Amundsen, 03/23/2018 10:33 AM

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 9 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
-r - Resume a timer.
26 1 Per Amundsen
27
*Parameters*
28
29
[off] - Turns of a timer.
30
[n|name] - The name or index of the timer.
31 7 Per Amundsen
[time] - Executes the timer at the specified time in HH:MM (24 hour) format.
32 1 Per Amundsen
<repetitions> - The amount of timer the timers should repeat itself. An repetition value of '0' will repeat for ever.
33
<interval> - The delay between two consecutive timer executions
34
<code> - Code to be executed. 
35
36
*Example*
37
38
<pre>
39
alias example {
40 4 Per Amundsen
  ; Create a variable and set value to 5.
41
  var %reps = 5
42 1 Per Amundsen
 
43 5 Per Amundsen
  ; Call the timer %reps times after 1 second delay.
44 4 Per Amundsen
  .timer %reps 1 countdown 
45 1 Per Amundsen
 
46 4 Per Amundsen
  ; Print the first count.
47 1 Per Amundsen
  count-down
48
}
49 4 Per Amundsen
50
alias -l countdown {
51
  echo -ag Count: $timer($ltimer).reps
52 1 Per Amundsen
}
53
</pre>