Local Variables
Local variables are variables that exist only for the duration of the script in which they are created and can only be accessed from within that script. They can be created with the /var command:
/var %x
This creates the local variable %x in the current routine and can only be referenced from inside this routine.
/var %x = hello
This creates a local variable %x and assigns it the value hello.
You can create multiple local variables by separating them with commas:
/var %x = hello, %y, %z = $me
loop {
var %x = 1
:next
echo item %x
inc %x
if (%x < 10) goto next
}
Note: You can use /var -s to make a variable show the result when a value is set.
/help VariablesA global variable is accessable to any script currently loaded within a mIRC script.
Local variables (var %var) are normally used when you don't want to set a variable, and only need it for temporary data storage, such as in a while loop.
Global variables (set %var) are used when you want more than one script to access that variable. They are also stored (in remotes.ini) if the /unset or -u or -z switches aren't used.