here is a weather script, i have modified it a bit.
i hope you like it.
Trigger:
!w
!f
For ideas to add more in it, paste it in the comments ^^ ty.
and greetz to make this script Scakk!!Very nice!!!
someone can edit it to see the coutry when i type the zip code??
post it in the comments pls.
on $*:text:/^!w(eather)?|f(orecast)?/Si:#: {
if ($2 isnum) {
if ($istok(!w !weather,$1,32)) { set %usweatherWF W }
if ($istok(!f !forecast,$1,32)) { set %usweatherWF F }
set %usweatherzip $2 | set %usweatherchan $chan
sockopen usweather www.localweather.net 80
}
}
on *:sockopen:usweather: {
sockwrite -n $sockname GET $+(/weather/?pands=,%usweatherzip,&forecast=zandh) HTTP/1.1
sockwrite -n $sockname Host: www.localweather.net
sockwrite -n $sockname Connection: close
sockwrite -n $sockname Authorization: Basic
sockwrite -n $sockname $crlf
}
on *:sockread:usweather: {
sockread %whtemp
if (warnings.html isin %whtemp) { set %whtempwarn $remove($nohtml(%whtemp),$chr(9),Advisories) }
if (Location Not Found isin %whtemp) { set %whtempwrong Yes }
if (class="pname"> isin %whtemp) { set %whtemplocation $remove($nohtml(%whtemp),$chr(9)) }
; Weather
if (Lat: isin %whtemp) { set %whtemplat $remove($nohtml(%whtemp),$chr(9)) }
if (class="u-met"> isin %whtemp) { inc %t_t 1 | set %whtemperC $+ %t_t $remove($nohtml(%whtemp),$chr(9)) }
; Forecast
if (class="dt"> isin %whtemp) { inc %yy 1 | set %suweatherdate $+ %yy $remove($nohtml(%whtemp),$chr(9)) }
if (class="hi"> isin %whtemp) { inc %ii 1 | set %suweatherhi $+ %ii $remove($nohtml(%whtemp),$chr(9)) }
if (class="lo"> isin %whtemp) { inc %iii 1 | set %suweatherlo $+ %iii $remove($nohtml(%whtemp),$chr(9)) }
if (class="wx"> isin %whtemp) { inc %oo 1 | set %suweathercondition $+ %oo $remove($nohtml(%whtemp),$chr(9)) }
}
on *:sockclose:usweather: {
if (%whtempwrong = Yes) {
msg %usweatherchan 4[Wetter]11 hat zip code is incorrect. Please try another one.
unset %t_t %y_y %whtemp* %usweather* %suweather* %oo %yy %ii
}
else {
msg %usweatherchan 4[Wetterscript modified by LGrobert]7
if (%usweatherWF = W) {
var %whcurF $gettok(%whtemperC1,1,38) $+ $chr(176) F
var %whcurC $calc(($gettok(%whtemperC1,1,38) - 32) 8 5/9) $+ $chr(176) C
msg %usweatherchan 4[Wetter]11 Latitude:03 $removecs($gettok(%whtemplat,4,58),N,E,S,W,Lon) Longitude:03 $removecs($gettok(%whtemplat,5,58),N,E,S,W,Lon)
msg %usweatherchan 4[Wetter]11 Currently:07 %whcurF /07 %whcurC and $gettok(%whtemperC1,2-,67) $&
Feels Like:7 $replace($gettok($remove(%whtemperC2,Feels Like:),1,70),°,$+($chr(176),$chr(32),F)) $&
/07 $round($calc($gettok($remove(%whtemperC2,Feels Like:),1,38) -32) *5/9),1) $+ $+($chr(176),$chr(32),C)
msg %usweatherchan 4[Wetter]11 Dew Point:13 $replace($gettok($gettok(%whtemperC3,2,58),1,70),°,$chr(176)) $+ $+($chr(32),F)) $&
/13 $round($calc($gettok($remove(%whtemperC3,Dew Point:),1,38) -32) *5/9),1) $+ $+($chr(176),$chr(32),C) $&
Pressure:10 $+($gettok($remove(%whtemperC5,Pressure:),1,110),n) /10 $gettok(%whtemperC5,2,110)
if (%whtempwarn) { msg %usweatherchan 4[Wetter]11 Weather Warning: $+ $+($chr(3),4,%whtempwarn) }
msg %usweatherchan 4[end of Weather.try !forecast <ZIP>]7
}
if (%usweatherWF = F) {
msg %usweatherchan 4[Wetter]11 $+ $usweather(%suweatherdate2) 4>>12 $iif(%suweatherhi1 = %suweatherlo2,$usweather2(%suweatherlo1),$usweather2($v1)) 4>>>3 %suweathercondition2
msg %usweatherchan 4[Wetter]11 $+ $usweather(%suweatherdate3) 4>>12 $usweather2(%suweatherhi1) 4>>>3 %suweathercondition3
msg %usweatherchan 4[Wetter]11 $+ $usweather(%suweatherdate4) 4>>12 $usweather2(%suweatherhi2) 4>>>3 %suweathercondition4
msg %usweatherchan 4[Wetter]11 $+ $usweather(%suweatherdate5) 4>>12 $usweather2(%suweatherhi3) 4>>>3 %suweathercondition5
msg %usweatherchan 4[Wetter]11 $+ $usweather(%suweatherdate6) 4>>12 $usweather2(%suweatherhi4) 4>>>3 %suweathercondition6
msg %usweatherchan 4[Wetter]11 $+ $usweather(%suweatherdate7) 4>>12 $usweather2(%suweatherhi5) 4>>>3 %suweathercondition7
msg %usweatherchan 4[Wetter]11 $+ $usweather(%suweatherdate8) 4>>12 $usweather2(%suweatherhi6) 4>>>3 %suweathercondition8
$iif($gettok(%suweatherdate9,2,32) isnum,msg %usweatherchan 4[Wetter]11 $+ $usweather(%suweatherdate9) 4>>12 $usweather2(%suweatherhi7) 4>>>3 %suweathercondition9 )
$iif($gettok(%suweatherdate10,2,32) isnum,msg %usweatherchan 4[Wetter]11 $+ $usweather(%suweatherdate10) 4>>12 $usweather2(%suweatherhi8) 4>>>3 %suweathercondition10 )
}
unset %t_t %y_y %whtemp* %usweather* %suweather* %oo %yy %ii %iii
}
}
alias usweather {
return $iif($istokcs(MON TUE WED THU FRI SAT SUN,$left($1,3),32),$replace($1,$left($1,3),$+($left($1,3),$chr(32))),$+($1,$chr(32)))
}
alias usweather2 {
return $replacecs($replace($1,:,$+(:,$chr(32)),°,$+($chr(176),$chr(32))),F,$+(F,$chr(32)))
}
alias -l nohtml {
var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x, )
return %x
}
zipcode = american only. :[
Also if goes by city & state/county then people don't have to post their location for all to see. (not sure if ZIP's are like in the UK where a postcode will narrow location down to a single street.)
I'm not going to try it out until it's more universal, so I can't rate it yet.
Agreed, this is not working. It appears that the localweather website is no longer allowing the connections.