Channel Stats

By Scakk on Jan 17, 2011

This keeps track of words used in normal text and in action ( emotes ). It also tracks notices , nick changes , joins , parts and quits. It tracks them per nick and per channel.

It will work in 1 remote so no need to split it apart from itself.

A few examples below and the way to use it.

[23:49] !hcount
[23:49] Options are W (text), E (emote), J (join), P (part), Q (quit)
[23:49] Options are NI (nick), NO (notice), H (for help)
[23:49] The top 3 can be found using above except use top or topc for the top 3 list.
[23:49] Example: !wcount or !wcount nick , !<letter(s)>count topc/top

[00:10] !wcount ShadowGoof
[00:10] Text count for "ShadowGoof" is 4,117
[00:11] !wcount #back-lot
[00:11] Text count for "#back-lot" is 1,156
[00:11] !wcount top
[00:11] [Text] [1] napa182 40,767 [2] Hawkee_Watcher 37,311 [3] Sick0 21,250
[00:11] !wcount topc
[00:11] [Text] [1] #Hawkee_Watcher 87,834 [2] #Lobby 76,072 [3] #goofstavern 12,000

on *:text:!*count*:#: {
  $InfoTracker($event,$nick,$chan,$0)
  if ($mid($1,2,1) = h) { 
    msg $chan Options are W (text), E (emote), J (join), P (part), Q (quit)
    msg $chan Options are NI (nick), NO (notice), H (for help)     
    msg $chan The top 3 can be found using above except use top or topc for the top 3 list.
    msg $chan Example: !wcount or !wcount nick , !<letter(s)>count topc/top
  }
  var %person $iif($2,$2,$nick)
  if ($istok(w e j q p,$mid($1,2,1),32)) {
    var %letter $replace($mid($1,2,1),e,Action,w,Text,j,Join,q,Quit,p,Part)
    if ($istok(top topc,$2,32)) { $InfoTrackerTop(%letter,$2,$chan) }
    else {
      if ($left($2,1) != $chr(35)) { msg $chan %letter count for $qt(%person) is $comma($iif($hget(IT $+ %letter,%person),$v1,0)) }
      if ($left($2,1) == $chr(35)) { msg $chan %letter count for $qt(%person) is $comma($iif($hget(ITC $+ %letter,%person),$v1,0)) }
    }
  }
  if ($istok(ni no,$mid($1,2,2),32)) {
    var %letter $replace($mid($1,2,2),ni,Nick,no,Notice)
    if ($istok(top topc,$2,32)) { $InfoTrackerTop(%letter,$2,$chan) }
    else {
      if ($left($2,1) != $chr(35)) { msg $chan %letter $iif($mid($1,2,2) = ni,change) count for $qt(%person) is $comma($iif($hget(IT $+ %letter,%person),$v1,0)) }
      if ($left($2,1) == $chr(35)) { msg $chan %letter $iif($mid($1,2,2) = ni,change) count for $qt(%person) is $comma($iif($hget(ITC $+ %letter,%person),$v1,0)) }
    }
  }
}
; $InfoTrackerTop($1,$2,$chan)
; $1 = %letter , $2 = top or topc
alias InfoTrackerTop {
  var %top $iif($2 = topc,ITC,IT) $+ $1
  var %d = 1 | window -hn $+(@,%top)
  while $hget(%top,%d).item { aline $+(@,%top) $v1 $hget(%top,$v1) | inc %d }
  filter -cteuww 2 32 $+(@,%top) $+(@,%top)
  msg $chan $+([,$1,]) $&
    [1] $iif($line($+(@,%top),1),$gettok($v1,1,32) $comma($gettok($v1,2,32)),None) $&
    [2] $iif($line($+(@,%top),2),$gettok($v1,1,32) $comma($gettok($v1,2,32)),None) $&
    [3] $iif($line($+(@,%top),3),$gettok($v1,1,32) $comma($gettok($v1,2,32)),None)
  window -c $+(@,%top)
}
;Usage: $comma(number)
alias comma { 
  var %a, %b = $regsub($ticks,$$1,/\G([+-]?\d+?)(?=(?:\d{3})++(?=\.\d++$|$))/g,\1 $+ $chr(44),%a) 
  return %a 
}
on *:text:*:#: { $InfoTracker($event,$nick,$chan,$0) }
on *:action:*:#: { $InfoTracker($event,$nick,$chan,$0) }
on *:notice:*:*: { 
  hinc -m IT $+ $event $nick $0 | InfoTrackerSave
  var %t 1 | while $comchan($nick,%t) { $InfoTracker($event,$v1,$0) | inc %t }
} 
on *:part:*: { $InfoTracker($event,$nick,$chan) }
on *:join:*: { $InfoTracker($event,$nick,$chan) }
on *:quit: { 
  hinc -m IT $+ $event $nick 1 | InfoTrackerSave
  var %t 1 | while $comchan($nick,%t) { $InfoTracker($event,$v1) | inc %t } 
}
on *:nick: { $InfoTracker($event,$nick) }
; Usage: $InfoTracker($event,$nick,$chan,$0)
alias InfoTracker {
  if ($1 = nick) { hinc -m IT $+ $1 $2 1 }
  if ($1 = notice) { hinc -m ITC $+ $1 $2 $3 }
  if ($istok(text action,$1,32)) { hinc -m IT $+ $1 $2 $4 | hinc -m ITC $+ $1 $3 $4 }
  if ($istok(join part quit,$1,32)) { 
    if ($istok(join part,$1,32)) { hinc -m IT $+ $1 $2 1 | hinc -m ITC $+ $1 $3 1 }
    if ($1 = quit) { hinc -m ITC $+ $1 $2 1 }
  }
  InfoTrackerSave
}
alias InfoTrackerSave {
  hsave ITtext ITtext.hsh | hsave ITquit ITquit.hsh
  hsave ITjoin ITjoin.hsh | hsave ITnotice ITnotice.hsh
  hsave ITpart ITpart.hsh | hsave ITaction ITaction.hsh
  hsave ITnick ITnick.hsh | hsave ITCtext ITCtext.hsh
  hsave ITCquit ITCquit.hsh | hsave ITCjoin ITCjoin.hsh
  hsave ITCnotice ITCnotice.hsh | hsave ITCpart ITCpart.hsh
  hsave ITCaction ITCaction.hsh | hsave ITCnick ITCnick.hsh
}

