mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Dec 2006
Posts: 23
L
l0GicAL Offline OP
Ameglian cow
OP Offline
Ameglian cow
L
Joined: Dec 2006
Posts: 23
Hello,

I have this line in my script:

Code:
  if ($nick == JohnDoe)



...but sometimes, the nick of the bot JohnDoe changes to JohnDoe1 or JohnDoe2 or JohnDoe3 then back again to JohnDoe and so on and so forth.

I tried doing:

Code:
  if ($nick == John*)



...and obviously it doesn't work. Any help?


Thanks...

Joined: Feb 2005
Posts: 342
R
Fjord artisan
Offline
Fjord artisan
R
Joined: Feb 2005
Posts: 342
You're looking for the operator "iswm" (stands for "is wildmatch").
Please type: /help if then else, in mIRC. Browse through the list, under "The Operators."

Code:
if (John* iswm $nick) { }


It may be better to use this persons hostmask or address instead of using his nick.

Such as:

Code:
if (*!*ident@*.some.host.com iswm $fulladdress) { }



Joined: Mar 2007
Posts: 60
S
Babel fish
Offline
Babel fish
S
Joined: Mar 2007
Posts: 60
A quick and more secure way to do this would be to use

Code:
if ($address($nick,2) = ADDRESS OF JohnDoe) { ... } 


"In order to succeed, your desire for success should be greater than your fear of failure."
Joined: Feb 2005
Posts: 342
R
Fjord artisan
Offline
Fjord artisan
R
Joined: Feb 2005
Posts: 342
Originally Posted By: Spitfire3292
A quick and more secure way to do this would be to use

Code:
if ($address($nick,2) = ADDRESS OF JohnDoe) { ... } 


Actually, if you're going to do that, you'd want to use:

Code:
if ($wildsite == *!*@address.of.johndoe.com) { ... }

or
Code:
if ($site == address.of.johndoe.com) { ... } 


If the person has a static IP/Host, using a static match is fine. If the persons address changes often (such as the person being on 56k), you would want to use my suggestion in my first post.

$fulladdress returns nick!ident@hostmask.com
$wildsite returns *!*@hostmask.com
$site returns hostmask.com

Last edited by Rand; 30/03/07 03:38 AM.
Joined: Dec 2002
Posts: 2,031
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,031
You could also do...

if ($left($nick,7) === JohnDoe)

Joined: Dec 2006
Posts: 23
L
l0GicAL Offline OP
Ameglian cow
OP Offline
Ameglian cow
L
Joined: Dec 2006
Posts: 23
Thanks for all the replies!

I think I'm gonna use this one:

Code:
if (John* iswm $nick) { }



...instead of using the hostname because sometimes, the bot uses its real hostname and sometimes, it uses its vhost.




EDIT: It's working PERFECTLY! Thanks again... smile

Last edited by l0GicAL; 30/03/07 12:37 PM.

Link Copied to Clipboard