mIRC Home    About    Download    Register    News    Help

Print Thread
if ($nick = username) #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?

Re: if ($nick = username) [Re: firefox] #226102 19/09/10 06:49 AM
Joined: Jul 2006
Posts: 3,729
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,729
$istok, if ($istok(username someone mirc1,$nick,32)) {


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: if ($nick = username) [Re: Wims] #226104 19/09/10 07:17 AM
Joined: Sep 2007
Posts: 202
F
firefox Offline OP
Fjord artisan
OP Offline
Fjord artisan
F
Joined: Sep 2007
Posts: 202
ok thanks

Re: if ($nick = username) [Re: firefox] #226114 19/09/10 05:10 PM
Joined: Jul 2007
Posts: 1,129
T
Tomao Offline
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.

Re: if ($nick = username) [Re: Tomao] #226117 19/09/10 05:46 PM
Joined: Feb 2006
Posts: 546
J
jaytea Offline
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
Re: if ($nick = username) [Re: jaytea] #226130 20/09/10 09:53 AM
Joined: Aug 2010
Posts: 134
T
Thels Offline
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.
Re: if ($nick = username) [Re: Wims] #226169 21/09/10 11:32 PM
Joined: Jan 2007
Posts: 1,156
D
DJ_Sol Offline
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.

Re: if ($nick = username) [Re: DJ_Sol] #226170 21/09/10 11:40 PM
Joined: Jul 2006
Posts: 3,729
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,729
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


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: if ($nick = username) [Re: Wims] #226172 22/09/10 01:05 AM
Joined: Jan 2007
Posts: 1,156
D
DJ_Sol Offline
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.

Re: if ($nick = username) [Re: DJ_Sol] #226177 22/09/10 09:55 AM
Joined: Jul 2006
Posts: 3,729
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,729
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


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net