Channel Statistics

By Cage on Apr 09, 2006

Okay... so I got bored and decided to write a little channel statistics code. Paste it in the remotes section of your mIRC and upon typing the command !chanstats the script will give you a variety of information concerning the channel that the script has recorded. Type !reset chanstats to reset all the information. Type !lines NICKNAME to see how many lines a given person in the channel has. Easy right? Enjoy.




Note: It now works for multiple channels and servers.

#############################
# Channel Statistics Script #
#      Coded by: Cage       #
#############################

on *:TEXT:!chanstats:#: { 
  if (% [ $+ lines. $+ [ $chan ] $+ . $+ [ $server ] $+ . $+ [ $nick ] ] == $null) { set %lines. $+ $chan $+ . $+ $server $+ . $+ $nick 0 } 
  if (% [ $+ joins. $+ [ $chan ] $+ . $+ [ $server ] ] == $null) { set %joins. $+ $chan $+ . $+ $server 0 }
  if (% [ $+ lastline. $+ [ $chan ] $+ . $+ [ $server ] ] == $null) { set %lastline. $+ $chan $+ . $+ $server Nobody } 
  if (% [ $+ statsdate. $+ [ $chan ] $+ . $+ [ $server ] ] == $null) { set %statsdate. $+ $chan $+ . $+ $server $date }
  if (% [ $+ linestot. $+ [ $chan ] $+ . $+ [ $server ] ] == $null) { set %linestot. $+ $chan $+ . $+ $server 0 }
  if (%waitstats == $null) { 
    msg $chan Statistics for channel $+(,$chan,:,) 
    msg $chan Recorded since: % [ $+ statsdate. $+ [ $chan ] $+ . $+ [ $server ] ]
    msg $chan Total number of lines spoken: % [ $+ linestot. $+ [ $chan ] $+ . $+ [ $server ] ]
    msg $chan There are currently $nick($chan,0) user(s) in this channel.
    msg $chan $+(,% [ $+ lastline. $+ [ $chan ] $+ . $+ [ $server ] ],) was the last person to speak.
    msg $chan You have currently spoken % [ $+ lines. $+ [ $chan ] $+ . $+ [ $server ] $+ . $+ [ $nick ] ] line(s) $nick
    msg $chan $+(,% [ $+ joins. $+ [ $chan ] $+ . $+ [ $server ] ],) people have joined the channel.
    msg $chan Random Line: $read(randomline. $+ $server $+ . $+ $chan $+ .txt)
    set -u5 %waitstats 1
  } 
}

on *:TEXT:!reset chanstats:#: {  
  set %statsdate. $+ $chan $+ . $+ $server $date 
  set %linestot. $+ $chan $+ . $+ $server 0 
  set %lastline. $+ $chan $+ . $+ $server Nobody 
  unset %lines.* 
  write -c randomline. $+ $server $+ . $+ $chan $+ .txt 
  msg $chan Statistics for $chan has been reset. 
}  

on *:TEXT:!lines*:#: {
  if (% [ $+ lines. $+ [ $chan ] $+ . $+ [ $server ] $+ . $+ [ $2 ] ] == $null) { msg $chan $2 hasn't said anything in this channel yet. } 
  else { msg $chan $2 has currently spoken % [ $+ lines. $+ [ $chan ] $+ . $+ [ $server ] $+ . $+ [ $2 ] ] in $chan on $network $+ . }
}

on *:TEXT:*:#: { 
  if ($1- == !chanstats) ($1- == !reset chanstats) { Halt } 
  if (% [ $+ statsdate. $+ [ $chan ] $+ . $+ [ $server ] ] == $null) { set %statsdate. $+ $chan $+ . $+ $server $date } 
  else if ($len($1-) >= 30) { write randomline. $+ $server $+ . $+ $chan $+ .txt $$1- $+([,By: $nick,]) } 
  set %lastline. $+ $chan $+ . $+ $server $nick 
  inc %linestot. $+ $chan $+ . $+ $server 1 
  inc %lines. $+ $chan $+ . $+ $server $+ . $+ $nick 1 
}

on *:JOIN:#: { inc %joins. $+ $chan $+ . $+ $server 1 }

