mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: May 2008
Posts: 329
A
AWEstun Offline OP
Fjord artisan
OP Offline
Fjord artisan
A
Joined: May 2008
Posts: 329
How would I search a line of TEXT for a key word and if key word is in TEXT, block the whole line from being output to the channel?

on *:TEXT:*:#:{
var %words = www,http,net,com
...


I registered; you should too.
Joined: Dec 2002
Posts: 3,138
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
/help Halting Default Text

Joined: May 2008
Posts: 329
A
AWEstun Offline OP
Fjord artisan
OP Offline
Fjord artisan
A
Joined: May 2008
Posts: 329
I already have a regular 'on *:TEXT:*:#:' so can I have a 'on ^*:TEXT:*:#:' before the regular one? In the 'on ^*:TEXT:*:#:' then I would use 'if (www isin $1-) { return }'? Would this 'squash' the line of text from showing?


I registered; you should too.
Joined: Dec 2002
Posts: 3,138
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
Try it, but you'd use halt or haltdef not return.

Joined: May 2008
Posts: 329
A
AWEstun Offline OP
Fjord artisan
OP Offline
Fjord artisan
A
Joined: May 2008
Posts: 329
Is there an easier way then using 10-15 if statements to halt?


I registered; you should too.
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
You can store the words in %words like

%words www|http|com|net

then use a regular expression in the <matchtext> field (adding the $ prefix too):

on $^*:text:$($+(/,%words,/iS)):#: halt

Or you can put the words in a hash table (an item being a word surrounded by *'s, eg /hadd words *www*) and then check $hfind(words,$strip($1-),1,W) in the on TEXT event.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Joined: May 2008
Posts: 329
A
AWEstun Offline OP
Fjord artisan
OP Offline
Fjord artisan
A
Joined: May 2008
Posts: 329
Will this also trigger in a wildcard fashion, as if for example www is in wrgvretvwwwsdfgwerb?


I registered; you should too.
Joined: Aug 2005
Posts: 1,052
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
not if you use the regular expression method shown above.


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
Joined: May 2008
Posts: 329
A
AWEstun Offline OP
Fjord artisan
OP Offline
Fjord artisan
A
Joined: May 2008
Posts: 329
Okay, they what do I need to do so that it triggers when a key work is inside a line of text?


I registered; you should too.

Link Copied to Clipboard