There's nothing to solve. This is also the basic reason why multiple spaces don't work. If mIRC assumed empty tokens were tokens, then input like:

"the    quick brown fox"

Would break scripts expecting $2 to be "quick". That is, it would break just about every script. Note that $N is just shorthand for $gettok($1-,N,32). This is how mIRC parses out $1- internally for every command and identifier, it's a design feature of the language, and therefore is not a bug and probably not going to change.

You're free to write your own tokenization function that handles empty tokens.

edit: Here's one for you:

Code:
alias gettokex {
  var %text = $1, %n = $2, %delim = $chr($3)
  var %count = $calc($count(%text,%delim) + 1)
  if (%n == 0) return %count
  if (%n < 0) %n = $calc(%count + %n)
  if (%n > %count) return
  var %from = $iif(%n == 1,1,$calc($poscs(%text,%delim,$calc(%n - 1)) + 1))
  var %to = $poscs(%text,%delim,$iif(%n == 1,1,%n))
  if (%from == $null) %from = $calc($poscs(%text,%delim,-1) + 1)
  if (%to == $null) %to = $calc($len(%text) + 1)
  var %diff = %to - %from
  if (%diff == 0) return
  return $mid(%text,%from,%diff)
}


//echo -a $gettok(foo::bar,1,58)
foo
//echo -a $gettok(foo::bar,2,58)
(tries to echo empty string)
//echo -a $gettok(foo::bar,3,58)
bar

or

//echo -ag $gettokex(1##3##5##7,3,35)
3

Last edited by argv0; 27/11/10 08:44 PM.

- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"