Hmm, you already pretty much covered what I was going to say here, but allow me to recap which two (separate) parser quirks we're talking about here anyway:

1. /var assumes that if you specify an '=', it will be the second space-separated parameter of each comma-separated variable declaration. If it is present, the '=' will be removed before the whole thing is passed to /set as DaveC showed. As such, it's no surprise that the following actually works:

//var %foo = $+ bar test | echo -ag -> %foobar
-> test

2. If the second space-separated parameter to (each comma-separated variable declaration in) /var is not an '=', then mIRC will split up the rest of the line in a different way, i.e. ignoring identifier parentheses etcetera. This leads to the "$rand(1" weirdness and the often seen "* Invalid format: $anyidentifier" error.

//var %foo $foo(bar,%baz)
* Invalid format: $foo


Saturn, QuakeNet staff