mIRC Homepage
Posted By: GaMa $gettok invalid format (var error...) - 01/05/07 09:34 PM
How shall I explain this. Using gettok and setting it to a variable gives me the error. While just echo'ing the gettok command works perfectly fine. Here is how my code is set up.

Code:
  var %temp.dir = %mtm. [ $+ [ $replace(%temp.trig, $chr(32), $chr(46)) ] ]
  var %y = $numtok(%temp.dir,127)
  while (%y > 0) {
    echo -a %temp.dir
    echo -a $gettok(%temp.dir,%y,127)
    var %temp.odderror $gettok(%temp.dir,%y,127)
 


I placed the echo right next to the var to make sure, but it still gives the error when trying to set it.
Posted By: Vliedel Re: $gettok invalid format - 01/05/07 09:45 PM
did you try: var %temp.odderror = $gettok(... ?
Posted By: GaMa Re: var = error xD - 01/05/07 09:47 PM
Well well well, yep that works. I guess this is a more... var error. Since you don't need the equals for it to set it...
Posted By: hixxy Re: var = error xD - 01/05/07 11:37 PM
The help file states you should use = in /var, if you don't use = to set your variables it's not really a bug in /var but in your script.

You could argue that /var shouldn't allow people to withhold the =, but that'd break too many scripts now.
Posted By: GaMa Re: var = error xD - 01/05/07 11:48 PM
Oddly, I switch back and forth for some odd reason using an equals in a /var. This is the first time i've ran into this.
Posted By: Om3n Re: $gettok invalid format (var error...) - 01/05/07 11:59 PM
The equal sign is required when setting a local variable with data that evaluates from something containing a comma or for inline variables, i believe this is so mirc can more easily determine where the data for one variable ends and the data for another begine (at least thats my best guess). It is not a required part of the syntax in all circumstances due to the ability to create empty variables
© mIRC Discussion Forums