mIRC Home    About    Download    Register    News    Help

Topic Options
#162015 - 13/10/06 05:42 PM $matchtokcs bug?
Jigsy Offline
Hoopy frood

Registered: 18/11/04
Posts: 797
Loc: I live inside your computer. S...
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
_________________________
This signature is currently out of order. We apologize for the inconvenience.

Top
#162016 - 13/10/06 06:17 PM Re: $matchtokcs bug?
deegee Offline
Fjord artisan

Registered: 16/06/06
Posts: 508
Loc: Storage
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

Top
#162017 - 13/10/06 10:10 PM Re: $matchtokcs bug?
DaveC Offline
Planetary brain

Registered: 26/09/03
Posts: 4230
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.

Top
#170974 - 17/02/07 04:31 PM Re: $matchtokcs bug? [Re: Jigsy]
Jigsy Offline
Hoopy frood

Registered: 18/11/04
Posts: 797
Loc: I live inside your computer. S...
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.
_________________________
This signature is currently out of order. We apologize for the inconvenience.

Top
#170975 - 17/02/07 04:43 PM Re: $matchtokcs bug? [Re: Jigsy]
qwerty Offline
Hoopy frood

Registered: 07/01/03
Posts: 2523
Not a bug, $matchtok() does an "isin" check on each token, so in your second example it matched the I Invite (2nd) token.
_________________________
/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com

Top
#170976 - 17/02/07 04:43 PM Re: $matchtokcs bug? [Re: Jigsy]
starbucks_mafia Offline
Hoopy frood

Registered: 09/12/02
Posts: 2962
Loc: Norwich, UK
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!


Edited by starbucks_mafia (17/02/07 04:44 PM)
_________________________
Spelling mistakes, grammatical errors, and stupid comments are intentional.

Top
#170977 - 17/02/07 04:44 PM Re: $matchtokcs bug? [Re: qwerty]
Jigsy Offline
Hoopy frood

Registered: 18/11/04
Posts: 797
Loc: I live inside your computer. S...
Oh, ... that seems kind of stupid. :X
_________________________
This signature is currently out of order. We apologize for the inconvenience.

Top