I don't know anyone who would say /set is undocumented. /set has probably been around as long as /var. The reason people will suggest /var instead of /set is because /var is temporary (loaded in memory), while /set is remains until you /unset it (written to disk). If you are doing something that doesn't need to be stored, then /var makes more sense. If you are doing something that does need stored for a later use, then /set is needed. For this example script, the values aren't needed once the script completes, so /var is better. Otherwise, you have to manually /unset the variable when you finish. And although speed isn't going to be noticeably different unless you have a ton of /set or /var in a script, it's still faster to put data in memory than to write to disk and then delete it from disk when done.

Anyhow, to the OP... as was mentioned, /var uses =, but /set does not. Examples:

/var %test = 5
/set %test 5

Both do the same thing, but /var only sets the variable until the end of the current event/alias and then it's removed. Note that with /var, you can use basic math:

/var %test = %test + 1

You cannot do that with /set. In addition, if you are just adding or subtracting, the use of /inc or /dec works well.

/inc %test (increases the value by 1)
/inc %test 5 (increases the value by 5)
/dec %test (decreases the value by 1)
/dec %test 5 (decreases the value by 5)

As far as making sure that the value is a number, variables don't have types as was mentioned. mIRC will just either ignore what you try doing or throw an error if you try manipulating a variable that has the wrong type of data in it. So you would need to test the variable if you think it may not be a number. A simple test is:

if (%variable isnum) { do something }

or

if (%variable !isnum) { do something }

The ! means "not".


Invision Support
#Invision on irc.irchighway.net