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-
}
}
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/
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