As much as you don't want to admit it, it's /var without = that causes the problem. I'll give you an example of using $ini with mirc.ini to see what I mean.
//var %one = 1 | var %two = $ini($mircini,%one) | echo -a %two
echoes "files" , which is the 1st section in mirc.ini
//var %one = 1 | var %two $ini($mircini,%one) | echo -a %two
echoes * Invalid format: $ini
It spits out the same error as in your script.
The help file says /var should be used with a =. The fact that it works without = in some cases doesn't make it right.