This script was originaly created for the use of changing the rank in the topic of #windfyre on irc.windfyre.net rather than having to check manualy then upating it manualy. This script does it all in one.
Syntax:
In a channel you want rank updating.
/rank
Different Channel/Network.
/rank CHAN NETNAME
You will need the lay out of the rank already as the script replaces the first in the topic ith the rank.
Example:
Welcome to the Windfyre lobby :: Windfyre Rank Rising - Now #363 :: Network Stats http://l0p.us/w1 :: TOS http://l0p.us/w0 :: :: http://windfyre.net
The script could be added to a timer to be done automaticly, without spaming the channel with topic changes, as it checks if the rank is different from the last.
Full Example:
(/rank)
* Getting New Rank for Windfyre, and updating the topic in #Windfyre
* New Rank: 363
* MartyniP changes topic to 'Welcome to the Windfyre lobby :: Windfyre Rank Rising - Now #363 :: Network Stats http://l0p.us/w1 :: TOS http://l0p.us/w0 :: :: http://www.windfyre.net/'
(/rank)
* Getting New Rank for Windfyre, and updating the topic in #Windfyre
* No change of rank. Current rank 363
It does connect to my website as i could not get the sock to connect and read searchirc.com its self. If you would rather connect to your localhost or your own website you can see the source code for the php script at http://www.hawkee.com/snippet/7885/
Additional Code:
on *:TEXT:!rank:#: { /rank $chan $network }
For when this code is on a bot, !rank can be used.
;
; Created By MartyniP (www.MartyniP.co.uk)
; Originaly Created For Windfyre (irc.windfyre.net #windfyre)
; Copyright MartyniP 2010
;
on *:SockOpen:rank: {
sockwrite -nt rank GET $+(/rank.php?network=,%rank.net)) HTTP/1.1
sockwrite -n rank Host: irc.martynip.co.uk
sockwrite -n rank $crlf
}
on *:SockRead:rank: {
var %rank.read | sockRead %rank.read
if ($chr(35) $+ * iswm %rank.read) {
%rank.read = $remove(%rank.read,$chr(35))
if (%lastRank == %rank.read) {
echo -at * No change of rank. Current rank %lastRank
unset %rank.*
halt
} else {
echo -ta * New Rank: %rank.read Last Rank: %lastRank
%lastRank = %rank.read
/ranktopic %rank.chan %rank.read
unset %rank.*
}
}
}
alias rank {
if (!$2) { set %rank.chan $chan }
else { set %rank.chan $2 }
if (!$3) { set %rank.net $network }
else { set %rank.net $3 }
sockClose rank
sockOpen rank irc.martynip.co.uk 80
/echo -at * Getting New Rank for %rank.net $+ , and updating the topic in %rank.chan
}
alias ranktopic {
%topic = $chan($1).topic
%topic2 = $gettok(%topic,2-,35)
%topic2 = $gettok(%topic2,2-,32)
%topic = $puttok(%topic,$2,2-,35)
%topic = %topic %topic2
/topic $1 %topic
unset %rank.read
}