mIRC Homepage
Posted By: sparta Token problem - 20/03/13 02:50 PM
I dont know if token is the best way to do this? If i type

/join #one,#two,#three

and i want a delay between the join of the channels, but i cant figure out the best way to do this, since you use "," between the channel names any of $gettok() , $matchtok() , $findtok() will return a error. So how would i do this the best way?
Posted By: hixxy Re: Token problem - 20/03/13 02:59 PM
You can use $gettok() but you need to set #one,#two,#three to a variable first.

$gettok(#one,#two,#three,1,44) - this won't work.
var %chans = #one,#two,#three | echo -a $gettok(%chans,1,44) - this will work.

Let me know if you need help with the rest of the script now that you know how to get the token identifiers working.
Posted By: westor Re: Token problem - 27/03/13 05:54 PM
try using this alias

Code:
alias join {
  if (!$1-) { echo 4 -a ERROR: Not enough parameters, try again and enter the channel(s) you want to join! - (/join) | return }
  var %chans = $1-
  var %i = 1
  while (%i <= $numtok(%chans,44)) {
    var %c = $gettok(%chans,%i,44)
    .timer[JOIN_ $+ %c $+ _DELAY] 1 %i join %c
    inc %i
  }
}
Posted By: hixxy Re: Token problem - 28/03/13 11:10 PM
Just one small comment: rather than call $numtok() repeatedly, you should set the value to a variable:

Code:
var %i = 1, %count = $numtok(%chans,44)
while (%i !> %count) {
  ...
}
Posted By: westor Re: Token problem - 30/03/13 02:12 AM
what's the difference ?
Posted By: Riamus2 Re: Token problem - 30/03/13 07:13 PM
Performance. Granted, for the number of loops you're talking about, it's such a minimal performance increase that it really doesn't matter. I think the main reason for the suggestion is to get in the habit of using the best performing code every time, even if the difference is negligible.
Posted By: hixxy Re: Token problem - 31/03/13 04:32 PM
Exactly that. In this case there's not going to be a big performance overhead, but if you were calling something like $com() in a loop rather than setting the result to a variable it would cause a massive delay.
© mIRC Discussion Forums