Comments

Sign in to comment.
Jethro   -  Jun 18, 2012

chachin, replace the existing "InfoTrackerSave" alias with this one and retry:

alias -l infotrackersave {
var %e = $event
if ($hget($+(IT,%e))) {
hsave $+(IT,%e) $+(IT,%e,.hsh)
}
else {
hmake $+(IT,%e) 100
hsave $+(IT,%e) $+(IT,%e,.hsh)
}
}
 Respond  
chachin   -  Jun 18, 2012

any news for this script?

 Respond  
chachin   -  Apr 11, 2012

its happening to me too..

  • /hsave: no such table 'ITquit' (line 81, chanstat.mrc)
 Respond  
Jethro   -  Aug 04, 2011

NwoChat, the reason you had that error was that the hash tables weren't made before they could be saved.

 Respond  
NwoChat   -  Aug 04, 2011

Loaded this script up and I'm not sure what's wrong here. I am getting * /hsave: no such table 'ITtext' (line 70, stats.cfg)

Any word on what all the commands are etc?

 Respond  
Scakk   -  Jan 24, 2011

Here you go

on *:text:!*count*:#: {
  $InfoTracker($event,$nick,$chan,$0)
  if ($mid($1,2,1) = h) { 
    msg $chan Options are W (text), E (emote), J (join), P (part), Q (quit)
    msg $chan Options are NI (nick), NO (notice), H (for help)     
    msg $chan The top 3 can be found using above except use top or topc for the top 3 list.
    msg $chan Example: !wcount or !wcount nick , !<letter(s)>count topc/top
  }
  var %person $iif($2,$2,$nick)
  if ($istok(w e j q p,$mid($1,2,1),32)) {
    var %letter $replace($mid($1,2,1),e,Action,w,Text,j,Join,q,Quit,p,Part)
    if ($istok(top topc,$2,32)) { $InfoTrackerTop(%letter,$2,$chan) }
    else {
      if ($left($2,1) != $chr(35)) { msg $chan %letter count for $qt(%person) is $comma($iif($hget(IT $+ %letter,%person),$v1,0)) }
      if ($left($2,1) == $chr(35)) { msg $chan %letter count for $qt(%person) is $comma($iif($hget(ITC $+ %letter,%person),$v1,0)) }
    }
  }
  if ($istok(ni no,$mid($1,2,2),32)) {
    var %letter $replace($mid($1,2,2),ni,Nick,no,Notice)
    if ($istok(top topc,$2,32)) { $InfoTrackerTop(%letter,$2,$chan) }
    else {
      if ($left($2,1) != $chr(35)) { msg $chan %letter $iif($mid($1,2,2) = ni,change) count for $qt(%person) is $comma($iif($hget(IT $+ %letter,%person),$v1,0)) }
      if ($left($2,1) == $chr(35)) { msg $chan %letter $iif($mid($1,2,2) = ni,change) count for $qt(%person) is $comma($iif($hget(ITC $+ %letter,%person),$v1,0)) }
    }
  }
}
; $InfoTrackerTop($1,$2,$chan)
; $1 = %letter , $2 = top or topc
alias InfoTrackerTop {
  var %top $iif($2 = topc,ITC,IT) $+ $1
  var %d = 1 | window -hn $+(@,%top)
  while $hget(%top,%d).item { aline $+(@,%top) $v1 $hget(%top,$v1) | inc %d }
  filter -cteuww 2 32 $+(@,%top) $+(@,%top)
  msg $chan $+([,$1,]) $&
    [1] $iif($line($+(@,%top),1),$gettok($v1,1,32) $comma($gettok($v1,2,32)),None) $&
    [2] $iif($line($+(@,%top),2),$gettok($v1,1,32) $comma($gettok($v1,2,32)),None) $&
    [3] $iif($line($+(@,%top),3),$gettok($v1,1,32) $comma($gettok($v1,2,32)),None)
  msg $chan $+([,$1,]) $&
    [4] $iif($line($+(@,%top),4),$gettok($v1,1,32) $comma($gettok($v1,2,32)),None) $&
    [5] $iif($line($+(@,%top),5),$gettok($v1,1,32) $comma($gettok($v1,2,32)),None) $&
    [6] $iif($line($+(@,%top),6),$gettok($v1,1,32) $comma($gettok($v1,2,32)),None)
  msg $chan $+([,$1,]) $&
    [7] $iif($line($+(@,%top),7),$gettok($v1,1,32) $comma($gettok($v1,2,32)),None) $&
    [8] $iif($line($+(@,%top),8),$gettok($v1,1,32) $comma($gettok($v1,2,32)),None) $&
    [9] $iif($line($+(@,%top),9),$gettok($v1,1,32) $comma($gettok($v1,2,32)),None)
  msg $chan $+([,$1,]) $&
    [10] $iif($line($+(@,%top),10),$gettok($v1,1,32) $comma($gettok($v1,2,32)),None)
  window -c $+(@,%top)
}
;Usage: $comma(number)
alias comma { 
  var %a, %b = $regsub($ticks,$$1,/\G([+-]?\d+?)(?=(?:\d{3})++(?=\.\d++$|$))/g,\1 $+ $chr(44),%a) 
  return %a 
}
on *:text:*:#: { $InfoTracker($event,$nick,$chan,$0) }
on *:action:*:#: { $InfoTracker($event,$nick,$chan,$0) }
on *:notice:*:*: { 
  hinc -m IT $+ $event $nick $0 | InfoTrackerSave
  var %t 1 | while $comchan($nick,%t) { $InfoTracker($event,$v1,$0) | inc %t }
} 
on *:part:*: { $InfoTracker($event,$nick,$chan) }
on *:join:*: { $InfoTracker($event,$nick,$chan) }
on *:quit: { 
  hinc -m IT $+ $event $nick 1 | InfoTrackerSave
  var %t 1 | while $comchan($nick,%t) { $InfoTracker($event,$v1) | inc %t } 
}
on *:nick: { $InfoTracker($event,$nick) }
; Usage: $InfoTracker($event,$nick,$chan,$0)
alias InfoTracker {
  if ($1 = nick) { hinc -m IT $+ $1 $2 1 }
  if ($1 = notice) { hinc -m ITC $+ $1 $2 $3 }
  if ($istok(text action,$1,32)) { hinc -m IT $+ $1 $2 $4 | hinc -m ITC $+ $1 $3 $4 }
  if ($istok(join part quit,$1,32)) { 
    if ($istok(join part,$1,32)) { hinc -m IT $+ $1 $2 1 | hinc -m ITC $+ $1 $3 1 }
    if ($1 = quit) { hinc -m ITC $+ $1 $2 1 }
  }
  InfoTrackerSave
}
alias InfoTrackerSave {
  hsave ITtext ITtext.hsh | hsave ITquit ITquit.hsh
  hsave ITjoin ITjoin.hsh | hsave ITnotice ITnotice.hsh
  hsave ITpart ITpart.hsh | hsave ITaction ITaction.hsh
  hsave ITnick ITnick.hsh | hsave ITCtext ITCtext.hsh
  hsave ITCquit ITCquit.hsh | hsave ITCjoin ITCjoin.hsh
  hsave ITCnotice ITCnotice.hsh | hsave ITCpart ITCpart.hsh
  hsave ITCaction ITCaction.hsh | hsave ITCnick ITCnick.hsh
}
 Respond  
