|
Joined: Nov 2004
Posts: 842
Hoopy frood
|
OP
Hoopy frood
Joined: Nov 2004
Posts: 842 |
I'm not sure if this is a bug or not, however I think it might be.
/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?
|
|
|
|
Joined: Jun 2006
Posts: 508
Fjord artisan
|
Fjord artisan
Joined: Jun 2006
Posts: 508 |
Seems right to me $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
|
|
|
|
Joined: Sep 2003
Posts: 4,230
Hoopy frood
|
Hoopy frood
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.
|
|
|
|
Joined: Nov 2004
Posts: 842
Hoopy frood
|
OP
Hoopy frood
Joined: Nov 2004
Posts: 842 |
Instead of making a new post, I'd thought I'd add to this one:
//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.
//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?
|
|
|
|
Joined: Jan 2003
Posts: 2,523
Hoopy frood
|
Hoopy frood
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
|
|
|
|
Joined: Dec 2002
Posts: 2,962
Hoopy frood
|
Hoopy frood
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: %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): //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.
|
|
|
|
Joined: Nov 2004
Posts: 842
Hoopy frood
|
OP
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?
|
|
|
|
|