mIRC Homepage
Posted By: Caveman Check chr length - 27/01/11 11:07 AM
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

Posted By: Wims Re: Check chr length - 27/01/11 11:10 AM
/help $len
Posted By: Caveman Re: Check chr length - 27/01/11 11:21 AM
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
Posted By: Wims Re: Check chr length - 27/01/11 11:29 AM
Quote:
if $6 doesn;t match 33 characters in length
if ($len($6) != 33) { do something }
Posted By: Caveman Re: Check chr length - 27/01/11 11:36 AM
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.

Posted By: 5618 Re: Check chr length - 27/01/11 11:43 AM
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.
Posted By: Caveman Re: Check chr length - 27/01/11 12:03 PM
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.
Posted By: Tomao Re: Check chr length - 27/01/11 09:34 PM
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.
© mIRC Discussion Forums