Set » History » Version 23
Per Amundsen, 02/16/2023 03:21 PM
| 1 | 1 | Per Amundsen | _Added in 1.8.8_ |
|---|---|---|---|
| 2 | |||
| 3 | 16 | Per Amundsen | */set [-eklnsuNzgpB] <%var> [value]* |
| 4 | 1 | Per Amundsen | |
| 5 | Sets the value of %var to the specified value. |
||
| 6 | |||
| 7 | 22 | Per Amundsen | _See also [[/var]], [[/unset]], [[/inc]], [[/vars]], [[/dec]], [[$var]], [[Variables_Dialog|Edit Variables]]._ |
| 8 | 15 | Per Amundsen | |
| 9 | 1 | Per Amundsen | *Switches* |
| 10 | |||
| 11 | 23 | Per Amundsen | table(ktable). |
| 12 | |*Switch*|*Description*| |
||
| 13 | | -e | Unset the variable when AdiIRC exits. | |
||
| 14 | | -k | Keeps the unset time (-u) from a previous command. | |
||
| 15 | | -l | Creates a local variable instead of global. | |
||
| 16 | | -n | Treat the value as plain text, even if arithmetic operators are used. | |
||
| 17 | | -s | Display variable assignment value. | |
||
| 18 | | -uN | Unsets the variable after N amount of seconds, if N = 0 unset the variable after the script is finished. | |
||
| 19 | | -z | Decreases the value of the variable by 1/ever second until zero is reached. At zero the variable will be unset. | |
||
| 20 | | -i | Initializes a variable only if it does not already exist as a local or global variable. | |
||
| 21 | | -g | Sets a global variable even if a local variable exists. | |
||
| 22 | | -p | Permits value to be 2 literal double quotes and permits value to end with a single [[$chr]](32) space. Also enables -n switch behavior. | |
||
| 23 | | -B | Performs a [[$calcint]] calculation instead of regular [[$calc]] when arithmetic operators are used. *(AdiIRC only)* | |
||
| 24 | 1 | Per Amundsen | |
| 25 | 19 | Per Amundsen | *Parameters* |
| 26 | 1 | Per Amundsen | |
| 27 | 23 | Per Amundsen | table(ktable). |
| 28 | |*Parameter*|*Description*| |
||
| 29 | | <%var> | The variable to set. | |
||
| 30 | | [value] | Value to set the variable to. (can be a single [[Arithmetic Operators<notextile>|</notextile>arithmetic expression]]) | |
||
| 31 | 1 | Per Amundsen | |
| 32 | *Example* |
||
| 33 | |||
| 34 | 6 | Per Amundsen | <pre> |
| 35 | 1 | Per Amundsen | alias example { |
| 36 | 20 | Per Amundsen | ; Create a variable and set a value. |
| 37 | 1 | Per Amundsen | /set %var Countdown: |
| 38 | |||
| 39 | 20 | Per Amundsen | ; Print the value |
| 40 | 1 | Per Amundsen | /echo -a %var |
| 41 | |||
| 42 | 20 | Per Amundsen | ; Set the value to 3, decrease once per second |
| 43 | 1 | Per Amundsen | /set -zs %var 3 |
| 44 | } |
||
| 45 | 6 | Per Amundsen | </pre> |