mIRC Home    About    Download    Register    News    Help

Print Thread
#162015 13/10/06 04:42 PM
Joined: Nov 2004
Posts: 842
Jigsy Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Nov 2004
Posts: 842
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


What do you do at the end of the world? Are you busy? Will you save us?
#162016 13/10/06 05:17 PM
Joined: Jun 2006
Posts: 508
D
Fjord artisan
Offline
Fjord artisan
D
Joined: Jun 2006
Posts: 508
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

#162017 13/10/06 09:10 PM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
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.

Jigsy #170974 17/02/07 04:31 PM
Joined: Nov 2004
Posts: 842
Jigsy Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Nov 2004
Posts: 842
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.


What do you do at the end of the world? Are you busy? Will you save us?
Jigsy #170975 17/02/07 04:43 PM
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
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
Jigsy #170976 17/02/07 04:43 PM
Joined: Dec 2002
Posts: 2,962
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
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!

Last edited by starbucks_mafia; 17/02/07 04:44 PM.

Spelling mistakes, grammatical errors, and stupid comments are intentional.
qwerty #170977 17/02/07 04:44 PM
Joined: Nov 2004
Posts: 842
Jigsy Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Nov 2004
Posts: 842
Oh, ... that seems kind of stupid. :X


What do you do at the end of the world? Are you busy? Will you save us?

Link Copied to Clipboard