Difference between revisions of "Set"
From Scriptwiki
(→Example: Made not overly complicated example >.<) |
m (better explanation of -z) |
||
Line 11: | Line 11: | ||
| n || Treats value as plain text. | | n || Treats value as plain text. | ||
|- | |- | ||
− | | z || Decreases %var until it reaches zero and then unsets it. | + | | z || Decreases %var by 1 per second until it reaches zero, and then unsets it. |
|- | |- | ||
| e || Unsets the variable when mIRC exits. | | e || Unsets the variable when mIRC exits. |
Latest revision as of 20:10, 25 October 2013
Sets the value of %variable to the specified value.
/set [-lsnzuN] <%variable> [value]
Switch | Meaning |
uN | Unsets %var after N seconds, as long as %var isn't set again. If N is 0, it is unset when script finishes. |
k | Keeps the current -uN setting for a variable. |
n | Treats value as plain text. |
z | Decreases %var by 1 per second until it reaches zero, and then unsets it. |
e | Unsets the variable when mIRC exits. |
l | Sets %var as a local variable, same as using /var (Deprecated, use /var) |
s | Gives an output: * Set %var to value. |
Example
set %fuu bar set %moo $+ %fuu 42
This will set %fuu to bar and then set %moobar to 42, as the variable %fuu will first be evaluated to bar.
echo -a This is fuu: %fuu
Will echo This is fuu: bar
Note: The variable %fuu is automatically evaluated in a /set or /var command when it is part of the variable name, however elsewhere the variable must be evaluated using either $eval or evaluation brackets, e.g.
if (%moo [ $+ [ %fuu ] ] == 42) if ($($+(%,moo,%fuu),2) == 42)
set -u3 %fuu bar
This will set %fuu to bar and unset it after 3 seconds.
set -s %fuu 3
This will set %fuu to 3 and give an output to the active window: * Set %fuu to 3