Comments

Sign in to comment.
xohaib   -  Nov 17, 2014

hey good work but i need channels stats script which gives all things like stats serv example:
[22:52:04] <@Devil> !gtop10
[22:52:04] <+StatServ> Top 10 of Network
[22:52:05] <+StatServ> 1 RonBot letters: 175772, words: 27414, lines: 3457, smileys: 7, actions: 0
[22:52:05] <+StatServ> 2 r0ns0r letters: 72151, words: 11986, lines: 2294, smileys: 2, actions: 9
[22:52:05] <+StatServ> 3 delete/this/shit letters: 65840, words: 12723, lines: 1662, smileys: 0, actions: 2
[22:52:05] <+StatServ> 4 ronsor letters: 52888, words: 9410, lines: 3857, smileys: 4, actions: 9
[22:52:05] <+StatServ> 5 XF letters: 38596, words: 19225, lines: 17065, smileys: 3474, actions: 2129
[22:52:05] <+StatServ> 6 Adam letters: 26873, words: 5269, lines: 1336, smileys: 58, actions: 0
[22:52:05] <+StatServ> 7 Exploit letters: 23943, words: 4106, lines: 1574, smileys: 38, actions: 1
[22:52:05] <+StatServ> 8 Devil letters: 23254, words: 4504, lines: 1411, smileys: 90, actions: 11
[22:52:05] <+StatServ> 9 Police letters: 19352, words: 3145, lines: 315, smileys: 0, actions: 25
[22:52:05] <+StatServ> 10 dev/null letters: 15121, words: 2897, lines: 966, smileys: 5, actions: 0

 Respond  
giggle-tan   -  Mar 23, 2008

cool. i lieks.

 Respond  
qwamby   -  Jan 05, 2008

nice snippit dude.. This is my first comment on the boards, and well, would like to say that code is working a treat in one of my channels.

 Respond  
Abbas   -  Aug 27, 2007

good

 Respond  
Metallboy100   -  Aug 22, 2007

good job

 Respond  
Minshu   -  Feb 05, 2007

Any chance for a !topchat or !top10 (trigger doesn\'t matter), that would display the top 10 chatters in the channel via notice to whoever typed that trigger?

 Respond  
Noutrious   -  Jul 10, 2006

Nice, but i would suggest that .timer 0 999 /checklines and for checklines aliases set that it uses $lines(chan1.txt) and if they are more than 100 or 200, then
var %line1 = $read(chan1.txt,1)
var %line2 = $read(chan1.txt,2)
var %line3 = $read(chan1.txt,3)
.write -c chan1.txt
.write chan1.txt %line1
.write chan1.txt %line2
.write chan1.txt %line3

 Respond  
Cage   -  Jul 08, 2006

comments?

 Respond  
Cage   -  Jun 04, 2006

Also included a join statistic. You may want to repaste the whole script into your remotes for this to work.

 Respond  
Cage   -  Jun 04, 2006

Ignore the html tags... I thought the comments supported it too. lol

 Respond  
Cage   -  Jun 04, 2006

Updated again.

Upon typing !chanstats, if any of the variables are $null, it will set them with the appropriate information. This way, you only have to type !reset chanstats when you want to reset all of the info at once.

 Respond  
ryu.dragonryder   -  May 31, 2006

great snippet - am using it on my bot on my network :)
just love it

 Respond  
son.of.sith   -  May 31, 2006

works great - thanks

 Respond  
Cage   -  May 30, 2006

Updated again. Feedback would be appreciated.

 Respond  
Cage   -  May 28, 2006

Removed some stuff... added some others.

 Respond  
BigToe   -  Apr 16, 2006

I like this script, I was thinking you could add variables at the start so there\'ll be no blank lines like \"Last person kicked:\". eg:

alias clearvars {
set %lines 0
set %opline 0
set %halfopline 0
set %voiceline 0
set %lastline No-one
}
... things like that. Also, you could add more features, none of which I can think of :p, but this is a potentially excellent script. Not saying it isn\'t now...

 Respond  
sean   -  Apr 10, 2006

not bad;
watch out for flood protection though

 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.