mIRC Home    About    Download    Register    News    Help

Topic Options
#171510 - 25/02/07 04:36 AM isin vs. findtok
DJ_Sol Offline
Hoopy frood

Registered: 04/01/07
Posts: 1156
Loc: Seattle
Im curious what people's opinions are on this.

Lets say I want a hopflood protection on for 3 rooms.
$hget(prot,hopflood) = $chan1 $chan2 $chan3

What do you think is better?

if ($chan isin $hget(prot,hopflood))

if ($findtok($hget(prot,hopflood),$chan,1,32))

And please explain why you feel that way. Thank You!!

#171511 - 25/02/07 04:46 AM Re: isin vs. findtok [Re: DJ_Sol]
RusselB Offline
Planetary brain

Registered: 03/08/04
Posts: 7252
Loc: Ontario, Canada
In this case, I would use $findtok, since the usage of isin could match partials.
For example:
Chan 1 = #Testing
Chan 2 = #testicles

If the current channel was #Test, then using isin would match both of the channels listed, even though the specific channel isn't listed.

Using $findtok would check the entire channel name in the list and compare that to the channel being used, and return no match (which in this example would be correct)

#171515 - 25/02/07 05:12 AM Re: isin vs. findtok [Re: DJ_Sol]
starbucks_mafia Offline
Hoopy frood

Registered: 09/12/02
Posts: 2962
Loc: Norwich, UK
If you just want to check for the presence of the channel name I'd use the hidden third answer: $istok. You shouldn't use isin for the reasons RusselB mentioned.
Spelling mistakes, grammatical errors, and stupid comments are intentional.

#171543 - 25/02/07 04:53 PM Re: isin vs. findtok [Re: starbucks_mafia]
Riamus2 Offline
Planetary brain

Registered: 13/10/04
Posts: 8327
Loc: MA, USA
Right, $istok is much better than $findtok for something like that.
Invision Support
#Invision on irc.irchighway.net