mIRC Home    About    Download    Register    News    Help

Print Thread
#226100 19/09/10 06:41 AM
Joined: Sep 2007
Posts: 202
F
firefox Offline OP
Fjord artisan
OP Offline
Fjord artisan
F
Joined: Sep 2007
Posts: 202
if ($nick = username) || ($nick = someone) || ($nick = mirc1) { alias }

I have a long list of nicks - can you suggest a better way to add them?

Joined: Jul 2006
Posts: 4,145
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
$istok, if ($istok(username someone mirc1,$nick,32)) {


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Sep 2007
Posts: 202
F
firefox Offline OP
Fjord artisan
OP Offline
Fjord artisan
F
Joined: Sep 2007
Posts: 202
ok thanks

Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
You can also use the $count

if ($count($nick,username,someone,mirc1)) {

$findtok will do it too.

Joined: Feb 2006
Posts: 546
J
Fjord artisan
Offline
Fjord artisan
J
Joined: Feb 2006
Posts: 546
$count() is quite different for two reasons, one of which isn't so obvious:

Code:
if ($count($nick, username, someone, mirc1)) {


is an equivalent check to:

Code:
if (username isin $nick) || (someone isin $nick) || (mirc1 isin $nick) {


if the OP specifically wants to check for equality then this approach isn't suitable. there's also another slight difference in that, with $count(), mIRC will go through the entire string once for every extra parameter supplied even after one of the substrings has been found (whereas with an if statement the search is terminated once this happens). this difference might not become apparent for a small number of parms and smaller strings but can become a significant issue in other situations


"The only excuse for making a useless script is that one admires it intensely" - Oscar Wilde
Joined: Aug 2010
Posts: 134
T
Vogon poet
Offline
Vogon poet
T
Joined: Aug 2010
Posts: 134
Another option is to use the Users page, and make your event only trigger for those users.

Just to be sure... if you're talking about your own usernames, you can also use $me.


Learning something new every day.
Joined: Jan 2007
Posts: 1,156
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
You can use this method and check a saved list of nicknames.

%var = nick1,nick2,nick3

if ($istok(%var,$nick,44))


$hget(table,nicks) = nick1,nick2,nick3

if ($istok($hget(table,nicks),$nick,44))


You can also use isin which is faster but not as accurate.

if ($nick isin %var)

$nick = tru
But a nickname stored, Truth, would return $true but not be accurate.

Joined: Jul 2006
Posts: 4,145
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
I'm not sure why you replied, I'm the one who suggested $istok and 'isin' isn't what the OP wanted since he used == ('=' actually but..) for an exact match


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Jan 2007
Posts: 1,156
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
I'm not sure why you posted. You want to try to prove some superiority? If you read my post I showed him that he could also store the nicknames in a dynamic list like a variable or hash table.

Relax bro.

Joined: Jul 2006
Posts: 4,145
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
I wasn't being rude or anything, sorry if it looks like I was.
But you replied to me rather than to the OP and as said, yes I think your post doesn't add anything useful to the thread


#mircscripting @ irc.swiftirc.net == the best mIRC help channel

Link Copied to Clipboard