Difference between revisions of "Set"

From Scriptwiki
Jump to: navigation, search
m (added variables category)
(added l parameter. changed to use wikipipe tables)
Line 1: Line 1:
 
Sets the value of %variable to the specified value.
 
Sets the value of %variable to the specified value.
  /set [-snzuN] <%variable> [value]
+
  /set [-lsnzuN] <%variable> [value]
<table>
+
{| style="width:100%"
<tr><td><b>Switch</b></td><td><b>Meaning</b></td></tr>
+
|-
<tr><td>s</td><td>Gives an output: * Set %var to value.</td></tr>
+
| style="width:10%" | '''''Switch''''' || Style="width:90%" | '''''Meaning'''''
<tr><td>n</td><td>Treats value as plain text.</td></tr>
+
|-
<tr><td>z</td><td>Decreases %var until it reaches zero and then unsets it.</td></tr>
+
| l      || Sets %var as a local variable, same as using /[[var]]
<tr><td>uN</td><td>Unsets %var after N seconds, as long as %var isn't set again. If N is 0, it is unset when script finishes.</td></tr>
+
|-
</table>
+
| s     || Gives an output: * Set %var to value.
 +
|-
 +
| n     || Treats value as plain text.
 +
|-
 +
| z     || Decreases %var until it reaches zero and then unsets it.
 +
|-
 +
| uN     || Unsets %var after N seconds, as long as %var isn't set again. If N is 0, it is unset when script finishes.
 +
|}
  
 
== Example ==
 
== Example ==

Revision as of 14:39, 30 November 2005

Sets the value of %variable to the specified value.

/set [-lsnzuN] <%variable> [value]
Switch Meaning
l Sets %var as a local variable, same as using /var
s Gives an output: * Set %var to value.
n Treats value as plain text.
z Decreases %var until it reaches zero and then unsets it.
uN Unsets %var after N seconds, as long as %var isn't set again. If N is 0, it is unset when script finishes.

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.


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

See Also

/unset unsets a variable.
/var sets a local variable.
/unsetall unsets all variable from the variable list.