Channel Word/Phrase Watcher

By Resinator on Sep 05, 2014

Watch channels for a word or phrase and have it sent to a @Window or echo into your active channel. Main sends each term to a window named with the search term. Alternate method sends all of the search terms to a single @Window. Once loaded just right click in a channel window to change/view settings found under ChanWatch.

Just load into mirc and select yes to allow it to run the initial setup and you're ready to catch all the things u were missing. :)

Updated to replace periods with spaces in case u add phrases with spaces but are trying to catch announcements with periods instead of spaces as well as announcements with spaces. :D (Lines 12 and 23)

; Channel Watch script by Resinator
; Just load into mIRC and when it asks to initialize click 'yes'
; enter watch channels and search terms when it asks
; right click in a channel and look under 'ChanWatch' for options :)
; all variables stored in variables beginning with %cw.

on *:LOAD:cwsetup
on *:TEXT:*:*:{
  if ($chan !isin %cw.chans) { halt }
  %cw.c = 1
  while (%cw.c <= $numtok(%cw.watch,44)) {
    if ($gettok(%cw.watch,%cw.c,44) isin $replace($1-,$chr(46),$chr(32))) {
      if ($gettok(%cw.set,1,44) == on) {
        window -nz @ [ $+ [ $gettok(%cw.watch,%cw.c,44) ] ]
        aline @ [ $+ [ $gettok(%cw.watch,%cw.c,44) ] ] $timestamp < $+ $nick $+ > $1- $+(-7,$chan,-)
      }
      if ($gettok(%cw.set,2,44) == on) { echo 4 $active $+(***,$gettok(%cw.set,3,44),***) < $+ $nick $+ > $1- $+(-7,$chan,-) }
    }
    inc %cw.c
  }
  %cw.c = 1
  while (%cw.c <= $numtok(%cw.watch2,44)) {
    if ($gettok(%cw.watch2,%cw.c,44) isin $replace($1-,$chr(46),$chr(32))) {
      if ($gettok(%cw.set2,1,44) == on) {
        window -nz [ @ $+ [ $gettok(%cw.set2,4,44) ] ]
        aline [ @ $+ [ $gettok(%cw.set2,4,44) ] ] $timestamp < $+ $nick $+ > $1- $+(-7,$chan,-) 
      }
      if ($gettok(%cw.set2,2,44) == on) { echo 4 $active $+(***,$gettok(%cw.set2,3,44),***) < $+ $nick $+ > $1- $+(-7,$chan,-) }
    }
    inc %cw.c
  }
  unset %cw.c
}
Menu channel {
  ChanWatch
  .Main
  ..$iif($gettok(%cw.set,1,44) == on,$style(1),$style(0)) @Window:$iif($gettok(%cw.set,1,44) == on,set %cw.set $puttok(%cw.set,off,1,44),set %cw.set $puttok(%cw.set,on,1,44))
  ..$iif($gettok(%cw.set,2,44) == on,$style(1),$style(0)) Active:$iif($gettok(%cw.set,2,44) == on,set %cw.set $puttok(%cw.set,off,2,44),set %cw.set $puttok(%cw.set,on,2,44))
  ..Change Echo String ( $+ $gettok(%cw.set,3,44) $+ ):set %cw.set $puttok(%cw.set,$$?"Enter custom ChanWatch window title.",3,44)
  ..Add:set %cw.watch $addtok(%cw.watch,$$?="Enter search terms to add - seperated with commas.",44) | echo 4 $active Watched Items: %cw.watch
  ..Delete:set %cw.watch $remtok(%cw.watch,$$?="Enter search term to remove.",1,44) | echo 4 $active Watched Items: %cw.watch
  ..Current Search Terms:echo 4 $active Watched Items: %cw.watch
  ..Windows named with search term
  .Alt
  ..$iif($gettok(%cw.set2,1,44) == on,$style(1),$style(0)) @Window:$iif($gettok(%cw.set2,1,44) == on,set %cw.set2 $puttok(%cw.set2,off,1,44),set %cw.set2 $puttok(%cw.set2,on,1,44))
  ..$iif($gettok(%cw.set2,2,44) == on,$style(1),$style(0)) Active:$iif($gettok(%cw.set2,2,44) == on,set %cw.set2 $puttok(%cw.set2,off,2,44),set %cw.set2 $puttok(%cw.set2,on,2,44))
  ..Change Window Title ( $+ $gettok(%cw.set2,4,44) $+ ):set %cw.set2 $puttok(%cw.set2,$$?"Enter custom ChanWatch window title.",4,44)
  ..Change Echo String ( $+ $gettok(%cw.set2,3,44) $+ ):set %cw.set2 $puttok(%cw.set2,$$?"Enter custom ChanWatch window title.",3,44)
  ..Add:set %cw.watch2 $addtok(%cw.watch2,$$?="Enter search terms to add - seperated with commas.",44) | echo 4 $active Watched Items: %cw.watch2
  ..Delete:set %cw.watch2 $remtok(%cw.watch2,$$?="Enter search term to remove.",1,44) | echo 4 $active Watched Items: %cw.watch2
  ..Current Search Terms:echo 4 $active Watched Items: %cw.watch2
  .Current Chans:echo 4 $active Current Watched Channels: %cw.chans
  .Add Chan:set %cw.chans $addtok(%cw.chans,$??="Enter chans seperated with spaces.",32) | echo 4 $active Currently watched channels: %cw.chans
  .Del Chan:set %cw.chans $remtok(%cw.chans,$??="Enter 1 chan at a time plz.",1,32) | echo 4 $active Currently watched channels: %cw.chans
}
alias cwsetup {
  set %cw.chans $$?="Enter channels to watch seperated with spaces."
  set %cw.watch $$?="Enter terms to search for, seperated with commas. Windows named with each term."
  set %cw.watch2 $$?="Enter terms to search for, seperated with commas. Alternate search, each item goes to 1 custom named window."
  set %cw.set on,on,ChanWatch
  set %cw.set2 on,on,ChanWatch2,ChanWatch
}

Comments

Sign in to comment.
Zaunpfahl   -  Sep 13, 2014

Lovely little script, however I am missing one vital information: who said the word I'm looking for? I want to use it as a "highlight rememberer" so to speak, for while I am not at my PC or not in chat to quickly get an overview if someone asked for me. With a name I could get back to them quickly. I tried adding the nickname myself, but more or less just broke the script by doing so. Is there an (easy) way?

Resinator  -  Sep 14, 2014

I've fixed the script in the sections where it sends the highlight to include nickname. Lines 17 and 28 contain the echo commands that would echo it to your active window, in which I added < $+ $nick $+ > before $1-. Could be shortened with $+(<,$nick,>) as well. And lines 15 and 26 have also been updated to include the nickname before the text highlighted.

Sign in to comment

Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.