Timer » History » Version 7
Per Amundsen, 07/27/2017 04:28 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 | 1 | Per Amundsen | *Switches* |
14 | |||
15 | -c - TODO |
||
16 | -d - TODO |
||
17 | 6 | Per Amundsen | -e - Execute the code associated with a timer. |
18 | -h - Create a high-resolution timer. |
||
19 | 1 | Per Amundsen | -i - Dynamically associates itself with the active connection. |
20 | 6 | Per Amundsen | -m - Treat the interval parameter as milliseconds instead of seconds. |
21 | -o - Create a offline timer. |
||
22 | -p - Pause a timer. |
||
23 | -r - Resume a timer. |
||
24 | 1 | Per Amundsen | |
25 | *Parameters* |
||
26 | |||
27 | [off] - Turns of a timer. |
||
28 | [n|name] - The name or index of the timer. |
||
29 | 7 | Per Amundsen | [time] - Executes the timer at the specified time in HH:MM (24 hour) format. |
30 | 1 | Per Amundsen | <repetitions> - The amount of timer the timers should repeat itself. An repetition value of '0' will repeat for ever. |
31 | <interval> - The delay between two consecutive timer executions |
||
32 | <code> - Code to be executed. |
||
33 | |||
34 | *Example* |
||
35 | |||
36 | <pre> |
||
37 | alias example { |
||
38 | 4 | Per Amundsen | ; Create a variable and set value to 5. |
39 | var %reps = 5 |
||
40 | 1 | Per Amundsen | |
41 | 5 | Per Amundsen | ; Call the timer %reps times after 1 second delay. |
42 | 4 | Per Amundsen | .timer %reps 1 countdown |
43 | 1 | Per Amundsen | |
44 | 4 | Per Amundsen | ; Print the first count. |
45 | 1 | Per Amundsen | count-down |
46 | } |
||
47 | 4 | Per Amundsen | |
48 | alias -l countdown { |
||
49 | echo -ag Count: $timer($ltimer).reps |
||
50 | 1 | Per Amundsen | } |
51 | </pre> |