Can you make this code work again gate please and for GD?I'd really appreciate it gk ![]()
if you need to copy it over again u can find the full uploaded CODE HERE
![]()
![]()
On *:load: {
If ($version < 6.16) { w.pre weather client $w.ver is only
tested/maintained for mIRC 6.16. You are using $version $+ . | wunload yes
| return }
Set %w.S 1
Wpanic
Wdefaults yes
Unset %w.S
W.pre weather weather client $w.ver loaded, type /wconfig to see current
settings
}
;----------------------------------------------------------------- events
-------------------------------------------------------------
On *:text:*:*: { $iif(!$w.rst,w.trig $1-) }
On *:notice:*:*: { $iif($w.rst,w.trig $1-) }
On *:start: { set %w.S 1 | wpanic | unset %w.S }
;------------------------------------------------------------ woutput
aliases -------------------------------------------------------
Alias -l w.f-c { return $int($calc(($1 - 32) * (5/9))) }
Alias -l w.ft-me { return $round($calc($int($1) * 0.3048),1) }
Alias -l w.MI-km { return $round($calc($int($1) * 1.609344),1) }
Alias -l w.in-hpa { return $round($calc($1 * 33.86388),0) }
Alias -l w.ts { return $iif($int($1),$remove($gettok($replace($1-,am,a,PM,p)
1-2,32),$chr(32)),$1-) }
Alias -l w.Sr { return $w.ts($gettok($1,13,1)) }
Alias -l w.ss { return $w.ts($gettok($1,14,1)) }
Alias -l w.Mr { return $w.ts($gettok($1,15,1)) }
Alias -l w.ms { return $w.ts($gettok($1,16,1)) }
Alias -l w.ci { return $gettok($1,2,1) }
Alias -l w.O { return $iif($mid($gettok($1,4,1),$calc($Len($gettok($1,4,1))
- 1),1) == $chr(44),$left($gettok($1,4,1),,-2),$gettok($1,4,1)) }
Alias -l w.it { return $w.ts($gettok($gettok($1,3,1),1-2,32))
$left($gettok($gettok($1,3,1),5,32),3) $int($gettok($gettok($1,3,1),6,32))
$right($gettok($gettok($1,3,1),7,32),2) }
Alias -l w.te { return $iif($gettok($1,5,1) isnum,$iif($w.rme,$+($w
f-c($gettok($1,5,1)),c),$+($gettok($1,5,1),f)),$v1) }
Alias -l w.cn { return $iif($gettok($1,10,1) == /B,N/A,$v1) }
Alias -l w.w { return $w.w2($+($gettok($gettok($1,8,1),1,32)
$iif($gettok($gettok($1,8,1),2,32) isnum && $v1,: $iif($w.rme,$w
MI-km($gettok($gettok($1,8,1),2,32)) $+ kph,$gettok($gettok($1,8,1),2,32) $+
mph))))) }
Alias -l w.w2 { return $iif($1-,$1-,N/A) }
Alias -l w.h { return $iif($gettok($1,6,1) == N/A || $gettok($1,6,1) !isnum
N/A,$+($v1,%)) }
Alias -l w.d { return $iif($gettok($1,7,1) isnum,$iif($w.rme,$+($w
f-c($gettok($1,7,1)),c),$+($gettok($1,7,1),f)),$v1) }
Alias -l w.p { return $iif($gettok($1,9,1) isnum,$iif($w.rme,$+($w
in-hpa($gettok($1,9,1)),hpa),$+($gettok($1,9,1),in)),$gettok($1,9,1)) }
alias -l w.cl { set %wtemp $iif($gettok($1,12,1) != $chr(32),$v1,N/A) | if
(%wtemp != N/A) { w.cl2 $remove(%wtemp,$chr(44)) } | var %wtmp %wtemp |
unset %wtemp | return %wtmp }
alias -l w.cl2 {
unset %wtemp | window -lh @wtemp | aline @wtemp $* | var %wtmp 1
while (%wtmp <= $line(@wtemp,0)) { if ($line(@wtemp,%wtmp) isnum) { rline
@wtemp %wtmp $iif($w.rme,$replace($line(@wtemp,%wtmp),$line(@wtemp,%wtmp)
$+($w.ft-me($line(@wtemp,%wtmp)),me,$chr(44))),$replace($line(@wtemp,%wtmp)
$line(@wtemp,%wtmp),$+($line(@wtemp,%wtmp),ft,$chr(44)))) } | inc %wtmp }
var %wtmp 1
while (%wtmp <= $line(@wtemp,0)) { set %wtemp %wtemp $iif(%wtmp ==
$line(@wtemp,0),$left($line(@wtemp,%wtmp),-1),$line(@wtemp,%wtmp)) | inc
%wtmp }
window -c @wtemp
}
alias -l w.v { return $iif($gettok($1,11,1) != N/A,$iif($w.rme,$+($w
mi-km($gettok($1,11,1)),km),$+($gettok($1,11,1),mi)),N/A) }
;------------------------------------------------------------ misc aliases
--------------------------------------------------------
alias -l w.out { return $replace($readini($w.ini,weather,output),<city>,$w
ci($1-),<obs>,$w.o($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-),<sr>,$w.sr($1-),<ss>,$w.ss($1-),<mr>,$w
mr($1-),<ms>,$w.ms($1-),<k>,$chr(3),<b>,$chr(2),<u>,$chr(31),<r>,$chr(22)) }
alias -l w.outgui { if (!$dialog($1)) { dialog -m $1 w.dial } | dialog -v $1
| dialog -t $1 Weather report for $w.ci($2-) | did -ra $1 1 Recorded in $w
o($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-) | did -ra $1 19 $w.sr($2-) | did -ra $1 21 $w.ss($2-) | did -ra $1 23
$w.mr($2-) | did -ra $1 25 $w.ms($2-) }
alias -l w.fm { set %w.s 1 | $1- | unset %w.s }
alias -l w.po { var %wtmp $w.rp | 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 $+ <city> $str($chr(9)
2) target city $crlf $+ <obs> $str($chr(9),2) observation station $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 $+
<sr> $str($chr(9),2) sunrise $crlf $+ <ss> $str($chr(9),2) sunset $crlf $+
<mr> $str($chr(9),2) moonrise $crlf $+ <ms> $str($chr(9),2) moonset $crlf $+
<n> $str($chr(9),2) new line $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 $+ <n> $str($chr(9),2) New line $crlf $+ <b><u><r><k>
$chr(9) BURK codes }
alias -l w.ini { return $+(",$scriptdirweatherclient.ini,") }
alias -l w.ver { return 3.2 }
alias -l w.pre { echo -cai1 info * $+(/,$1,
$2- }
alias -l w.back { weather $w.rlw }
alias -l w.trig {
if ($chan) && ($1 == $w.rt) && ($w.rb) && ($2-) { set %weather.trigger
$chan $nick | weather $2- }
if (!$chan) && ($1 == $w.rt) && ($w.rb) && ($w.rq) && ($2-) { set %weather
trigger $nick | weather $2- }
}
alias -l w.mxc { var %wtmp $var(%weather.*.nick,0) | while (%wtmp) { if
(!$sock($+(weather.,$gettok($var(%weather.*.nick,%wtmp),2,46),.))) { unset
$($var(%weather.*.nick,%wtmp),1) } | dec %wtmp } }
alias -l w.u.sc { sockclose weather.update | if ($w.rdb) && ($window($+(@
$1))) { aline $+(@,$1) $1 <- $2- } }
alias -l w.slw { sockwrite -n $1- | if ($w.rdb) && ($window($+(@,$1))) {
aline $+(@,$1) $1 -> $2- } }
alias -l w.slr { if ($w.rdb) && ($window($+(@,$1))) { aline $+(@,$1) $1 <-
$2- } }
alias -l w.errmsg {
tokenize 32 $1-
if ($2 == httperr) { return $3- }
if ($2 == toomany) { return Narrow your search. Check $w
url($gettok($($+(%,weather.,$gettok($1,2,46),.loc),2),2-,32)) }
if ($2 == notfound) { return $+(',$replace($gettok($($+(%,weather.
$gettok($1,2,46),.loc),2),2-,32),$+(%,2C),$chr(44),+,$chr(32)),') was not
found, try a nearby city. }
if ($2 > 499) { return No info for this station, try a nearby city. }
return bad search param or no results.
}
alias -l w.url { return http://mobile.wunderground
com/cgi-bin/findweather/getForecast?brand=mobile&query= $+ $replace($1-
$chr(44),$+($chr(37),2C),$chr(32),$chr(43)) }
;------------------------------------------------------------ ini aliases
--------------------------------------------------------
alias -l w.rt { return $readini($w.ini,weather,trigger) }
alias -l w.rb { return $readini($w.ini,weather,bot) }
alias -l w.rc { return $readini($w.ini,weather,maxcon) }
alias -l w.rq { return $readini($w.ini,weather,query) }
alias -l w.rst { return $readini($w.ini,weather,sendtype) }
alias -l w.rlw { return $iif($readini($w.ini,weather,localwthr),$v1) }
alias -l w.rsi { return $readini($w.ini,weather,silent) }
alias -l w.rme { return $readini($w.ini,weather,metric) }
alias -l w.rg { return $readini($w.ini,weather,gui) }
alias -l w.rp { return $readini($w.ini,weather,popup) }
alias -l w.rpr { return $readini($w.ini,weather,proxy) }
alias -l w.rdb { return $readini($w.ini,weather,debug) }
;----------------------------------------------------------- command line
--------------------------------------------------------
alias wslog { if ($1) { writeini $w.ini weather debug $iif($1 == on,1,0) } |
if (!%w.s) { w.pre wslog debug logging is $+($iif($w.rdb,en,dis),abled) } }
alias wproxy { if ($1) { writeini $w.ini weather proxy $iif($1 == on
$iif($gettok($w.rpr,3,32) || $3,1,0),0) $iif($3,$2-3,$gettok($w.rpr,2-3,32))
} | if (!%w.s) { w.pre wproxy proxy support is $iif($gettok($w.rpr,1,32),on
off) $iif($gettok($w.rpr,2-,32),$+($chr(40),$replace($v1,$chr(32),![]()
$chr(41))) } }
alias wbrowser { if ($1-) || ($w.rlw) { run $w.url($v1) } | if (!$1) && (!$w
rlw) { w.pre wbrowser insufficient parameters } }
alias wdefaults {
if ($1 == yes) { wsilent off | wsendtype msg | wpopup scm | wdisplay echo
| wbot on | wmaxcon 3 60 | wquery off | wtrigger !weather | wmetric off |
wspam Type /<type> <chan> <trigger> <-i/-m> <US zipcode, 'city, province',
or 'city, country'> for INTL weather (connections allowed: <con> - private
<type> support: <query>) | woutput From <city> (<time>) temp(<temp>)
cond(<cond>) wind(<wind>) hu(<hu>) dewpnt(<dewpnt>) bp(<bp>)
clouds(<clouds>) vis(<vis>) | wproxy off 0 0 | wslog off }
if ($1 != yes) { w.pre wdefaults are you sure you want to do this? }
}
alias wconfig { wpopup | wdisplay | wmetric | wbot | wsendtype | wsilent |
wmaxcon | wtrigger | wquery | wproxy | wslog | wspam | woutput }
alias wmetric { if ($1) { writeini $w.ini weather metric $iif($1 == on,1,0)
} | if (!%w.s) { w.pre wmetric metric measurements are $iif($w.rme,enabled
disabled) } }
alias wspam {
if ($1 ischan) || ($chr(35) == $left($1,1)) || ($chr(38) == $left($1,1)) {
if ($w.rb) { var %wtemp $replace($readini($w.ini,weather,spam),<trigger>
$w.rt,<con>,$+($replace($w.rc,$chr(32),/),s),<query>,$iif($w.rq,on,off)
<type>,$iif($w.rst,notice,msg),<chan>,$1,<k>,$chr(3),<b>,$chr(2),<u>
$chr(31),<r>,$chr(22),<n>,$chr(13)) | var %wtmp 1 | while ($numtok(%wtemp
13) >= %wtmp) { $iif($w.rst,notice,msg) $1 $gettok(%wtemp,%wtmp,13) | inc
%wtmp } }
if (!$w.rb) { w.pre wspam requests are disabled, msg cannot be sent }
}
if ($1 !ischan) && ($chr(35) != $left($1,1)) && ($chr(38) != $left($1,1))
&& ($1) { writeini $w.ini weather spam $1- | if (!%w.s) { w.pre wspam
$readini($w.ini,weather,spam) } }
if (!$1) && (!%w.s) { w.pre wspam $readini($w.ini,weather,spam) }
}
alias wupdate { if ($sock(weather.update)) { return } | sockopen weather
update $iif($gettok($w.rpr,1,32),$gettok($w.rpr,2-,32),plastic.xsintrk.net
80) | dialog $iif($dialog(w.vcheck),-v,-mo) w.vcheck w.vcheck | did -ra w
vcheck 1 Status: connecting.. }
alias woutput { if ($1) { writeini $w.ini weather output $1- } | if (!%w.s)
{ w.pre woutput $readini($w.ini,weather,output) } }
alias wreadme { $iif($isfile($+(",$scriptdirreadme-weather.txt,")),run $+("
$scriptdirreadme-weather.txt,"),w.pre weather readme-weather.txt was not
found in $+(",$scriptdir,")) }
alias wmaxcon { if ($1) { writeini $w.ini weather maxcon $iif($1 isnum,$1
unlimited) $iif($2 && $2 isnum,$v1,$gettok($w.rc,2,32)) } | if ($2) &&
($timer(wmaxcon)) { .timerwmaxcon -o 1 $gettok($w.rc,2,32) w.mxc } | if (!%w
s) { w.pre wmaxcon $iif($gettok($w.rc,1,32) isnum,$v1,unlimited) connection
$+ $iif($gettok($w.rc,1,32) != 1,s are,$chr(32) is) allowed every $gettok($w
rc,2,32) $+(second,$iif($gettok($w.rc,2,32) != 1,s)) } }
alias wtrigger { if ($1) { writeini $w.ini weather trigger $1- } | if (!%w
s) { w.pre wtrigger request trigger is $w.rt } }
alias wbot { if ($1) { writeini $w.ini weather bot $iif($1 == on,1,0) } | if
(!%w.s) { w.pre wbot requests are $iif($w.rb,enabled,disabled) } }
alias wpanic { sockclose weather.* | unset %weather.* | if (!%w.s) { w.pre
wpanic all weather sockets were closed } }
alias wunload { if ($1 == yes) { w.pre weather Unloaded $+(",$script,") |
unload -rs $+(",$script,") } | if ($1 != yes) { w.pre wunload 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 wdisplay local report
shown in $iif($w.rg,a GUI,the active window) } }
alias wquery { if ($1) { writeini $w.ini weather query $iif($1 == on,1,0) }
| if (!%w.s) { w.pre wquery query support is $iif($w.rq,enabled,disabled) }
}
alias wsendtype { if ($1) { writeini $w.ini weather sendtype $iif($1 ==
notice,1,0) } | if (!%w.s) { w.pre wsendtype bot replies will be sent by
$iif($w.rst,NOTICE,MSG) } }
alias wsilent { if ($1) { writeini $w.ini weather silent $iif($1 == on,1,0)
} | if (!%w.s) { w.pre wsilent bot replies will $iif(!$w.rsi,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 ($w.rp == 1) { w.pre wpopup enabled for all windows and menubar
popups | goto end }
if (!$w.rp) { w.pre wpopup client menu is disabled | goto end } | var
%wtmp $w.rp | 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 wpopup enabled for
$iif($numtok(%wtemp,32) != 1,$left(%wtmp,-1) and) $gettok(%wtemp
$numtok(%wtemp,32),32) popups
unset %wtemp
}
:end
}
alias weather {
if ($1 == -m) || ($1 == -i) { if ($2) { var %wtemp $1- } | if (!$2) {
$iif(%weather.trigger,unset %weather.trigger,w.pre weather insufficient
parameters) } }
if ($1 != -m) && ($1 != -i) { if ($1-) { var %wtemp $replace($w.rme,0,-i,1
-m) $1- } | if (!$1-) { $iif($w.rlw,$iif(%weather.trigger,unset %weather
trigger,w.back),w.pre weather insufficient parameters) } }
var %w.ticks $ticks
if (%weather.trigger) { if ($var(%weather.*.nick,0) < $gettok($w.rc,1,32))
|| ($gettok($w.rc,1,32) == unlimited) { set $+(%,weather.,%w.ticks,.nick)
%weather.trigger | if (!$timer(wmaxcon)) { .timerwmaxcon -o 1 $gettok($w.rc
2,32) w.mxc } | goto next } }
if (!%weather.trigger) { if (%wtemp) { if ($1 != -m) && ($1 != -i) {
writeini $w.ini weather localwthr $gettok(%wtemp,2-,32) } | :next | set $+(%
weather.,%w.ticks,.loc) $gettok(%wtemp,1,32) $replace($gettok(%wtemp,2-,32)
$chr(44),$+($chr(37),2C),$chr(32),$chr(43)) | sockopen $($+(weather.,%w
ticks,.),2) $iif($gettok($w.rpr,1,32),$gettok($w.rpr,2-,32),mobile
wunderground.com 80) } }
unset %weather.trigger
}
;----------------------------------------------------------- socket scripts
------------------------------------------------------
on *:sockopen:weather.*: {
if ($w.rdb) { window -l $+(@,$sockname) }
if ($gettok($sockname,2,46) isnum) {
if ($sockerr) { w.pre weather there was a socket error $+($chr(40)
$sockerr,$chr(41)) | unset $+(%,weather.,$gettok($sockname,2,46),.*) |
return }
w.slw $sockname GET $iif($gettok($w.rpr,1,32),http://mobile.wunderground
com:80) $+ /cgi-bin/findweather/getForecast?brand=mobile&query= $+
$gettok($($+(%,weather.,$gettok($sockname,2,46),.loc),2),2-,32) HTTP/1.0
w.slw $sockname Accept: */*
w.slw $sockname Accept-Language: en-us
w.slw $sockname Accept-Encoding: gzip, deflate
w.slw $sockname User-Agent: Mozilla/4.0 (compatible; MSIE 5.0; Windows
98; DigExt)
w.slw $sockname Host: mobile.wunderground.com
if ($gettok($w.rpr,1,32)) { w.sw $sockname Proxy-Connection: close }
w.slw $sockname
sockmark $sockname $gettok($($+(%,weather.,$gettok($sockname,2,46),.loc)
2),1,32) $+ $chr(1)
}
if ($gettok($sockname,2,46) == update) {
did -ra w.vcheck 1 Status: connected, sent request
if ($sockerr) { did -ra w.vcheck 1 Status: socket error $+($chr(40)
$sockerr,$chr(41)) | return }
w.slw $sockname GET $iif($gettok($w.rpr,1,32),http://plastic.xsintrk
net:80) $+ /mirc/weatherclient/version.txt HTTP/1.0
w.slw $sockname User-Agent: $+(WeatherClient,/,$w.ver)
w.slw $sockname Host: plastic.xsintrk.net
w.slw $sockname Accept: */*
w.slw $sockname Accept-Language: en
if ($gettok($w.rpr,1,32)) { w.slw $sockname Proxy-Connection: close }
w.slw $sockname Accept-Charset: windows-1252, utf-8, utf-16, iso-8859-1
q=0.6, *;q=0.1
w.slw $sockname Accept-Encoding: deflate, gzip, x-gzip, identity, *;q=0
w.slw $sockname
}
}
on *:sockread:weather.*: {
var %w.buf
sockread -f %w.buf
if ($gettok($sockname,2,46) isnum) {
if (HTTP/* iswm %w.buf) && ($gettok(%w.buf,2,32) != 200) && (!$($+(%
weather.,$gettok($sockname,2,46),.inc),2)) { set $+(%,weather.
$gettok($sockname,2,46),.inc) httperr %w.buf }
if (*Click on a city name for the forecast.* iswm %w.buf) ||
(*<th>Place: Temperature</th>* iswm %w.buf) { set $+(%,weather.
$gettok($sockname,2,46),.inc) toomany }
if (*City Not Found* iswm %w.buf) { set $+(%,weather.,$gettok($sockname
2,46),.inc) notfound }
;sun/moon
if ($($+(%,weather.,$gettok($sockname,2,46),.inc),2) == 20) &&
(*<td>moon set</td>* iswm %w.buf) { sockmark $sockname $sock($sockname).mark
$+ $gettok($gettok(%w.buf,6,62),1,60) $+ $chr(1) | w.slr $sockname * moonset
$($+(%,weather.,$gettok($sockname,2,46),.inc),2) | inc $+(%,weather.
$gettok($sockname,2,46),.inc) }
if ($($+(%,weather.,$gettok($sockname,2,46),.inc),2) == 19) &&
(*<td>moon rise</td>* iswm %w.buf) { sockmark $sockname $sock($sockname)
mark $+ $gettok($gettok(%w.buf,6,62),1,60) $+ $chr(1) | w.slr $sockname *
moonrise $($+(%,weather.,$gettok($sockname,2,46),.inc),2) | inc $+(%,weather
,$gettok($sockname,2,46),.inc) }
if ($($+(%,weather.,$gettok($sockname,2,46),.inc),2) == 18) &&
(*<td>sunset</td>* iswm %w.buf) { sockmark $sockname $sock($sockname).mark
$+ $gettok($gettok(%w.buf,6,62),1,60) $+ $chr(1) | w.slr $sockname * sunset
$($+(%,weather.,$gettok($sockname,2,46),.inc),2) | inc $+(%,weather.
$gettok($sockname,2,46),.inc) }
if ($($+(%,weather.,$gettok($sockname,2,46),.inc),2) == 17) &&
(*<td>sunrise</td>* iswm %w.buf) { sockmark $sockname $sock($sockname).mark
$+ $gettok($gettok(%w.buf,6,62),1,60) $+ $chr(1) | w.slr $sockname * sunrise
$($+(%,weather.,$gettok($sockname,2,46),.inc),2) | inc $+(%,weather.
$gettok($sockname,2,46),.inc) }
;clouds
if ($($+(%,weather.,$gettok($sockname,2,46),.inc),2) == 16) && ($+(*
$chr(40),*,$chr(41),*) iswm %w.buf) { sockmark $sockname $sock($sockname)
mark $remove(%w.buf,$chr(40),$chr(41)) $+ : }
if ($($+(%,weather.,$gettok($sockname,2,46),.inc),2) == 16) &&
(*<span*>*;ft</span> iswm %w.buf) { sockmark $sockname $sock($sockname).mark
$gettok($gettok(%w.buf,3,62),1,60) $+ $chr(44) }
if ($($+(%,weather.,$gettok($sockname,2,46),.inc),2) == 16) && (*</tr>*
iswm %w.buf) { sockmark $sockname $sock($sockname).mark $chr(1) | w.slr
$sockname * end of clouds $($+(%,weather.,$gettok($sockname,2,46),.inc),2) |
inc $+(%,weather.,$gettok($sockname,2,46),.inc) }
if ($($+(%,weather.,$gettok($sockname,2,46),.inc),2) == 15) &&
(*<td>Clouds</td>* iswm %w.buf) { w.slr $sockname * clouds $($+(%,weather.
$gettok($sockname,2,46),.inc),2) | inc $+(%,weather.,$gettok($sockname,2,46)
.inc) }
;visibility
if ($($+(%,weather.,$gettok($sockname,2,46),.inc),2) == 13) &&
(*<td>Visibility</td>* iswm %w.buf) { w.slr $sockname * pressure $($+(%
weather.,$gettok($sockname,2,46),.inc),2) | inc $+(%,weather.
$gettok($sockname,2,46),.inc) }
if ($($+(%,weather.,$gettok($sockname,2,46),.inc),2) == 14) { if
(*<span*>*</span>* iswm %w.buf) || (*- iswm %w.buf) { sockmark $sockname
$sock($sockname).mark $+ $iif($gettok($gettok(%w.buf,3,62),1,60),$v1,N/A) $+
$chr(1) | w.slr $sockname * pressure $($+(%,weather.,$gettok($sockname,2,46)
.inc),2) | inc $+(%,weather.,$gettok($sockname,2,46),.inc) } }
;conditions
if ($($+(%,weather.,$gettok($sockname,2,46),.inc),2) == 12) &&
(*<td><b>*</b></td></tr>* iswm %w.buf) { sockmark $sockname $sock($sockname)
mark $+ $gettok($gettok(%w.buf,3,62),1,60) $+ $chr(1) | w.slr $sockname *
conditions $($+(%,weather.,$gettok($sockname,2,46),.inc),2) | inc $+(%
weather.,$gettok($sockname,2,46),.inc) }
;pressure
if ($($+(%,weather.,$gettok($sockname,2,46),.inc),2) == 10) &&
(*<td>Pressure</td>* iswm %w.buf) { w.slr $sockname * pressure $($+(%
weather.,$gettok($sockname,2,46),.inc),2) | inc $+(%,weather.
$gettok($sockname,2,46),.inc) }
if ($($+(%,weather.,$gettok($sockname,2,46),.inc),2) == 11) { if
(*<span*>*</span>* iswm %w.buf) || (*- iswm %w.buf) { sockmark $sockname
$sock($sockname).mark $+ $iif($gettok($gettok(%w.buf,3,62),1,60),$v1,N/A) $+
$chr(1) | w.slr $sockname * pressure $($+(%,weather.,$gettok($sockname,2,46)
.inc),2) | inc $+(%,weather.,$gettok($sockname,2,46),.inc) } }
;wind
if ($($+(%,weather.,$gettok($sockname,2,46),.inc),2) == 9) && (*<b>*</b>
at* iswm %w.buf) { sockmark $sockname $sock($sockname).mark $+ $removecs(%w
buf,<b>,</b>,at) }
if ($($+(%,weather.,$gettok($sockname,2,46),.inc),2) == 9) { if
(*<span*>*</span> iswm %w.buf) || (*</td></tr>* iswm %w.buf) { sockmark
$sockname $sock($sockname).mark $gettok($gettok(%w.buf,3,62),1,60) $+
$chr(1) | w.slr $sockname * wind $($+(%,weather.,$gettok($sockname,2,46),
inc),2) | inc $+(%,weather.,$gettok($sockname,2,46),.inc) } }
;dewpoint
if ($($+(%,weather.,$gettok($sockname,2,46),.inc),2) == 8) &&
(*</td></tr>* iswm %w.buf) { inc $+(%,weather.,$gettok($sockname,2,46),.inc)
}
if ($($+(%,weather.,$gettok($sockname,2,46),.inc),2) == 7) &&
(*<span*>*</span> iswm %w.buf) { sockmark $sockname $sock($sockname).mark $+
$gettok($gettok(%w.buf,3,62),1,60) $+ $chr(1) | inc $+(%,weather.
$gettok($sockname,2,46),.inc) }
if ($($+(%,weather.,$gettok($sockname,2,46),.inc),2) == 7) && (*- iswm
%w.buf) { sockmark $sockname $sock($sockname).mark $+ N/A $+ $chr(1) | inc
$+(%,weather.,$gettok($sockname,2,46),.inc) }
if ($($+(%,weather.,$gettok($sockname,2,46),.inc),2) == 6) && (*<td>Dew
Point</td>* iswm %w.buf) { w.slr $sockname * dewpoint $($+(%,weather.
$gettok($sockname,2,46),.inc),2) | inc $+(%,weather.,$gettok($sockname,2,46)
.inc) }
;humidity
if ($($+(%,weather.,$gettok($sockname,2,46),.inc),2) == 5) &&
(*<td><b>*</b></td></tr> iswm %w.buf) { sockmark $sockname $sock($sockname)
mark $+ $remove($gettok($gettok(%w.buf,3,62),1,60),%) $+ $chr(1) | w.slr
$sockname * humidity $($+(%,weather.,$gettok($sockname,2,46),.inc),2) | inc
$+(%,weather.,$gettok($sockname,2,46),.inc) }
;temperature
if ($($+(%,weather.,$gettok($sockname,2,46),.inc),2) == 4) &&
(*<span*>*</span>* iswm %w.buf) { sockmark $sockname $sock($sockname).mark
$+ $gettok($gettok(%w.buf,3,62),1,60) $+ $chr(1) | inc $+(%,weather.
$gettok($sockname,2,46),.inc) }
if ($($+(%,weather.,$gettok($sockname,2,46),.inc),2) == 4) && (*</td>*
iswm %w.buf) { sockmark $sockname $sock($sockname).mark $+ N/A $+ $chr(1) |
inc $+(%,weather.,$gettok($sockname,2,46),.inc) }
if ($($+(%,weather.,$gettok($sockname,2,46),.inc),2) == 3) &&
(*<td>Temperature</td>* iswm %w.buf) { w.slr $sockname * temperature $($+(%
weather.,$gettok($sockname,2,46),.inc),2) | inc $+(%,weather.
$gettok($sockname,2,46),.inc) }
;obs
if ($($+(%,weather.,$gettok($sockname,2,46),.inc),2) == 2) && (<b>*</b>
iswm %w.buf) { sockmark $sockname $sock($sockname).mark $+
$gettok($gettok($gettok(%w.buf,1-,32),2,62),1,60) $+ $chr(1) | w.slr
$sockname * obs station $($+(%,weather.,$gettok($sockname,2,46),.inc),2) |
inc $+(%,weather.,$gettok($sockname,2,46),.inc)
$iif(!$remove($gettok($gettok($gettok(%w.buf,1-,32),2,62),1,60),$chr(32)
$chr(44)),500) }
;update time
if ($($+(%,weather.,$gettok($sockname,2,46),.inc),2) == 1) && (*Updated:
<b>* iswm %w.buf) { sockmark $sockname $sock($sockname).mark $+
$gettok($gettok($gettok(%w.buf,2-8,32),2,62),1,60) $+ $chr(1) | w.slr
$sockname * update time $($+(%,weather.,$gettok($sockname,2,46),.inc),2) |
inc $+(%,weather.,$gettok($sockname,2,46),.inc) }
;city
if (*<title>* Forecast</title>* iswm %w.buf) { sockmark $sockname
$sock($sockname).mark $+ $gettok(%w.buf,$+(2-,$calc($numtok(%w.buf,32) - 1))
32) $+ $chr(1) | w.slr $sockname * city $($+(%,weather.,$gettok($sockname,2
46),.inc),2) | inc $+(%,weather.,$gettok($sockname,2,46),.inc) }
}
if ($gettok($sockname,2,46) == update) {
did -ra w.vcheck 1 Status: downloading info
if (HTTP/* iswm %w.buf) && ($gettok(%w.buf,2,32) != 200) { did -ra w
vcheck 1 Status: $gettok(%w.buf,2-,32) | w.u.sc $sockname %w.buf | return }
if ($remove($gettok(%w.buf,1,32),$chr(46)) isnum) { did -ra w.vcheck 1
Status: $iif($gettok(%w.buf,1,32) > $w.ver,new version! $+($chr(40)
$gettok(%w.buf,1,32),$chr(41)),no new version $+($chr(40),$gettok(%w.buf,1
32),$chr(41))) | did -e w.vcheck 2,3 | did -ra w.vcheck 5 %w.buf | w.u.sc
$sockname %w.buf | return }
}
w.slr $sockname %w.buf
}
on *:sockclose:weather.*: {
if ($w.rdb) && ($window($+(@,$sockname))) { aline $+(@,$sockname)
$sockname * stored: $sock($sockname).mark }
if ($gettok($sockname,2,46) isnum) {
if ($($+(%,weather.,$gettok($sockname,2,46),.inc),2) == 21) {
set %w.s 1
var %wtemp $w.rme
wmetric $replace($gettok($sock($sockname).mark,1,1),-i,off,-m,on)
if (!$($+(%,weather.,$gettok($sockname,2,46),.nick),2)) && ($w.rg) { w
outgui $sockname $sock($sockname).mark | goto next }
var %wtemp2 $replace($w.out($sock($sockname).mark),<n>,$chr(13))
var %wtmp 1
while ($numtok(%wtemp2,13) >= %wtmp) {
if ($($+(%,weather.,$gettok($sockname,2,46),.nick),2)) {
if ($w.rsi) { $iif($w.rst,.notice,.msg)) $($+(%,weather.
$gettok($sockname,2,46),.nick),2) $+ $iif($numtok($($+(%,weather.
$gettok($sockname,2,46),.nick),2),32) == 2,
$gettok(%wtemp2,%wtmp,13) }
if (!$w.rsi) { $iif($w.rst,notice,msg)) $($+(%,weather.
$gettok($sockname,2,46),.nick),2) $+ $iif($numtok($($+(%,weather.
$gettok($sockname,2,46),.nick),2),32) == 2,
$gettok(%wtemp2,%wtmp,13) }
}
if (!$($+(%,weather.,$gettok($sockname,2,46),.nick),2)) && (!$w.rg)
{ w.pre weather $gettok(%wtemp2,%wtmp,13) }
inc %wtmp
}
:next
wmetric $replace(%wtemp,0,off,1,on)
unset %w.s
}
if ($($+(%,weather.,$gettok($sockname,2,46),.inc),2) != 21) {
if ($($+(%,weather.,$gettok($sockname,2,46),.nick),2)) {
if ($w.rsi) { $iif($w.rst,.notice,.msg)) $($+(%,weather.
$gettok($sockname,2,46),.nick),2) $+ $iif($numtok($($+(%,weather.
$gettok($sockname,2,46),.nick),2),32) == 2,
$w.errmsg($sockname $($+(%
weather.,$gettok($sockname,2,46),.inc),2)) }
if (!$w.rsi) { $iif($w.rst,notice,msg)) $($+(%,weather.
$gettok($sockname,2,46),.nick),2) $+ $iif($numtok($($+(%,weather.
$gettok($sockname,2,46),.nick),2),32) == 2,
$w.errmsg($sockname $($+(%
weather.,$gettok($sockname,2,46),.inc),2)) }
}
if (!$($+(%,weather.,$gettok($sockname,2,46),.nick),2)) { w.pre
weather $w.errmsg($sockname $($+(%,weather.,$gettok($sockname,2,46),.inc)
2)) }
}
unset $+(%,weather.,$gettok($sockname,2,46),.loc), $+(%,weather.
$gettok($sockname,2,46),.inc)
}
}
;--------------------------------------------------------- popup menu
----------------------------------------------------------
menu * {
$iif($w.po,Weather client $w.ver $chr(9) /weather)
.$iif(!$isfile($+(",$scriptdirreadme-weather.txt,")),$style(2)) View
readme-weather.txt: wreadme
.Weather client webpage: run http://plastic.xsintrk.net/mirc/weatherclient
.Panic! $+($chr(40),Close sockets,$chr(41)): w.fm wpanic
.-
.Check local weather...: weather $$input(Enter US zipcode or 'city $+
$chr(44) province'.,ei,Weather client,$w.rlw)
.Check latest version...: wupdate
.$iif(!$chan || !$w.rb,$style(2)) Spam $iif($chan,$v1,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))
..Proxy setup...: w.fm wproxy $replace($gettok($w.rpr,1,32),1,on,0,off)
$$input(Enter the proxy you wish to use. $crlf $+ Syntax: host port,eq,Proxy
setup,$gettok($w.rpr,2-3,32)) ..Local display $+ $chr(58) $chr(9)
$replace($w.rg,1,gui,0,echo): w.fm wdisplay $iif($w.rg,echo,gui)
..Popup placement
...$iif(s isin $w.rp,$style(1)) Status: w.fm wpopup $iif(s isin $w.rp
$remove($w.rp,s),$+($remove($w.rp,1,0),s))
...$iif(c isin $w.rp,$style(1)) Channel: w.fm wpopup $iif(c isin $w.rp
$remove($w.rp,c),$+($remove($w.rp,1,0),c))
...$iif(m isin $w.rp,$style(1)) Menubar: w.fm wpopup $iif(m isin $w.rp
$remove($w.rp,m),$+($remove($w.rp,1,0),m))
...$iif(n isin $w.rp,$style(1)) Nicklist: w.fm wpopup $iif(n isin $w.rp
$remove($w.rp,n),$+($remove($w.rp,1,0),n))
...$iif(q isin $w.rp,$style(1)) Queries: w.fm wpopup $iif(q isin $w.rp
$remove($w.rp,q),$+($remove($w.rp,1,0),q))
...-
...$iif($w.rp == 1,$style(1)) All menus: w.fm wpopup all
...No menus: w.fm wpopup none
..-
..Allow requests $+ $chr(58) $chr(9) $replace($w.rb,1,yes,0,no): w.fm wbot
$iif($w.rb,off,on)
..Request trigger $+ $chr(58) $chr(9) $w.rt: w.fm wtrigger $$input(Enter
weather request trigger.,eq,Trigger setup,$w.rt)
..Connections $+ $chr(58) $chr(9) $+($replace($w.rc,$chr(32),/),s): { w.fm
wmaxcon $$input(Enter X maximum connections allowed per Y seconds. $crlf $+
Syntax: X Y,eq,Connect limit,$w.rc) }
..Use metrics $+ $chr(58) $chr(9) $replace($w.rme,1,yes,0,no): w.fm
wmetric $iif($w.rme,off,on)
..Send reply as $+ $chr(58) $chr(9) $replace($w.rst,1,notice,0,msg): w.fm
wsendtype $iif($w.rst,msg,notice)
..Reply silently $+ $chr(58) $chr(9) $replace($w.rsi,1,yes,0,no): w.fm
wsilent $iif($w.rsi,off,on)
..Support queries $+ $chr(58) $chr(9) $replace($w.rq,1,yes,0,no): w.fm
wquery $iif($w.rq,off,on)
..-
..Use proxy $+ $chr(58) $chr(9) $replace($gettok($w.rpr,1,32),1,yes,0,no):
w.fm wproxy $iif($gettok($w.rpr,1,32),off,on)
..Socket logs $+ $chr(58) $chr(9) $replace($w.rdb,1,yes,0,no): w.fm wdebug
$iif($w.rdb,off,on)
..Local display $+ $chr(58) $chr(9) $replace($w.rg,1,gui,0,echo): w.fm
wdisplay $iif($w.rg,echo,gui)
.-
.Unload Weather client $w.ver: { $iif($$input(Do you want to unload
Weather client $w.ver $+ ?,yw,Unload),wunload yes,return) }
}
menu @weather.* {
Save as: savebuf $active $$sfile($+(",$scriptdir,$right($active,-1),.log")
Save as,Save)
Close: window -c $active
}
;-------------------------------------------------------------- gui
-----------------------------------------------------------------
dialog w.vcheck {
title "Update check"
size -1 -1 92 38
option -dbu
text "", 1, 5 5 82 7
button "View readme" 2, 5 20 40 13
button "Download", 3, 48 20 40 13, ok
button "", 4, 0 0 0 0, cancel
text "", 5, 0 0 0 0
}
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($gettok($did($dname,5).text,1,60),2-,32) } | if ($did == 4) {
sockclose weather.update } }
dialog w.dial {
title ""
size -1 -1 190 120
option -dbu
box "", 1, 5 3 180 110
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
text "Sunrise:", 18, 23 68 50 7
edit "", 19, 43 66 50 11, read, autohs
text "Sunset:", 20, 111 68 50 7
edit "", 21, 130 66 50 11, read, autohs
text "Moonrise:", 22, 19 80 50 7
edit "", 23, 43 78 50 11, read, autohs
text "Moonset:", 24, 107 80 50 7
edit "", 25, 130 78 50 11, read, autohs
button "Copy to clipboard (same format as weather display)", 26, 10 95 170
13
button "" 27, 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 == 26) {
clipboard
var %wtemp $replace($readini($w.ini,weather,output),<city>
$gettok($dialog($dname).title,4-,32),<obs>,$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),<sr>,$gettok($did(19).text,1,32),<ss>,$gettok($did(21).text,1,32),<mr>
$gettok($did(23).text,1,32),<ms>,$gettok($did(25).text,1,32),<k>,$chr(3),<b>
$chr(2),<u>,$chr(31),<r>,$chr(22),<n>,$chr(13))
var %wtmp 1
while ($numtok(%wtemp,13) >= %wtmp) { clipboard -an $gettok(%wtemp,%wtmp
13) | inc %wtmp }
}
}