IRC Stats

By Hyper on Jan 26, 2006

This script will keep track of some statistics for users on IRC. It's fairly basic, but it gets the job done.

Note: Has been improved yet again. :)

; IRC Stats 2.0
; Written by Hyper (Null Productions)
; For help, contact us:
; irc.enterthegame.com #null
; http://nullprod.abacionline.com/forum

on *:TEXT:!ircstats*:#:{
  if (!$2) {
    var %nm = $nick
  }
  else {
    var %nm = $2
  }
  if (!$read(ircstats.txt,w,%nm *)) {
    msg $chan Sorry, $nick $+ , but I do not have any stats info for %nm $+ . Try another name, maybe?
  }
  else {
    var %line = $gettok($read(ircstats.txt,w,%nm *),2-,32)
    tokenize 32 %line
    msg $chan 14,1[3,1IRC Stats for  $+ %nm $+ 14,1] [3,1Lines of text: $iif($1,$1,0) $+ 14,1] [3,1Actions: $iif($2,$2,0) $+ 14,1] [3,1Total Words: $iif($7,$7,0) $+ 14,1] [3,1Users kicked: $iif($3,$3,0) $+ 14,1] [3,1Times kicked out: $iif($4,$4,0) $+ 14,1] [3,1Users Banned: $iif($5,$5,0) $+ 14,1] [3,1Times Banned: $iif($6,$6,0) $+ 14,1]
  }
}
on *:TEXT:*:#:{
  var %line = $gettok($read(ircstats.txt,w,$nick *),2-,32), %words = $numtok($1-,32)
  tokenize 32 %line
  if (!$read(ircstats.txt,w,$nick *)) {
    write ircstats.txt $nick 1 0 0 0 0 0 %words
  }
  else {
    write -dw" $+ $nick *" ircstats.txt
    write ircstats.txt $nick $calc($1 + 1) $2-6 $calc($7 + %words)
  }
}
on *:ACTION:*:#:{
  var %line = $gettok($read(ircstats.txt,w,$nick *),2-,32), %words = $numtok($1-,32)
  tokenize 32 %line
  if (!$read(ircstats.txt,w,$nick *)) {
    write ircstats.txt $nick 0 1 0 0 0 0 %words
  }
  else {
    write -dw" $+ $nick *" ircstats.txt
    write ircstats.txt $nick $1 $calc($2 + 1) $3-6 $calc($7 + %words)
  }
}
on *:KICK:#:{
  var %line = $gettok($read(ircstats.txt,w,$nick *),2-,32)
  tokenize 32 %line
  if (!$read(ircstats.txt,w,$nick *)) {
    write ircstats.txt $nick 0 0 1 0 0 0 0
  }
  else {
    write -dw" $+ $nick *" ircstats.txt
    write ircstats.txt $nick $1-2 $calc($3 + 1) $4-
  }
  %line = $gettok($read(ircstats.txt,w,$knick *),2-,32)
  tokenize 32 %line
  if (!$read(ircstats.txt,w,$knick *)) {
    write ircstats.txt $knick 0 0 0 1 0 0 0
  }
  else {
    write -dw" $+ $knick *" ircstats.txt
    write ircstats.txt $knick $1-3 $calc($4 + 1) $5-
  }
}
on *:BAN:#:{
  var %line = $gettok($read(ircstats.txt,w,$nick *),2-,32)
  tokenize 32 %line
  if (!$read(ircstats.txt,w,$nick *)) {
    write ircstats.txt $nick 0 0 0 0 1 0 0
  }
  else {
    write -dw" $+ $nick *" ircstats.txt
    write ircstats.txt $nick $1-4 $calc($5 + 1) $6-
  }
  var %i = 1
  while ($nick($chan,%i)) {
    if ($banmask iswm $address($nick($chan,%i),5)) {
      %line = $gettok($read(ircstats.txt,w,$nick($chan,%i) *),2-,32)
      tokenize 32 %line
      if (!$read(ircstats.txt,w,$nick($chan,%i) *)) {
        write ircstats.txt $nick($chan,%i) 0 0 0 0 0 1 0
      }
      else {
        write -dw" $+ $nick($chan,%i) *" ircstats.txt
        write ircstats.txt $nick($chan,%i) $1-5 $calc($6 + 1) $7-
      }
    }
    inc %i
  }
}
on *:NICK:{
  var %line = $gettok($read(ircstats.txt,w,$nick *),2-,32)
  tokenize 32 %line
  if (!$read(ircstats.txt,w,$nick *)) {
    write ircstats.txt $newnick 0 0 0 0 0 0 0
  }
  else {
    write -dw" $+ $nick *" ircstats.txt
    write ircstats.txt $newnick $1-
  }
}

Comments

Sign in to comment.
dma   -  Jun 15, 2018

nice one

 Respond  
voops   -  Dec 06, 2013

So is there a way to give the user a total amount of time spent in channel? like tally up the time between each join and part?

 Respond  
Automotive   -  Jun 17, 2009

yeah now i found something useful

 Respond  
napa182   -  Jun 16, 2009

so why spam ur script in his comments?

 Respond  
ScReEmO-KiD   -  Jun 16, 2009

I have made a script based on Hyper's script which uses .ini's instead of .txt's... i have also tried to keep my script as small and simple as possible and yet effective...
http://www.hawkee.com/snippet/6310/

 Respond  
sMILEY4ever   -  Apr 04, 2009

I've got the same problem as inkjet. Any1 has an idea on how to fix this ?

 Respond  
inkjet   -  Apr 17, 2008

Hey great script. I loaded it and have been testing it for a few weeks more, when i look at the ircstats.txt file i notice there is some multiple entries for the same user, can you explain why that might be happening and how I might be able to fix it?

 Respond  
|MELIORITE|   -  May 16, 2007

I like it... even gave it a test run :P

 Respond  
CharltonJ   -  May 16, 2007

Good job!! :)

 Respond  
S*A*U*R*A*B*H   -  May 01, 2007

yea he is write something like !toptalkers

 Respond  
S*A*U*R*A*B*H   -  May 01, 2007

Nice ;x

 Respond  
Muppetz   -  Apr 22, 2006

Good Script ... but I would like to know if you are able to add like a !top10 or something into it ???

 Respond  
greenlanter420   -  Apr 03, 2006

Nice update but you really should change it to 2.5 since you have pretty much overhauled the whole script keep up the good work

 Respond  
Daveoh   -  Feb 27, 2006

Great job

 Respond  
bearruler   -  Feb 03, 2006

I made something to this extent... It used .ini files, was shorter in code, but possibly slower
I recoded it with alot of stats, custom window viewing, a dialog, and hash tables but never uploaded the new one
Maybe I will some day :P

I would definiatly say text files arent the way to go, too messy

Bear

 Respond  
greenlanter420   -  Jan 27, 2006

how about making it so it keeps track of how much time they have spent in the channel and how about a word counter sweet script though just some ideas

 Respond  
DarthReven   -  Jan 27, 2006

rather then using a text file i would sugest using a ini file or a hash table for storing data in the way you are doing

 Respond  
No0ne   -  Jan 26, 2006

Good job mate.

 Respond  
Midnight   -  Jan 26, 2006

Lewx gewd.

 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.