Im pretty sure this has been done many times before on hawkee but its always good to do something a bit different.
Introducing my statistics script.
After playing with eggdrop and its example scripts "ques5" to be precise,
I had a shot at doing this myself in mIRC.
Its possible. :)
I've done my best feel free to point out what can be improved and such.
Load and restart your mIRC :D
Updated:
11/03/2012 - Changed the quiet variable to %quiet and fixed it so its 100% certain to be quiet.
; mIRC Statistics
; Written for Ilkotech IRC by Thomas Edwards (TMFKSOFT)
; Statistics will log every 60 seconds unless changed.
; Multi-network stats are not currently supported.
; CAUTION: This script is pretty noisy!
alias config {
set %dir html
; Interval between each update in seconds.
set %update 5
; Make script quiet?
set %silent true
; Owner - Put your nick
set %owner Fudgie
;====================================;
; DO NOT Edit below this section! ;
;====================================;
if ($1 == system) {
echo -g 6:: Loading Config ::
}
else {
echo -g 6:: Reload command issued by $me ::
}
}
on 1:CONNECT:{
config system
echo -g 7Connected to an IRC Network. Starting stats.
timerstats 0 $iif(%update,%update,60) makestats
makestats
}
on 1:START:{
config system
echo -g 4:: Loading Statistics Script ::
if ($exists(%dir)) {
echo -a 3Statistics Script Loaded!
}
else {
echo -g 4Error loading statistics script. $+(',%dir,') No such directory.
}
}
on 1:TEXT:!reload:#:{
if ($nick == %owner) {
config
msg # :: Config reloaded ::
}
else {
msg # :: You are not my owner ::
}
}
on 1:DISCONNECT:{
echo -g 4Disconnected from IRC. Stopping stats.
unset %dir %update %minimal
}
alias -l makestats {
linesep
if (%silent == false) { echo -g 12:: Writing Statistics :: }
var %chan_count $chan(0)
var %x 1
;Write index.html
.fopen -o index %dir $+ /index.html
.fwrite index <meta http-equiv=refresh content= $+ %update $+ ;url=index.html ><title>Statistics for $network $+ </title> $+ $crlf $+ <font face="Arial"/> $+ $crlf $+ <h1>mIRC Statistics > $network $+ </h1><hr color="black"/>
.fwrite index <h3>Bot info:</h3><b>My Nick is:</b> $me <br><b>The network name is:</b> $network <br><b>The server I am on is:</b> <a href="irc:// $+ $server $+ : $+ $port $+ /"> $+ $server $+ : $+ $port $+ </a><br><b>I am on %chan_count channels</b><br>
.fwrite index <hr color="black"/><center>
if ($chan(0) == 0) {
.fwrite index <h2>I am not joined to any channels :(</h2>
}
else {
.fwrite index <h2>I am on the following channels:</h2>
while (%x <= $chan(0)) {
.fwrite index <b> $chan(%x) - <a href=" $+ $remove($chan(%x),$chr(35)) $+ .html" $+ >View</a></b><br>
inc %x
}
}
.fwrite index <hr color="black"/><small><b><i>Last updated: $time(hh:nntt dd/mm/yyyy) </i></b></small>
.fwrite index <p>Statistics Script by Thomas Edwards (TMFKSOFT) for <a href="http://ilkotech.co.uk/">Ilkotech.co.uk</a> © Copyright 2011</p>
.fclose index
var %x 1
if ($chan(0) == 0) {
if (%silent == false) { echo -g 4:: No channels to write. :: }
HALT
}
else {
if (%silent == false) { echo -g 3:: Writing $chan(0) channels. :: }
while (%x <= $chan(0)) {
if (%silent == false) { echo -g 7:: Writing channel $chan(%x) :: }
var %chan $remove($chan(%x),$chr(35))
.fopen -o chan %dir $+ / $+ %chan $+ .html
.fwrite chan <meta http-equiv=refresh content= $+ %update $+ ;url= $+ %chan $+ .html ><title>Statistics for $network - $chan(%x) $+ </title> $+ $crlf $+ <font face="Arial"/> $+ $crlf $+ <h1>mIRC Statistics > $network > $chan(%x) $+ </h1><hr color="black"/>
.fwrite chan <h2>Stats for $chan(%x) $+ </h2><b>Topic:</b> $iif($chan(%x).topic,$chan(%x).topic,<i>No topic in $chan(%x) $+ </i>) <br>
.fwrite chan <b>Usercount:</b> $nick($chan(%x),0) <hr color="black"/><center><h2>Users in $chan(%x) $+ </h2>
var %i 1
var %users $nick($chan(%x),0)
while (%i <= %users) {
.fwrite chan <b> $+ $nick($chan(%x),%i).pnick $+ </b> - $right($address($nick($chan(%x),%i),0),-2) $iif($nick($chan(%x),%i) == $me,<small><b><-- LOOK! ITS ME!</b></small>) <br>
inc %i
}
.fwrite chan <br> $iif(%users = 1,<h3>Im all alone :' $+ $chr(40) $+ </h3>) <hr color="black"/><b><small><i>Last updated: $time(hh:nntt dd/mm/yyyy) </i></small></b><br><h3><a href="index.html">Home</a></h3>
.fwrite chan <p>Statistics Script by Thomas Edwards (TMFKSOFT) for <a href="http://ilkotech.co.uk/">Ilkotech.co.uk</a> © Copyright 2011</p>
.fclose chan
inc %x
}
}
if (%silent == false) { echo -g 4:: Written all stats :: }
}
After note:
Look at your status window.
If you just load the script and dont edit anything you will find it says this:
:: Reload command issued by Fudgie ::
:: Loading Statistics Script ::
Error loading statistics script. 'html' No such directory.
To make the directory simply type "/mkdir html" then
Annaiidziithaa, Line 75 is where its trying to write to the main index.html file.
Make sure you have set %dir correctly on line 11 and that the directory exists!
I hope this helps!
Thanks,
FragUK:
I've been delayed with the script currently due to other pressing projects but I HOPE to have it done sometime this month.
lol,fix what it works , cant you see o0 http://teh-evilcode.bugs3.com/statistics/
Lets try and wet your appetite.
mIRCS v2 is in creation.
v2 has mutli networks and channels like v1, channels and networks can be toggled via a admin panel
running on a HTTPD System as part of mIRCS, You can togle each channel and network. The statistics pages will also have a editable header, body and footer that are read when a stats page is generated, Secret channels can be ignored as well. There will be a stack of new features on its way!