mIRC Home    About    Download    Register    News    Help

Print Thread
#229246 27/01/11 11:07 AM
Joined: Aug 2005
Posts: 31
C
Caveman Offline OP
Ameglian cow
OP Offline
Ameglian cow
C
Joined: Aug 2005
Posts: 31
Hello..

I was wondering if there was a way I can make mIRC detect whether a certain string didnt match the chr length that I was expecting?

Eg;

Serial of client 'rcmike' is b4c2061e81ed70ca42144d2db10a479b.

I want a script that reports with anything really if $6 doesn;t match 33 characters in length (including the ".")

Many thanks guys


Joined: Jul 2006
Posts: 4,151
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,151
/help $len


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Wims #229248 27/01/11 11:21 AM
Joined: Aug 2005
Posts: 31
C
Caveman Offline OP
Ameglian cow
OP Offline
Ameglian cow
C
Joined: Aug 2005
Posts: 31
That tells me what the length is but I want it to check if it matches the length I want.

Sorry im still new to this

Joined: Jul 2006
Posts: 4,151
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,151
Quote:
if $6 doesn;t match 33 characters in length
if ($len($6) != 33) { do something }


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Wims #229250 27/01/11 11:36 AM
Joined: Aug 2005
Posts: 31
C
Caveman Offline OP
Ameglian cow
OP Offline
Ameglian cow
C
Joined: Aug 2005
Posts: 31
Thats what I tried and I got this

on *:text:*Serial of client*:#ax1-admin: {
if ($len($6) != 33) msg Caveman Test
}

[27 Jan 11 - 11:34:36] <&AXbot1> Serial of client 'Bytchkov' is 43a78c0fac6f1f23b57559f6ba45051e.

[27 Jan 11 - 11:34:36] <Caveman> Test

Its not doing as I asked.

$6 did = 33 characters in length yet it still sent the message.


Joined: Jun 2007
Posts: 933
5
Hoopy frood
Offline
Hoopy frood
5
Joined: Jun 2007
Posts: 933
Maybe there are control codes around $6? Try $strip($6).
Also, do: echo -a $len($6) to check what the actual length is according to mIRC.

5618 #229252 27/01/11 12:03 PM
Joined: Aug 2005
Posts: 31
C
Caveman Offline OP
Ameglian cow
OP Offline
Ameglian cow
C
Joined: Aug 2005
Posts: 31
Originally Posted By: 5618
Maybe there are control codes around $6? Try $strip($6).
Also, do: echo -a $len($6) to check what the actual length is according to mIRC.


That seems to have worked. Thanks very much.

Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
You can do this with a regular expression:
Code:
on $*:text:/(?<=is).{33}.$/iS:#ax1-admin:{
  msg Caveman Test
}
This will check, for instance,
Quote:
43a78c0fac6f1f23b57559f6ba45051e.
to see if it's 33 characters long. If it's exactly 33 chars, it will message Caveman 'test'; if not, nothing is messaged.


Link Copied to Clipboard