Weather Client — File Browser
WeatherClientv2.4.2 / WeatherClientv2.4.2 / weatherclient.mrc
weatherclient.mrc — 25.01 KB — Download this file
on *:LOAD: {
if ($version < 6.03) { w.pre $color(info).dd weather client requires mirc 6.03 or better. | wunload yes }
set %w.s 1
wsilent off
wsendtype msg
wpopup all
wdisplay echo
wbot on
wquery off
wtrigger !weather
wmetric off
wspam Type /<type> <chan> <trigger> <US zipcode, 'city, province', or 'city, country'> for INTL weather (connections allowed: <con> - private <type> support: <query>)
woutput From <loc> (<time>) temp(<temp>) cond(<cond>) wind(<wind>) hu(<hu>) dewpnt(<dewpnt>) bp(<bp>) clouds(<clouds>) vis(<vis>)
unset %w.s
w.pre $color(info).dd weather weather client $w.ver loaded, type /wconfig to see current settings
}
;------------------------------------------------------------ local aliases -------------------------------------------------------
alias w.f-c { return $int($calc(($1 - 32) * (5/9))) }
alias w.ft-me { return $round($calc($int($1) * 0.3048),1) }
alias w.mi-km { return $round($calc($int($1) * 1.609344),1) }
alias w.psi-kgc { return $round($calc($int($1) * 0.07030696),1) }
alias -l w.ini { return $+($chr(34),$scriptdirweatherclient.ini,$chr(34)) }
alias -l w.ver { return 2.4.2 }
alias -l w.pre { echo $1 -ai1 * $+(/,$2,:) $3- }
alias -l w.l { return $gettok($1,2,1) }
alias -l w.ti { return $gettok($gettok($1,1,1),1,32) $+ $replace($gettok($gettok($1,1,1),2,32),AM,a,PM,p) $left($gettok($gettok($1,1,1),5,32),3) $int($gettok($gettok($1,1,1),6,32)) $right($gettok($gettok($1,1,1),7,32),2) }
alias -l w.te { return $iif($readini($w.ini,weather,metric),$+($w.f-c($gettok($1,3,1)),c),$+($gettok($1,3,1),f)) }
alias -l w.cn { return $gettok($1,4,1) }
alias -l w.w { return $iif($numtok($gettok($gettok($1,5,1),1-,32),32) < 3,$gettok($gettok($1,5,1),1,32),$gettok($gettok($1,5,1),1-2,32) $iif($readini($w.ini,weather,metric),$w.mi-km($gettok($gettok($1,5,1),3,32)) kph,$gettok($gettok($1,5,1),3,32) mph)) }
alias -l w.h { return $gettok($1,6,1) }
alias -l w.d { return $iif($readini($w.ini,weather,metric),$+($w.f-c($gettok($1,7,1)),c),$+($gettok($1,7,1),f)) }
alias -l w.p { return $iif($readini($w.ini,weather,metric),$+($w.psi-kgc($gettok($1,8,1)),kgc),$+($gettok($1,8,1),psi)) }
alias -l w.cl {
if ($chr(47) !isin $gettok($1,9,1)) {
set %wtemp.str $remove($gettok($1,9,1),ft,$chr(44))
var %wtemp $numtok($gettok($1,9,1),32)
while (%wtemp) { if ($gettok($gettok($1,9,1),%wtemp,32) isnum) { if ($readini($w.ini,weather,metric)) { set %wtemp.str $replace(%wtemp.str,$gettok($gettok($1,9,1),%wtemp,32),$w.ft-me($gettok($gettok($1,9,1),%wtemp,32)) $+ $+(me,$chr(44))) } | if (!$readini($w.ini,weather,metric)) { set %wtemp.str $replace(%wtemp.str,$gettok($gettok($1,9,1),%wtemp,32),$gettok($gettok($1,9,1),%wtemp,32) $+ $+(ft,$chr(44))) } } | dec %wtemp }
var %wtmp.str %wtemp.str
unset %wtemp.str
return $left(%wtmp.str,$calc($len(%wtmp.str) - 1))
}
if ($chr(47) isin $gettok($1,9,1)) { return $gettok($1,9,1) }
}
alias -l w.v { return $iif($gettok($1,10,1),$iif($readini($w.ini,weather,metric),$+($w.mi-km($gettok($1,10,1)),km),$+($gettok($1,10,1),mi)),$+(N,$chr(47),A)) }
alias w.out { return $replace($readini($w.ini,weather,output),<loc>,$w.l($1-),<time>,$w.ti($1-),<temp>,$w.te($1-),<cond>,$w.cn($1-),<wind>,$w.w($1-),<hu>,$w.h($1-),<dewpnt>,$w.d($1-),<bp>,$w.p($1-),<clouds>,$w.cl($1-),<vis>,$w.v($1-),<k>,$chr(3),<b>,$chr(2),<u>,$chr(31),<r>,$chr(22)) }
alias w.outgui { if (!$dialog($1)) { dialog -mo $1 w.dial } | dialog -v $1 | did -ra $1 1 Recorded in $w.l($2-) at $w.ti($2-) | did -ra $1 3 $w.te($2-) | did -ra $1 5 $w.w($2-) | did -ra $1 7 $w.d($2-) | did -ra $1 9 $w.cl($2-) | did -ra $1 11 $w.cn($2-) | did -ra $1 13 $w.h($2-) | did -ra $1 15 $w.p($2-) | did -ra $1 17 $w.v($2-) }
alias -l w.fm { set %w.s 1 | $1- | unset %w.s }
alias -l w.po { var %wtmp $readini($w.ini,weather,popup) | if (c isin %wtmp) && ($menu == channel) { return 1 } | if (s isin %wtmp) && ($menu == status) { return 1 } | if (n isin %wtmp) && ($menu == nicklist) { return 1 } | if (q isin %wtmp) && ($menu == query) { return 1 } | if (m isin %wtmp) && ($menu == menubar) { return 1 } | if (%wtmp == 0) || (%wtmp == $null) { return 0 } | if (%wtmp == 1) { return 1 } }
alias -l w.om { return Available tags: $crlf $+ $crlf $+ <loc> $str($chr(9),2) location $crlf $+ <time> $str($chr(9),2) time recorded $crlf $+ <temp> $str($chr(9),2) temperature $crlf $+ <cond> $str($chr(9),2) condition $crlf $+ <wind> $str($chr(9),2) windspeeds $crlf $+ <hu> $str($chr(9),2) humidity $crlf $+ <dewpnt> $chr(9) dewpoint $crlf $+ <bp> $str($chr(9),2) pressure $crlf $+ <clouds> $chr(9) clouds $crlf $+ <vis> $str($chr(9),2) visibility $crlf <b><u><r><k> $chr(9) BURK codes }
alias -l w.sm { return Available tags: $crlf $crlf $+ <trigger> $chr(9) weather trigger $crlf $+ <bot> $str($chr(9),2) weather bot status $crlf $+ <query> $chr(9) query support status $crlf $+ <con> $str($chr(9),2) max connections $crlf $+ <b><u><r><k> $chr(9) BURK codes }
alias -l w.s.t { return $readini($w.ini,weather,trigger) }
alias -l w.s.b { return $iif($readini($w.ini,weather,bot),on,off) }
alias -l w.s.c { return $readini($w.ini,weather,maxcon) }
alias -l w.s.q { return $iif($readini($w.ini,weather,query),on,off) }
alias -l w.s.s { return $iif($readini($w.ini,weather,sendtype),notice,msg) }
alias -l w.lw { return $iif($readini($w.ini,weather,localwthr),$ifmatch) }
alias -l w.si { return $readini($w.ini,weather,silent) }
;----------------------------------------------------------- command line -------------------------------------------------------
alias wconfig { wpopup | wdisplay | wmetric | wbot | wsendtype | wsilent | wmaxcon | wtrigger | wquery | wspam | woutput }
alias wmetric { if ($1) { writeini $w.ini weather metric $iif($1 == on,1,0) } | if (!%w.s) { w.pre $color(info).dd weather(metric) metric measurements are $iif($readini($w.ini,weather,metric),enabled,disabled) } }
alias wspam {
if ($1 ischan) || ($chr(35) == $left($1,1)) || ($chr(38) == $left($1,1)) {
if ($readini($w.ini,weather,bot)) { $iif($readini($w.ini,weather,sendtype),notice,msg) $1 $replace($readini($w.ini,weather,spam),<trigger>,$w.s.t,<con>,$w.s.c,<query>,$w.s.q,<type>,$w.s.s,<chan>,$1,<k>,$chr(3),<b>,$chr(2),<u>,$chr(31),<r>,$chr(22)) }
if (!$readini($w.ini,weather,bot)) { w.pre $color(info) weather(spam) requests are disabled, msg cannot be sent }
}
if ($1 !ischan) && ($chr(35) != $left($1,1)) && ($chr(38) != $left($1,1)) && ($1) { if ($chr(124) !isin $1-) { writeini $w.ini weather spam $1- } | if (!%w.s) { w.pre $color(info).dd weather(spam) $readini($w.ini,weather,spam) } }
if (!$1) && (!%w.s) { w.pre $color(info).dd weather(spam) $readini($w.ini,weather,spam) }
}
alias wupdate { if ($sock(weather.update)) && (!%w.s) { w.pre $color(info).dd weather(update) socket already in use } | if (!$sock(weather.update)) { sockopen weather.update plastic.xsintrk.net 80 | dialog -mo w.vcheck w.vcheck } }
alias woutput { if ($1) { writeini $w.ini weather output $1- } | if (!%w.s) { w.pre $color(info).dd weather(output) $readini($w.ini,weather,output) } }
alias wreadme { $iif($isfile($scriptdirreadme-weather.txt),run $scriptdirreadme-weather.txt,w.pre $color(info).dd weather readme-weather.txt was not found in $scriptdir) }
alias wmaxcon { if ($1) { writeini $w.ini weather maxcon $iif($1 isnum,$1,unlimited) } | if (!%w.s) { w.pre $color(info).dd weather(maxcon) $iif($readini($w.ini,weather,maxcon) isnum,$ifmatch,unlimited) connection $+ $iif($readini($w.ini,weather,maxcon) != 1,s are,$chr(32) is) allowed } }
alias wtrigger { if ($1) { writeini $w.ini weather trigger $1 } | if (!%w.s) { w.pre $color(info).dd weather(trigger) request trigger is $readini($w.ini,weather,trigger) } }
alias wbot { if ($1) { writeini $w.ini weather bot $iif($1 == on,1,0) } | if (!%w.s) { w.pre $color(info).dd weather(bot) requests are $iif($readini($w.ini,weather,bot),enabled,disabled) } }
alias wpanic { sockclose weather.* | unset %weather.* | if (!%w.s) { w.pre $color(info).dd weather(panic) all weather sockets were closed } }
alias wunload { if ($1 == yes) { w.pre $color(info).dd weather Unloaded $script | .unload -rs $script } | if ($1 != yes) { w.pre $color(info).dd weather(unload) Are you sure you want to do this? } }
alias wdisplay { if ($1 == gui) || ($1 == echo) { writeini $w.ini weather gui $replace($1,gui,1,echo,0) } | if (!%w.s) { w.pre $color(info).dd weather(display) local report shown in $iif($readini($w.ini,weather,gui),a GUI,the active window) } }
alias wquery { if ($1) { writeini $w.ini weather query $iif($1 == on,1,0) } | if (!%w.s) { w.pre $color(info).dd weather(query) query support is $iif($readini($w.ini,weather,query),enabled,disabled) } }
alias wsendtype { if ($1) { writeini $w.ini weather sendtype $iif($1 == notice,1,0) } | if (!%w.s) { w.pre $color(info).dd weather(sendtype) bot replies will be sent by $iif($readini($w.ini,weather,sendtype),NOTICE,MSG) } }
alias wsilent { if ($1) { writeini $w.ini weather silent $iif($1 == on,1,0) } | if (!%w.s) { w.pre $color(info).dd weather(silent) bot replies will $iif(!$readini($w.ini,weather,silent),not) be sent silently } }
alias wpopup {
if ($1 == none) || ($1 == all) { writeini $w.ini weather popup $replace($1,none,0,all,1) | goto readout }
if (c isin $1) || (m isin $1) || (n isin $1) || (s isin $1) || (q isin $1) { var %wtmp $len($1) | while (%wtmp) { if (c != $mid($1,%wtmp,1)) && (m != $mid($1,%wtmp,1)) && (n != $mid($1,%wtmp,1)) && (s != $mid($1,%wtmp,1)) && (q != $mid($1,%wtmp,1)) { goto readout } | dec %wtmp }
if ($count($1,c) > 1) || ($count($1,m) > 1) || ($count($1,n) > 1) || ($count($1,s) > 1) || ($count($1,q) > 1) { goto readout } | writeini $w.ini weather popup $1 } | :readout
if (!%w.s) {
if ($readini($w.ini,weather,popup) == 1) { w.pre $color(info).dd weather(popup) enabled for all windows and menubar popups | goto end }
if (!$readini($w.ini,weather,popup)) { w.pre $color(info).dd weather(popup) client menu is disabled | goto end } | var %wtmp $readini($w.ini,weather,popup) | var %wtmp2 0
if (c isin %wtmp) { set %wtemp channel | inc %wtmp2 } | if (m isin %wtmp) { set %wtemp %wtemp menubar | inc %wtmp2 } | if (n isin %wtmp) { set %wtemp %wtemp nicklist | inc %wtmp2 } | if (s isin %wtmp) { set %wtemp %wtemp status | inc %wtmp2 } | if (q isin %wtmp) { set %wtemp %wtemp query | inc %wtmp2 }
var %wtmp $gettok($replace(%wtemp,$chr(32),$chr(44) $chr(32)),$+(1,-,$calc($numtok(%wtemp,32) -1)),32) | w.pre $color(info).dd weather(popup) enabled for $iif($numtok(%wtemp,32) != 1,$left(%wtmp,$calc($len(%wtmp) - 1)) and) $gettok(%wtemp,$numtok(%wtemp,32),32) popups
unset %wtemp
}
:end
}
alias weather {
if (%weather.trigger) {
if ($var(%weather.*.nick,0) < $readini($w.ini,weather,maxcon)) || ($readini($w.ini,weather,maxcon) == unlimited) {
set $+(%,weather.,$calc($sock(weather.*,0) + 1),.nick) %weather.trigger
if ($w.si) { $iif($readini($w.ini,weather,sendtype),.notice,.msg) $($+(%,weather.,$calc($sock(weather.*,0) + 1),.nick),2) $+ $iif($numtok($($+(%,weather.,$calc($sock(weather.*,0) + 1),.nick),2),32) == 2,:) attempting to retrieve weather for $1- $+ . }
if (!$w.si) { $iif($readini($w.ini,weather,sendtype),notice,msg) $($+(%,weather.,$calc($sock(weather.*,0) + 1),.nick),2) $+ $iif($numtok($($+(%,weather.,$calc($sock(weather.*,0) + 1),.nick),2),32) == 2,:) attempting to retrieve weather for $1- $+ . }
unset %weather.trigger
}
}
if (!%weather.trigger) && ($1) {
set $+(%,weather.,$calc($sock(weather.*,0) + 1),.loc) $replace($1-,$chr(44),$+($chr(37),2C),$chr(32),$chr(43))
sockopen $($+(weather.,$calc($sock(weather.*,0) + 1),.),2) www.wunderground.com 80
}
if (!$1) { w.pre $color(info).dd weather insufficient parameters }
}
on *:TEXT:*:*: {
if (!$readini($w.ini,weather,sendtype)) {
if ($chan) && ($1 == $readini($w.ini,weather,trigger)) && ($readini($w.ini,weather,bot)) && ($2-) { set %weather.trigger $chan $nick | weather $2- }
if (!$chan) && ($1 == $readini($w.ini,weather,trigger)) && ($readini($w.ini,weather,bot)) && ($readini($w.ini,weather,query)) && ($2-) { set %weather.trigger $nick | weather $2- }
}
}
on *:NOTICE:*:*: {
if ($readini($w.ini,weather,sendtype)) {
if ($chan) && ($1 == $readini($w.ini,weather,trigger)) && ($readini($w.ini,weather,bot)) && ($2-) { set %weather.trigger $chan $nick | weather $2- }
if (!$chan) && ($1 == $readini($w.ini,weather,trigger)) && ($readini($w.ini,weather,bot)) && ($readini($w.ini,weather,query)) && ($2-) { set %weather.trigger $nick | weather $2- }
}
}
;----------------------------------------------------------- socket scripts -----------------------------------------------------
on *:sockopen:weather.*: {
if ($gettok($sockname,2,46) isnum) {
if ($sockerr) { w.pre $color(info).dd weather there was a socket error $+($chr(40),$sockerr,$chr(41)) | unset $+(%,weather.,$gettok($sockname,2,46),.*) | return }
sockwrite -n $sockname GET /cgi-bin/findweather/getForecast?brand=sfgate&query= $+ $($+(%,weather.,$gettok($sockname,2,46),.loc),2) HTTP/1.0
sockwrite -n $sockname Accept: */*
sockwrite -n $sockname Accept-Language: en-us
sockwrite -n $sockname Accept-Encoding: gzip, deflate
sockwrite -n $sockname User-Agent: Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt)
sockwrite -n $sockname Host: www.wunderground.com
sockwrite -n $sockname
unset $+(%,weather.,$gettok($sockname,2,46),.loc)
}
if ($gettok($sockname,2,46) == update) {
if ($sockerr) { did -ra w.vcheck 1 Status: socket error $+($chr(40),$sockerr,$chr(41)) | return }
did -ra w.vcheck 1 Status: connected, sent request
sockwrite -n $sockname GET /mirc/weatherclient/version.txt HTTP/1.1
sockwrite -n $sockname Accept: */*
sockwrite -n $sockname Accept-Language: en-us
sockwrite -n $sockname Accept-Encoding: gzip, deflate
sockwrite -n $sockname User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows 98)
sockwrite -n $sockname Host: plastic.xsintrk.net
sockwrite -n $sockname
}
}
on *:sockread:weather.*: {
if ($gettok($sockname,2,46) isnum) {
var $+(%,weather.,$gettok($sockname,2,46),.buffer)
sockread $+(%,weather.,$gettok($sockname,2,46),.buffer)
;echo -a $iif($($+(%,weather.,$gettok($sockname,2,46),.buffer),2),$ifmatch,-)
if (*Updated:* iswm $($+(%,weather.,$gettok($sockname,2,46),.buffer),2)) { inc $+(%,weather.,$gettok($sockname,2,46),.inc) 1 | sockmark $sockname $gettok($gettok($($+(%,weather.,$gettok($sockname,2,46),.buffer),2),2-,32),1,60) }
if (*Observed At:* iswm $($+(%,weather.,$gettok($sockname,2,46),.buffer),2)) { inc $+(%,weather.,$gettok($sockname,2,46),.inc) 1 | sockmark $sockname $sock($sockname).mark $+ $chr(1) $+ $gettok($gettok($($+(%,weather.,$gettok($sockname,2,46),.buffer),2),3-,32),1,60) }
if (*  $+ * $+ °*</font>* iswm $($+(%,weather.,$gettok($sockname,2,46),.buffer),2)) { inc $+(%,weather.,$gettok($sockname,2,46),.inc) 1 | sockmark $sockname $sock($sockname).mark $+ $chr(1) $+ $int($gettok($($+(%,weather.,$gettok($sockname,2,46),.buffer),2),2,59)) }
if (*serif" size=1><b> *</b><br> iswm $($+(%,weather.,$gettok($sockname,2,46),.buffer),2)) { inc $+(%,weather.,$gettok($sockname,2,46),.inc) 1 | sockmark $sockname $sock($sockname).mark $+ $chr(1) $+ $gettok($gettok($($+(%,weather.,$gettok($sockname,2,46),.buffer),2),2,60),2,59) }
if (*  $+ * $+ Wind: <b>* iswm $($+(%,weather.,$gettok($sockname,2,46),.buffer),2)) { inc $+(%,weather.,$gettok($sockname,2,46),.inc) 1 | sockmark $sockname $sock($sockname).mark $+ $chr(1) $+ $gettok($gettok($($+(%,weather.,$gettok($sockname,2,46),.buffer),2),2,60),2-3,62) }
if (*  $+ * $+ Humidity: <b>* iswm $($+(%,weather.,$gettok($sockname,2,46),.buffer),2)) { inc $+(%,weather.,$gettok($sockname,2,46),.inc) 1 | sockmark $sockname $sock($sockname).mark $+ $chr(1) $+ $gettok($gettok($($+(%,weather.,$gettok($sockname,2,46),.buffer),2),2,60),2-3,62) }
if (*Dewpoint: <b>*°*Clouds: <b>* iswm $($+(%,weather.,$gettok($sockname,2,46),.buffer),2)) {
;echo -a $($+(%,weather.,$gettok($sockname,2,46),.buffer),2)
inc $+(%,weather.,$gettok($sockname,2,46),.inc) 1
var %weather.tmp $gettok($($+(%,weather.,$gettok($sockname,2,46),.buffer),2),2,58)
sockmark $sockname $sock($sockname).mark $+ $chr(1) $+ $gettok($gettok(%weather.tmp,2,62),1,38)
var %weather.tmp $gettok($($+(%,weather.,$gettok($sockname,2,46),.buffer),2),3,58)
sockmark $sockname $sock($sockname).mark $+ $chr(1) $+ $gettok($gettok($gettok(%weather.tmp,2,62),1,60),1,32)
var %weather.tmp $gettok($gettok($replace($gettok($($+(%,weather.,$gettok($sockname,2,46),.buffer),2),4,58),<br>,$chr(44) $+ $chr(32)),2-,32),1,60)
sockmark $sockname $sock($sockname).mark $+ $chr(1) $+ $iif($gettok(%weather.tmp,1,32) == $chr(44),$+(N,$chr(47),A),%weather.tmp)
var %weather.tmp $gettok($($+(%,weather.,$gettok($sockname,2,46),.buffer),2),5,58)
sockmark $sockname $sock($sockname).mark $+ $chr(1) $+ $gettok($gettok(%weather.tmp,2,62),1,60)
}
}
if ($gettok($sockname,2,46) == update) { did -ra w.vcheck 1 Status: downloading info | sockread %weather.update | if ($remove($gettok(%weather.update,1,32),$chr(46)) isnum) { did -ra w.vcheck 1 Status: latest version is $gettok(%weather.update,1,32) | did -e w.vcheck 2,3 | sockclose weather.update } }
}
on *:sockclose:weather.*: {
if ($gettok($sockname,2,46) isnum) {
if ($($+(%,weather.,$gettok($sockname,2,46),.inc),2) == 7) {
if ($($+(%,weather.,$gettok($sockname,2,46),.nick),2)) {
if ($w.si) { $iif($readini($w.ini,weather,sendtype),.notice,.msg)) $($+(%,weather.,$gettok($sockname,2,46),.nick),2) $+ $iif($numtok($($+(%,weather.,$gettok($sockname,2,46),.nick),2),32) == 2,:) $w.out($sock($sockname).mark) }
if (!$w.si) { $iif($readini($w.ini,weather,sendtype),notice,msg)) $($+(%,weather.,$gettok($sockname,2,46),.nick),2) $+ $iif($numtok($($+(%,weather.,$gettok($sockname,2,46),.nick),2),32) == 2,:) $w.out($sock($sockname).mark) }
}
if (!$($+(%,weather.,$gettok($sockname,2,46),.nick),2)) { $iif(!$readini($w.ini,weather,gui),w.pre $color(info).dd weather $w.out($sock($sockname).mark),w.outgui $sockname $sock($sockname).mark) }
}
if ($($+(%,weather.,$gettok($sockname,2,46),.inc),2) != 7) {
if ($($+(%,weather.,$gettok($sockname,2,46),.nick),2)) {
if ($w.si) { $iif($readini($w.ini,weather,sendtype),.notice,.msg)) $($+(%,weather.,$gettok($sockname,2,46),.nick),2) $+ $iif($numtok($($+(%,weather.,$gettok($sockname,2,46),.nick),2),32) == 2,:) bad search param or no results }
if (!$w.si) { $iif($readini($w.ini,weather,sendtype),notice,msg)) $($+(%,weather.,$gettok($sockname,2,46),.nick),2) $+ $iif($numtok($($+(%,weather.,$gettok($sockname,2,46),.nick),2),32) == 2,:) bad search param or no results }
}
if (!$($+(%,weather.,$gettok($sockname,2,46),.nick),2)) { w.pre $color(info).dd weather bad search param or no results }
}
unset $+(%,weather.,$gettok($sockname,2,46),.*)
}
}
;--------------------------------------------------------- popup menu ---------------------------------------------------------
menu * {
$iif($w.po,Weather client $w.ver $chr(9) /weather)
.$iif($isfile($scriptdirreadme-weather.txt),View readme-weather.txt,Readme file is missing): wreadme
.Weather client webpage: run http://plastic.xsintrk.net/mirc/weatherclient
.Panic! $+($chr(40),Close sockets,$chr(41)): w.fm wpanic
.-
.Check local weather...: var %wtemp $$input(Enter US zipcode or 'city $+ $chr(44) province'.,ei,Weather client,$w.lw) | if (%wtemp) { weather %wtemp | writeini $w.ini weather localwthr %wtemp }
.Check latest version...: wupdate
.$iif(!$chan || !$readini($w.ini,weather,bot),$style(2)) Spam $iif($chan,$chan,channel): wspam $chan
.Options...
..Weather display setup...: w.fm woutput $$input($w.om,eq,Weather display setup,$readini($w.ini,weather,output))
..Spam message setup...: w.fm wspam $$input($w.sm,eq,Spam message setup,$readini($w.ini,weather,spam))
..Popup placement
...$iif(s isin $readini($w.ini,weather,popup),$style(1)) Status: w.fm wpopup $iif(s isin $readini($w.ini,weather,popup),$remove($readini($w.ini,weather,popup),s),$+($remove($readini($w.ini,weather,popup),1,0),s))
...$iif(c isin $readini($w.ini,weather,popup),$style(1)) Channel: w.fm wpopup $iif(c isin $readini($w.ini,weather,popup),$remove($readini($w.ini,weather,popup),c),$+($remove($readini($w.ini,weather,popup),1,0),c))
...$iif(m isin $readini($w.ini,weather,popup),$style(1)) Menubar: w.fm wpopup $iif(m isin $readini($w.ini,weather,popup),$remove($readini($w.ini,weather,popup),m),$+($remove($readini($w.ini,weather,popup),1,0),m))
...$iif(n isin $readini($w.ini,weather,popup),$style(1)) Nicklist: w.fm wpopup $iif(n isin $readini($w.ini,weather,popup),$remove($readini($w.ini,weather,popup),n),$+($remove($readini($w.ini,weather,popup),1,0),n))
...$iif(q isin $readini($w.ini,weather,popup),$style(1)) Queries: w.fm wpopup $iif(q isin $readini($w.ini,weather,popup),$remove($readini($w.ini,weather,popup),q),$+($remove($readini($w.ini,weather,popup),1,0),q))
...-
...$iif($readini($w.ini,weather,popup) == 1,$style(1)) All menus: w.fm wpopup all
...No menus: w.fm wpopup none
..-
..Allow requests $+ $chr(58) $chr(9) $replace($readini($w.ini,weather,bot),1,yes,0,no): w.fm wbot $iif($readini($w.ini,weather,bot),off,on)
..Request trigger $+ $chr(58) $chr(9) $readini($w.ini,weather,trigger): w.fm wtrigger $$input(Enter weather request trigger.,eq,Trigger setup,$readini($w.ini,weather,trigger))
..Connections $+ $chr(58) $chr(9) $readini($w.ini,weather,maxcon): { w.fm wmaxcon $iif($$input(Enter maximum connections allowed. $+($chr(40),integer,$chr(41)) $crlf $+ If a non-integer is used $+ $chr(44) max connects will be set to unlimited.,eq,Connect limit,$iif($readini($w.ini,weather,maxcon),$ifmatch,unlimited)) isnum,$!,unlimited) }
..Use metrics $+ $chr(58) $chr(9) $replace($readini($w.ini,weather,metric),1,yes,0,no): w.fm wmetric $iif($readini($w.ini,weather,metric),off,on)
..Send reply as $+ $chr(58) $chr(9) $replace($readini($w.ini,weather,sendtype),1,notice,0,msg): w.fm wsendtype $iif($readini($w.ini,weather,sendtype),msg,notice)
..Reply silently $+ $chr(58) $chr(9) $replace($readini($w.ini,weather,silent),1,yes,0,no): w.fm wsilent $iif($readini($w.ini,weather,silent),off,on)
..Support queries $+ $chr(58) $chr(9) $replace($readini($w.ini,weather,query),1,yes,0,no): w.fm wquery $iif($readini($w.ini,weather,query),off,on)
..-
..Local display $+ $chr(58) $chr(9) $replace($readini($w.ini,weather,gui),1,gui,0,echo): w.fm wdisplay $iif($readini($w.ini,weather,gui),echo,gui)
.-
.Unload Weather client $w.ver: { var %wtemp $$input(Do you want to unload Weather client $w.ver $+ ?,yw,Unload) | if (%wtemp == $yes) { wunload yes } }
}
;-------------------------------------------------------------- gui ----------------------------------------------------------------
dialog w.vcheck {
title "Update check"
size -1 -1 92 38
option -dbu
text "Status: connecting..", 1, 5 5 80 7
button "View readme" 2, 5 20 40 13
button "Get client", 3, 48 20 40 13, ok
button "", 4, 0 0 0 0, cancel
icon comctl32.dll,28
}
on *:DIALOG:w.vcheck:init:0: { did -b w.vcheck 2,3 }
on *:DIALOG:w.vcheck:sclick:*: { if ($did == 2) { run $+(http://plastic.xsintrk.net/mirc/weatherclient/readme-weather.txt) } | if ($did == 3) { run $gettok(%weather.update,2-,32) | unset %weather.update } | if ($did == 4) { sockclose weather.update | unset %weather.update } }
dialog w.dial {
title "Weather report"
size -1 -1 190 95
option -dbu
box "", 1, 5 3 180 85
text "Temperature:", 2, 10 20 50 7
edit "", 3, 43 18 50 11, read, autohs
text "Windspeed:", 4, 13 32 50 7
edit "", 5, 43 30 50 11, read, autohs
text "Dewpoint:", 6, 18 44 50 7
edit "", 7, 43 42 50 11, read, autohs
text "Cloud cover:", 8, 12 56 50 7
edit "", 9, 43 54 50 11, read, autohs
text "Condition:", 10, 105 20 50 7
edit "", 11, 130 18 50 11, read, autohs
text "Humidity:", 12, 107 32 50 7
edit "", 13, 130 30 50 11, read, autohs
text "Pressure:", 14, 107 44 50 7
edit "", 15, 130 42 50 11, read, autohs
text "Visibility:", 16, 109 56 50 7
edit "", 17, 130 54 50 11, read, autohs
button "Copy to clipboard (same format as weather display)", 18, 10 70 170 13
button "" 19, 0 0 0 0, cancel
}
on *:DIALOG:weather.*:init:0: { if ($dialog(0) > 1) && (weather.* iswm $dialog($dialog(0))) { dialog -s $dname $iif($calc($dialog($calc($dialog(0) - 1)).x + 20) < $calc($window(-1).h - 250) && $calc($dialog($calc($dialog(0) - 1)).y + 20) < $calc($window(-1).w - 400),$calc($dialog($calc($dialog(0) - 1)).x + 20) $calc($dialog($calc($dialog(0) - 1)).y + 20),0 0) $dialog($dialog(0)).cw $dialog($dialog(0)).ch } }
on *:DIALOG:weather.*:sclick:*: { if ($did == 18) { clipboard $replace($readini($w.ini,weather,output),<loc>,$gettok($did(1).text,$+(3,-,$calc($numtok($did(1).text,32) - 5)),32),<time>,$gettok($did(1).text,$+($calc($numtok($did(1).text,32) - 3),-,$numtok($did(1).text,32)),32),<temp>,$gettok($did(3).text,1,32),<wind>,$did(5).text,<dewpnt>,$gettok($did(7).text,1,32),<clouds>,$did(9).text,<cond>,$did(11).text,<hu>,$did(13).text,<bp>,$gettok($did(15).text,1,32),<vis>,$gettok($did(17).text,1,32),<k>,$chr(3),<b>,$chr(2),<u>,$chr(31),<r>,$chr(22)) } }