mIRC Homepage
Posted By: Jigsy $matchtokcs bug? - 13/10/06 04:42 PM
I'm not sure if this is a bug or not, however I think it might be.

Code:
/test {
  var %b = $iif($matchtok(2 8 16,$1,1,32),$ifmatch,$gettok(2 8 16,$rand(1,3),32))
  var %N = 2,8 8,3 16,2
  echo -a %b - $matchtokcs(%N,%b,1,32)
}


/test 2 returns 2,8
/test 8 returns 2,8 when it should return 8,3
/test 16 returns 16,2

Anyone know? ;o
Posted By: deegee Re: $matchtokcs bug? - 13/10/06 05:17 PM
Seems right to me wink

$matchtokcs(%N,%b,1,32) = the first matching token.

"2" matches 2,8 and 16,2, the first match is 2,8
"8" matches 2,8 and 8,3, the first match is 2,8
"16" matches only 16,2
Posted By: DaveC Re: $matchtokcs bug? - 13/10/06 09:10 PM
echo -a %b - $matchtokcs(%N,$+(%b,$chr(44)),1,32)


the above search for "2," "8," "16," to correct the problem with picking up the second value.
Posted By: Jigsy Re: $matchtokcs bug? - 17/02/07 04:31 PM
Instead of making a new post, I'd thought I'd add to this one:

Code:
//var %i = b Ban,e Except,I Invite | //echo -aet $gettok($matchtokcs(%i,i,1,44),2,32)


I = Invite.
i = Invite.

If I'm correct, "i" shouldn't work because it's not case-sensitive.

Code:
//var %i = b Ban,e Except,I Invite,i Invite only | //echo -aet $gettok($matchtokcs(%i,i,1,44),2-,32)


I = Invite.
i = Invite.

"i" should be returning "Invite only", not "Invite".


I'm pretty sure this is a bug.
Posted By: qwerty Re: $matchtokcs bug? - 17/02/07 04:43 PM
Not a bug, $matchtok() does an "isin" check on each token, so in your second example it matched the I Invite (2nd) token.
Posted By: starbucks_mafia Re: $matchtokcs bug? - 17/02/07 04:43 PM
No because using $matchtokcs(%i,i,1,44) means it'll match the first token containing "i". Take at look at your variable again:
Quote:
%i = b Ban,e Except,I Invite,i Invite only


To match in the way you want you need to use $wildtokcs() like so (differences highlighted):
Quote:
//var %i = b Ban,e Except,I Invite,i Invite only | //echo -aet $gettok($wildtokcs(%i,i *,1,44),2-,32)


Edit: Damn you qwerty!
Posted By: Jigsy Re: $matchtokcs bug? - 17/02/07 04:44 PM
Oh, ... that seems kind of stupid. :X
© mIRC Discussion Forums