Version/Update script - help is needed - 10/09/07 07:14 AM
I've got this socket script, that should check version.txt and compare it with a current version number and echo if it's newer or not.
But it seems to echo there is a newer version 15 times with a line in between that says it's the newest version.
It would be nice to have the current version as a global variable, to be used in the rest of the script, if it's possible.
Current version: 1.5, newest version 1.6
But it seems to echo there is a newer version 15 times with a line in between that says it's the newest version.
It would be nice to have the current version as a global variable, to be used in the rest of the script, if it's possible.
Current version: 1.5, newest version 1.6
Code:
on *:sockopen:vercheck:{ if $sockerr { echo -ac info * error retrieving data from siradio | return } set %sockwrite /siradio/version.txt $+ %variable sockwrite -n $sockname GET %sockwrite HTTP/1.1 sockwrite -n $sockname Host: z4nd.net $+ $str($crlf,2) } on *:sockread:vercheck:{ if $sockerr { return } var %b 1.5 var %a sockread %a if (%a > %b) { echo There is a new version available at http://z4nd.net/siradio } else { echo You have the newest version } } on *:sockclose:vercheck: { } alias verchecks { set %variable 1.5 if ($sock(vercheck)) { sockclose vercheck sockopen vercheck z4nd.net 80 } else { sockopen vercheck z4nd.net 80 } }