Typos Activity Checker

By Typo on Jul 12, 2008

Typos Activity Checker lets you manage the channels you wish to monitor for anything happening such as any text, actions or optionally notices, mode changes, joins or parts. It warns you with a message in the active channel/window and optional beep(s) or playing of a sound file.

It will not send a warning if the last line in the active window was a warning from the same channel unless you have left the current window and returned. This is to avoid warnings stacking up needlessly.

The control panel is where you can select whether or not to monitor for notices, modes, joins or parts. There are also two adjustable times, one sets the time it waits between sending warnings and the other one sets the time it should wait to start sending the warnings after you leave one of the added channels. You can adjust the foreground and background colors for the message it sends when there is activity in a channel. You can also set whether or not to use sounds and if so whether to use default mirc beep(s) that you can configure or a custom sound file.

Enjoy.

Image

;Begin Typos Activity Checker
on *:load:{
  if ($ebeeps == $true) { set %activitychecksounds yes }
  else { set %activitychecksounds no }
  set %activitycheckbeeptimes 3
  set %activitycheckbeepinterval 60
  set %activitychecksoundbeep yes
  set %activitychecksoundfile no
  set %activitychans
  set %activityvisited
  set %activitychecknotices on
  set %activitycheckmodes on
  set %activitycheckjoins on
  set %activitycheckparts on
  set %activitycheckcolor 04,00
  set %waitafterpart 60 
  set %waitafterwarning 240 
  .write ActivityCheckerList.txt
  if ($hget(activitycheckerlist) != activitycheckerlist) { .hmake ActivityCheckerList 20 }

}
on *:start:{ 
  set %activitychans
  set %activityvisited
  .write ActivityCheckerList.txt
  if ($hget(activitycheckerlist) != activitycheckerlist) { .hmake ActivityCheckerList 20 }
  .hload ActivityCheckerList ActivityCheckerList.txt 
}
on *:active:#:{
  unset %activitycheckmessaged* 
  if ($hfind(activitycheckerlist,$lactive) == $lactive) { 
    %ActivityVisited = $addtok(%ActivityVisited,$lactive,32) 
    .timervisited $+ $lactive -o 1 %waitafterpart $chr(37) $+ ActivityVisited = $chr(36) $+ remtok(%ActivityVisited, $lactive ,32)  
  } 
}
on *:text:*:#:{ if ($hfind(activitycheckerlist,$chan) == $chan) { CheckActivity } }
on *:action:*:#:{ if ($hfind(activitycheckerlist,$chan) == $chan) { CheckActivity } }
on *:notice:*:#:{ if ($hfind(activitycheckerlist,$chan) == $chan) && (%activitychecknotices == on) { CheckActivity } }
on *:rawmode:#:{ if ($hfind(activitycheckerlist,$chan) == $chan) && (%activitycheckmodes == on) { checkactivity } }
on *:join:#:{ if ($hfind(activitycheckerlist,$chan) == $chan) && (%activitycheckjoins == on) { checkactivity } }
on *:part:#:{ if ($hfind(activitycheckerlist,$chan) == $chan) && (%activitycheckparts == on) { checkactivity } }
on *:input:#:{ if (%activitycheckmessagedactive == $chan) && ($left($1,1) != /) { unset %activitycheckmessaged* } }
menu nicklist,query,channel,status {
  -
  <[Typos Activity Checker]>:dialog - $+ $iif($dialog(ActivityCheck) == $null,md,ev) ActivityCheck ActivityCheck
  -
}
alias CheckActivity {
  if ($chan != $active) {
    if ($istok(%ActivityChans,$chan,32) != $true) { 
      var %lines = $line($active,0)
      if (%activitycheckmessagedchan != $chan) && ($istok(%ActivityVisited,$chan,32) != $true) {
        %ActivityChans = $addtok(%ActivityChans,$chan,32) 
        .timeractivity $+ $chan -o 1 %waitafterwarning $chr(37) $+ ActivityChans = $chr(36) $+ remtok(%ActivityChans, $chan ,32)
        echo -a $timestamp %activitycheckcolor <Activity Alert> There is activity in $chan $+ !
        if (%activitychecksounds == yes) {
          if (%activitychecksoundbeep == yes) || (%activitychecksoundfile == no) { beep %activitycheckbeeptimes %activitycheckbeepinterval }
          else { splay %activitychecksoundfile }
        }
        set %activitycheckmessagedchan $chan
        set %activitycheckmessagedactive $active
      }
    }
  }
  else { unset %activitycheckmessaged* }
}
alias refreshactivitylist {
  did -r activitycheck 2
  var %ac = $hget(activitycheckerlist,0).item
  while (%ac > 0) {
    did -az ActivityCheck 2 $hget(activitycheckerlist,%ac).item
    dec %ac
  }
}
on *:dialog:ActivityCheck:init:0:{
  refreshactivitylist
  if (%activitychecknotices == on) { did -c activitycheck 14 }
  if (%activitycheckjoins == on) { did -c activitycheck 15 }
  if (%activitycheckparts == on) { did -c activitycheck 16 }
  if (%activitycheckmodes == on) { did -c activitycheck 27 }
  var %temploopynum = 1, %temploopynum2 = 1, %tempcolors = White,Black,Blue,Green,Red,Brown,Purple,Orange,Yellow,Light Green,Cyan,Light Cyan,Light Blue,Pink,Grey,Light Grey
  while (%temploopynum < 3) {
    if (%temploopynum == 1) { var %temploopyvar = 23 }
    elseif (%temploopynum == 2) { var %temploopyvar = 24 }
    while (%temploopynum2 < 17) { 
      did -a activitycheck %temploopyvar $gettok(%tempcolors,%temploopynum2,44)
      inc %temploopynum2
    }
    inc %temploopynum
    var %temploopynum2 1
  }
  var %temploopynum = 1, %temploopynum2 = 1
  while (%temploopynum < 3) {
    if (%temploopynum == 1) { var %temploopyvar = 9, %tempafter = 15,30,45,60,75,90,105,120,135,150,165,180,195,210,225,240 }
    elseif (%temploopynum == 2) { var %temploopyvar = 10, %tempafter = 30,60,90,120,150,180,210,240,270,300,330,360,390,420,450,480 }
    while (%temploopynum2 < $numtok(%tempafter,44)) {
      did -a activitycheck %temploopyvar $replace($duration($gettok(%tempafter,%temploopynum2,44)),min,$chr(32) $+ Minute,secs,$chr(32) $+ Seconds))
      inc %temploopynum2
    }
    inc %temploopynum
    var %temploopynum2 1
  }
  if (%activitycheckcolor != $null) {
    did -c activitycheck 23 $calc($mid(%activitycheckcolor,2,2)+1)
    did -c activitycheck 24 $calc($right(%activitycheckcolor,2)+1)
  }
  var %temploopynum = 1
  while (%temploopynum < 21) {
    did -a activitycheck 40 %temploopynum
    inc %temploopynum
  }
  did -a activitycheck 41 30
  did -a activitycheck 41 60
  did -a activitycheck 41 90
  if (%activitycheckbeeptimes != $null) { did -c activitycheck 40 %activitycheckbeeptimes }
  if (%activitycheckbeepinterval != $null) { did -c activitycheck 41 $didwm(activitycheck,41,%activitycheckbeepinterval) }
  if (%waitafterpart != $null) { did -c ActivityCheck 9 $didwm(activitycheck,9,$replace($duration(%waitafterpart),min,$chr(32) $+ Minute,secs,$chr(32) $+ Seconds)) }
  if (%waitafterwarning != $null) { did -c ActivityCheck 10 $didwm(activitycheck,10,$replace($duration(%waitafterwarning),min,$chr(32) $+ Minute,secs,$chr(32) $+ Seconds)) }
  if (%activitychecksounds == yes) { did -c activitycheck 28 }
  else { did -c activitycheck 29 }
  if (%activitychecksoundbeep == yes) { did -c activitycheck 30 }
  else { did -c activitycheck 31 }
  if (%activitychecksoundfile == no) { did -a activitycheck 35 No sound file has been set. }
  else { did -a activitycheck 35 %activitychecksoundfile }
}
dialog ActivityCheck {
  title "Typos Activity Checker"
  size -1 -1 255 135
  option dbu
  button "Done", 1, 113 125 29 10, default ok cancel
  list 2, 116 58 52 48, sort size vsbar
  edit "", 3, 116 44 52 13, autohs center
  button "Add", 4, 88 47 25 10
  button "Remove", 5, 88 76 25 10
  text "Manage the channels that the script will watch.", 6, 89 31 77 13, center
  text "Set the time that the script will wait after you have left a channel to begin notifying you of activity. Default = 1 Minute", 7, 1 2 82 26, center
  text "Set the time to wait between warnings. Default = 2 minutes.", 8, 2 44 81 13, center
  box "", 11, 0 -2 85 43
  box "", 12, 0 39 85 31
  box "", 13, 85 27 85 81
  check "Trigger on Notices?", 14, 1 111 58 10
  check "Trigger on Joins?", 15, 68 111 54 10
  check "Trigger on Parts?", 16, 133 111 54 10
  box "", 17, 0 106 255 18
  text "Set the message to be displayed when activity is detected.", 21, 1 72 82 14, center
  box "", 22, 0 68 85 40
  combo 23, 5 95 35 11, drop
  combo 24, 45 95 35 11, drop
  text "Foreground", 25, 8 87 30 8, center
  text "Background", 26, 47 87 30 8, center
  check "Trigger on Modes?", 27, 199 111 54 10
  combo 9, 10 29 65 11, drop
  combo 10, 10 57 65 11, drop
  box "", 18, 85 -2 85 31
  text "Select whether or not to use audible warnings.", 19, 89 3 76 14, center
  text "Select betwween default beeps or a custom sound file.", 20, 175 3 76 14, center
  check "Yes", 28, 105 18 20 10
  check "No", 29, 131 18 20 10
  check "Default Mirc Beep.", 30, 185 18 55 8
  check "Custom sound file.", 31, 185 26 55 8
  text "Select the custom sound file.", 32, 174 38 76 8, center
  box "", 33, 170 -2 85 37
  box "", 34, 170 33 85 45
  edit "", 35, 176 66 73 10, read autohs center
  button "Select the sound file.", 36, 185 48 55 8
  text "Current sound file.", 37, 188 58 48 8, center
  box "", 38, 170 76 85 32
  text "Select how many beeps and how long between beeps.", 39, 175 80 76 14, center
  combo 40, 181 96 25 11, drop
  combo 41, 221 96 25 11, drop
}
on *:dialog:ActivityCheck:sclick:1:{
  var %tempcalc $calc($did(23).sel -1), %tempcalc2 = $calc($did(24).sel -1)
  if (%tempcalc == %tempcalc2) { 
    echo -a You cannot set the foreground and background color the same.  Defaults used.
    set %activitycheckcolor 04,00 
  } 
  else { set %activitycheckcolor  $+ $iif($v1 isnum 0-9,0 $+ $v1,$v1) $+ $chr(44) $+ $iif(%tempcalc2 isnum 0-9,0 $+ %tempcalc2,%tempcalc2)) }
  if ($did(activitycheck,9).seltext != $replace($duration(%waitafterpart),min,$chr(32) $+ Minute,secs,$chr(32) $+ Seconds)) { set %waitafterpart $duration($replace($did(ActivityCheck,9).seltext,$chr(32) $+ Minute,min,$chr(32) $+ Seconds,secs)) }
  if ($did(activitycheck,10).seltext != $replace($duration(%waitafterwarning),min,$chr(32) $+ Minute,secs,$chr(32) $+ Seconds)) { set %waitafterwarning $duration($replace($did(ActivityCheck,10).seltext,$chr(32) $+ Minute,min,$chr(32) $+ Seconds,secs)) }
  if ($did(activitycheck,14).state == 1) { set %activitychecknotices on } | else { set %activitychecknotices off }
  if ($did(activitycheck,15).state == 1) { set %activitycheckjoins on } | else { set %activitycheckjoins off }
  if ($did(activitycheck,16).state == 1) { set %activitycheckparts on } | else { set %activitycheckparts off }
  if ($did(activitycheck,27).state == 1) { set %activitycheckmodes on } | else { set %activitycheckmodes off }
  if ($did(activitycheck,30).state == 1) { set %activitychecksoundbeep yes } | else { set %activitychecksoundbeep no }
  if ($did(activitycheck,35) == No sound file has been set.) || ($did(activitycheck,35) == $null) { set %activitychecksoundfile no }
  elseif ($did(activitycheck,35) != %activitychecksoundfile) { set %activitychecksoundfile $did(activitycheck,35) }
  if ($did(activitycheck,28).state == 1) { 
    if ($ebeeps == $true) { set %activitychecksounds yes }
    else { 
      set %activitychecksounds no
      noop $input(Mircs sounds are currently disabled.  To enable them go into options (alt+o) and then the Sounds section and click the check box titles Enable Sounds.,o,Sounds not enabled.) 
    }
  }
  else { set %activitychecksounds no }
  if ($did(activitycheck,40) != %activitycheckbeeptimes) { set %activitycheckbeeptimes $did(activitycheck,40) }
  if ($did(activitycheck,41) != %activitycheckbeepinterval) { set %activitycheckbeepinterval $did(activitycheck,41) }
}
on *:dialog:ActivityCheck:sclick:4:{
  AddActivityChannel $did(3)
  did -r ActivityCheck 3
  refreshactivitylist
}
on *:dialog:ActivityCheck:sclick:5:{
  DeleteActivityChannel $did(2).seltext
  refreshactivitylist  
}
on *:dialog:ActivityCheck:sclick:36:{
  var %tempsound = $sfile($mircdir $+ *.wav,Select a sound file) 
  if ($isfile(%tempsound) == $true) && ($right(%tempsound,4) == .mp3) || ($right(%tempsound,4) == .wav) || ($right(%tempsound,4) == .mid) { 
    set %activitychecksoundfile %tempsound
    did -ra activitycheck 35 %activitychecksoundfile
  }
  else {
    noop $input(That was not a valid sound file.,o,Try again.) 
    set %activitychecksoundfile no
    did -ra activitycheck 35 No sound file has been set.
  }
}
on *:dialog:ActivityCheck:sclick:28:{ did -u activitycheck 29 }
on *:dialog:ActivityCheck:sclick:29:{ did -u activitycheck 28 }
on *:dialog:ActivityCheck:sclick:30:{ did -u activitycheck 31 }
on *:dialog:ActivityCheck:sclick:31:{ did -u activitycheck 30 }
alias AddActivityChannel {
  if ($chan == $null) && ($1 == $null) { var %tempchan = #$$?="Please enter the channel to add." }
  elseif ($chan == $null) { var %tempchan = $1 }
  else { var %tempchan = $chan }
  if ($left(%tempchan,1) != $chr(35)) || ($len(%tempchan) !> 1) { echo -a That is not a valid channel name. }
  elseif ($hfind(ActivityCheckerList,%tempchan) == %tempchan) { echo -a That channel has already been added to your Channel list. }
  else { 
    hadd -m ActivityCheckerList %tempchan %tempchan
    hsave ActivityCheckerList ActivityCheckerList.txt
    if ($dialog(ActivityChecker) != $null) { .timer 1 0 refreshactivitylist }
    echo -a You have added %tempchan to your Channel list.
  }
}
alias DeleteActivityChannel {
  if ($chan == $null) && ($1 == $null) { var %tempchan = #$$?="Please enter the channel to be removed." }
  elseif ($chan == $null) { var %tempchan = $1 }
  else { var %tempchan $chan }
  if ($left(%tempchan,1) != $chr(35)) || ($len(%tempchan) !> 1) { echo -a That is not a valid channel name. }
  elseif ($hfind(ActivityCheckerList,%tempchan) != %tempchan) { echo -a That channel is not in your Channel list. }
  else {
    hdel ActivityCheckerList %tempchan 
    hsave ActivityCheckerList ActivityCheckerList.txt
    if ($dialog(ActivityChecker) != $null) { .timer 1 0 refreshactivitylist }
    echo -a You have removed %tempchan from your Channel list.
  }
}
on *:unload:{
  unset %activitycheckbeep* %activitychecksound* %activitycheckmessaged* %activitycheckcolor %waitafterpart %waitafterwarning %ActivityVisited %ActivityChans %activitycheckmodes %activitychecknotices %activitycheckjoins %activitycheckparts
  .hsave ActivityCheckerList ActivityCheckerList.txt 
  .hfree ActivityCheckerList
}
on *:exit:{
  set %activitychans
  set %activityvisited
  unset %activitycheckmessaged*
  .hsave ActivityCheckerList ActivityCheckerList.txt 
}
;End Typos Activity Checker

Comments

Sign in to comment.
Typo   -  Sep 26, 2008

Wow, there shouldnt be anything not selected or left blank on loading the dialog, I will look into that tomorrow when I get on the computer....well later today rather but I need to get some sleep, or atleast try to right now.

Thanks for the comment and rating again.

 Respond  
^Neptune   -  Sep 26, 2008

lol this is actually quite nice

Although I do think the dialog is a bit messy with the tons of text on it, it works perfectly fine. Try using /did -c $dname id 4 (for the default 2 minutes combo) for like the bits where defaults are used, because then ya don't get a defaultly blank combo. :)

 Respond  
Typo   -  Jul 14, 2008

Updated again. Added sound options. You can enable sounds if you wish and chose between configurable mirc beeps or a custom sound file.

 Respond  
Typo   -  Jul 13, 2008

Ok, new updates added! Time inputs now changed to dropdown boxes with preset options.

Enjoy and once again, if anyone else has any ideas for this just post a comment and chances are I\'ll throw it in.

Edit Updated again. I changed the way it avoids messages stacking up. Before, it used to use $mid to look at the last line in the $active window but this was not dependable due to themes making whats to the left of a timestamp uncertain. I didnt want to use filter to look for a message in the active window so I went a totally different route alltogether. It now uses variables to make sure it isnt stacking identicle messages unless you have left the window and returned(i.e. change the $active window and then went back).

 Respond  
EL   -  Jul 13, 2008

Ok

 Respond  
Typo   -  Jul 13, 2008

And i also suggest for the channels that you let them only add channels there IN at the time OR check to see if that channel even exists on that server/network cause obv theres no reason to watch a channel yur not in or that doesnt exist.
I really don\'t understand your idea about checking the channels.
They may change networks so Im not going to limit the channels they can add or remove and as far as the check goes it uses $hfind so its basically checking if the channel the event happened in is in the list of channels. To start checking if a channel is real before I see if thats where something happened would be a lot of wasted coding, especially considering the On Event\'s will only trigger in a channel that exists obviously, lol.

I\'m going to work on the other idea now, Im going to use drop downs with presets.

 Respond  
EL   -  Jul 12, 2008

Npz man when u get time no big rush;p

 Respond  
Typo   -  Jul 12, 2008

Good ideas, I don\'t have the time at the moment but I\'ll get on fixing it a little later.
Thanks for another usefull comment EL.

 Respond  
EL   -  Jul 12, 2008

Another nice one here Typo.Does what its meant to with np.Mite want to add in the watch notice what event triggered and maybe use scrolling list boxes for the time sets and not edit field because this:

%waitafterpart fdsaf
%waitafterwarning fdsaf

Shouldn\'t be allowed you should if your guna keep the edit fields check to make sure its all numeric an maybe even limit how high they can go.And i also suggest for the channels that you let them only add channels there IN at the time OR check to see if that channel even exists on that server/network cause obv theres no reason to watch a channel yur not in or that doesnt exist.This is a cool idea tho another nice one an i haven\'t had that error again must of been my script.`-.-´

 Respond  
Typo   -  Jul 12, 2008

Enjoy and as usual, any input is more than welcome.

I did a ton of updates to this before uploading it including all the options you can check or uncheck, the color settings, a dialog overhaul and changing the channel list from tokens to has table.

Please report any issues back to me ASAP. I tested it on my mirc and a fresh mirc but one person said they had an issue with the settings in the on load section not getting set. I know the people here can sniff out an error a mile away so even tho I think it was just him I am still mentioning it incase it happens to anyone else.

I\'m heading to bed now (like 7am sadly enough) and will check on this thread as soon as I get up.

Thanks

 Respond  
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.