Jenny   -  Jan 24, 2011

Is it possible that you can give me the complete script as it would be with the top10 please?

 Respond  
Scakk   -  Jan 20, 2011

Change the instances of "htsave" in the save alias to be "hsave" instead.

 Respond  
x1L22   -  Jan 20, 2011

HTSAVE Unknown command

HTSAVE Unknown command
I received an error like this

:S

 Respond  
Scakk   -  Jan 19, 2011

@Jenny

To reset the info just do -> /hfree -w IT*

For a 10 ten list use the below bit for the InfoTrackerTop alias.

alias InfoTrackerTop {
  var %top $iif($2 = topc,ITC,IT) $+ $1
  var %d = 1 | window -hn $+(@,%top)
  while $hget(%top,%d).item { aline $+(@,%top) $v1 $hget(%top,$v1) | inc %d }
  filter -cteuww 2 32 $+(@,%top) $+(@,%top)
  msg $chan $+([,$1,]) $&
    [1] $iif($line($+(@,%top),1),$gettok($v1,1,32) $comma($gettok($v1,2,32)),None) $&
    [2] $iif($line($+(@,%top),2),$gettok($v1,1,32) $comma($gettok($v1,2,32)),None) $&
    [3] $iif($line($+(@,%top),3),$gettok($v1,1,32) $comma($gettok($v1,2,32)),None)
  msg $chan $+([,$1,]) $&
    [4] $iif($line($+(@,%top),4),$gettok($v1,1,32) $comma($gettok($v1,2,32)),None) $&
    [5] $iif($line($+(@,%top),5),$gettok($v1,1,32) $comma($gettok($v1,2,32)),None) $&
    [6] $iif($line($+(@,%top),6),$gettok($v1,1,32) $comma($gettok($v1,2,32)),None)
  msg $chan $+([,$1,]) $&
    [7] $iif($line($+(@,%top),7),$gettok($v1,1,32) $comma($gettok($v1,2,32)),None) $&
    [8] $iif($line($+(@,%top),8),$gettok($v1,1,32) $comma($gettok($v1,2,32)),None) $&
    [9] $iif($line($+(@,%top),9),$gettok($v1,1,32) $comma($gettok($v1,2,32)),None)
  msg $chan $+([,$1,]) $&
    [10] $iif($line($+(@,%top),10),$gettok($v1,1,32) $comma($gettok($v1,2,32)),None) 
  window -c $+(@,%top)
}
 Respond  
Jenny   -  Jan 19, 2011

Just a few questions Scakk: Can u reset everything for instance every month?
Can u change it to show a top10?
Thnx :)

 Respond  
GuitarMasterx7   -  Jan 19, 2011

ohh very nice

 Respond  
napa182   -  Jan 17, 2011

nice work Scakk, I like how you made this.
9/10 +like

Oh and LMAO @ [Text] [1] napa182 40,767

 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.