mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Mar 2005
Posts: 39
B
Ameglian cow
OP Offline
Ameglian cow
B
Joined: Mar 2005
Posts: 39
Hello,
i need some small help on a little code. I'm using the code below to log all lines begining with the word 'Quote' from a FactBot.
This code works fine for my purpose, but I'd also like it to halt (not to log) when certain words are in the phrase.. So something like
if (badword1 isin $2-) || (badword2 isin $2-) || (more isin $2-) { halt | else continue but I can't quite figure out exactly how to do it or where to place it in the script... Need some help please.

Code:
on *:text:*:#factchan: {
  if ($nick $strip($1) == FactBOT Quote) {
      write c:\mIRC\log.txt $2-
   }
}

Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
Code:
on *:text:*:#factchan: {
  if ($nick $strip($1) == FactBOT Quote) && (!$regex($2-,/\b(?:badword1|badword2|badword3|badword4|etc)\b/)) {
    write c:\mIRC\log.txt $2-
  }
}


This way will only match exact words, so somebody could still add a quote with "dickens" in it assuming "dick" is a word in the bad word list.


New username: hixxy
Joined: Mar 2005
Posts: 39
B
Ameglian cow
OP Offline
Ameglian cow
B
Joined: Mar 2005
Posts: 39
Hey, that seems to do it, thanks :-)
What in the regex makes it halt or continue? the \b/ at the end?

Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
Nope, the ! before the $regex means if the regex doesn't match any bad words then it will continue.


New username: hixxy

Link Copied to Clipboard