A basic socket snippets that allows you to check if you need to update your mIRC.exe.
It check your IRC, trough a ctcp message. And the one running the script by simply using the $version command.
on *:TEXT:!mirc:#:{
msg $chan [mIRC] Looking up latest version, please be patient..
if ($sock(mIRC)) { msg %mircchan [mIRC] Socket in use. Please be patient. | sockclose mIRC | halt }
set %mircchan $chan
.ctcp $nick VERSION
sockopen mIRC mirc.com 80
}
on *:CTCPREPLY:version*:{ set %yourversion $1- }
ON *:SOCKOPEN:mIRC: {
sockwrite -n $sockname GET /get.html
sockwrite -n $sockname Host: www.mirc.com
sockwrite -n $sockname User-Agent: $version
sockwrite -n $sockname $crlf
}
on *:SOCKREAD:mIRC: {
if ($sockerr) { msg %mircchan [mIRC] Socket Error. }
var %tmp
sockread %tmp
if (<B>Download mIRC isin %tmp) {
set %mirc.version $remove(%tmp,<FONT FACE="ms sans serif,sans-serif,geneva" SIZE="+2"><B>Download mIRC,or the mIRC FAQ.</FONT>,$chr(32),$chr(44))
set %your.mirc $remove($gettok(%yourversion,3,32),v)
msg %mircchan [mIRC] Latest mIRC version is; %mirc.version $+ . (I currently run on: $version $+ . Upgrade: $iif(%mirc.version >= $version,$iif(%mirc.version == $version,No,Yes),No) $+ .)
msg %mircchan [mIRC] You run on: %your.mirc $+ . (You $iif(%mirc.version >= %your.mirc,$iif(%mirc.version == %your.mirc,DON'T,DO),DON'T) need to upgrade.)
sockclose mIRC
unset %mirc.* | unset %your*
halt
}
}