mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jul 2007
Posts: 66
B
beer Offline OP
Babel fish
OP Offline
Babel fish
B
Joined: Jul 2007
Posts: 66
Hi. How would you ignore channel text from users that start with say 10 spaces? For example:

Code:
<userA> 123456789012345
<userB>           ignore this line
<userC> more text

I'd want to ignore the line from userB.

I tried:

on ^*:text:*:#test:{ if ($regex($1-,^(\s){10,})) { haltdef } }

But it didn't seem to work.
Thanks for the help guys!

Last edited by beer; 14/10/17 08:02 PM.
Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
Code:
on *:TEXT:*:#:{
  echo -s $1-
  echo -s $replace($rawmsg,$chr(32),+) / $replace($1-,$chr(32),+)
}

This shows that using $1- strips out leading/trailing/extra spaces, so your regex never had a chance.

Joined: Jul 2007
Posts: 66
B
beer Offline OP
Babel fish
OP Offline
Babel fish
B
Joined: Jul 2007
Posts: 66
So if $1- filters out leading whitespace, how do you check for it? Is it even possible using on:text?

Thanks

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
I just showed you that $rawmsg retains it. The display message begins after the 2nd colon, but as soon as you transfer it to another %variable or send the output through something like $1- or $gettok, the result no longer has the consecutive/leading/trailing spaces in it.

Joined: Jul 2007
Posts: 66
B
beer Offline OP
Babel fish
OP Offline
Babel fish
B
Joined: Jul 2007
Posts: 66
Originally Posted By: maroon
I just showed you that $rawmsg retains it. The display message begins after the 2nd colon, but as soon as you transfer it to another %variable or send the output through something like $1- or $gettok, the result no longer has the consecutive/leading/trailing spaces in it.


I tried:

if ($regex($rawmsg,$chr(32){15,})) { haltdef }

but that just gave me:
Code:
* /if: ':test!test@2610:111:a20::2 PRIVMSG #test :               15 15 15 15 ' unknown operator (line 14, remote.ini)


in the server window. So then I tried:

if ($chr(32){15,} isin $rawmsg) { haltdef }

but didn't do anything at all, which still wouldn't have checked for leading spaces even if it did.

You mentioned the display message begins after the 2nd colon but that doesn't appear to be consistent since ipv6 adds an extra 4. If you can't keep the spaces storing $rawmsg in a variable, then I couldn't even cut $rawmsg at say "$chan :" and store it in a variable.

Unfortunately my non-scripting self feels even farther away from a solution.

Last edited by beer; 15/10/17 03:16 AM.
Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
Try $regex($rawmsg,\s{15})

That finds long stretch anywhere within the message, not just the front.
Inside the ON TEXT event, you can see the ASCII values contents of $rawmsg with:

bset -ta &bvar 1 $rawmsg
echo -s $bvar(&bvar,1-)

I didn't expect to see colons in a hostname, so i guess the next part is to look for the first occurence of $chan followed by space then by colon.

Joined: Jul 2007
Posts: 66
B
beer Offline OP
Babel fish
OP Offline
Babel fish
B
Joined: Jul 2007
Posts: 66
Doing:

if ($regex($rawmsg,\s{15,})) { haltdef }

gave me:

Code:
* /if: ':test!test@2610:111:a20::2 PRIVMSG #test :               15' unknown operator (line 16, remote.ini)


in the server window. It seems like that should've worked. frown

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
It doesn't like that extra comma there, so you'll have to do something like:

var %temp \s{15,}
if ($regex($rawmsg,%temp)) { haltdef }

Joined: Jul 2007
Posts: 66
B
beer Offline OP
Babel fish
OP Offline
Babel fish
B
Joined: Jul 2007
Posts: 66
That did the trick! Thank you for all your help maroon!


Link Copied to Clipboard