 |
|
Variables
|
|
|
KVirc scripting language supports variables.
A variable name must start with a '$' : '$last','$x','$temp.ban.message' are correct variable names.
A variable can be set using the SET command , and unset using the UNSET command.
Example :
/set $my.channel #kaos
This will set a variable named '$my.channel' to the value '#kaos'.
Now if you type:
/join $my.channel
KVirc will evaluate the variable and substitute it by its value.
As result , you will join the #kaos channel.
If the variable is no longer needed , you can unset it to save memory.
/unset $my.channel
If you try to use now,it will be replaced by $_null (see below.).
All variables of this kind are GLOBAL : if you set it (for example) in an ALIAS , you will
be able to use it in every other command.
There are some reserved variables :
'$0','$1',...,'$9' : Local variables used in ALIASES and EVENTS.
The variables of this kind are LOCAL : if you change its value in an alias , the change will be lost
in other aliases.
'$_*' : The variables that begin with '$_' are assumed to be IDENTIFIERS.
It's value can not be changed.
'$%*' : The variables that begin with '$%' are assumed to be FUNCTION CALLS.
'$_true','$_false','$_null' : Special identifers.
An unset variable will evaluate to $_null.
Note that a variable that is currently set to $_null will evaluate in the same way!
You can use the $%ext_isset function to check if a variable is currently set.
All variables are automatically unset when kvirc terminates.
To save a variable value between sessions you can use the CACHE command.
Index