Weather Script w/5-day Forecast

Platform:  mIRC
Published  Apr 25, 2009
Updated  Sep 01, 2013

Wunderground weather script with dialogs pictures and 5-day forecast.
This also has a trigger w/on-off switch. The trigger is !Forecast because I figure most people already have one thats !weather. Syntax for the trigger is !Forecast city state
or !Forecast country city or !Forecast zipcode or !Forecast airportcode.
******************************************
If you only want the weather, use !weather
******************************************
You can find the dialogs on any menu and they are fairly self explanatory. One easy change you can make is the default city in the script. I have it set to my city.
To change it goto line 37.
It will look like this
Code
 
Just change Cincinnati Ohio to your city state and it will always start there.
I've only tested this on my connection, which is pretty decent. I hope it works as good with slower connections.
05/01/2009 -- Changed Trigger From !Wunderground to !Forecast ;Wunderground Weather Script by Ford_Lawnmower irc://irc.geekshed.net #Script-Help
dialog CurrentConditions {
title "Current Conditions"
size -1 -1 184 136
option dbu
text "", 1, 0 1 193 8
icon 2, 8 16 23 23
text "", 3, 40 24 41 16, center
text "Humidity:", 4, 8 48 33 8
text "Dew Point:", 5, 8 56 33 8
text "Wind:", 6, 8 64 33 8
text "Wind Gust:", 7, 8 72 33 8
text "Pressure:", 8, 8 80 33 8
text "Heat Index:", 9, 8 88 33 8
text "Visibility:", 10, 8 96 33 8
text "UV:", 11, 8 104 33 8
text "Clouds:", 12, 8 112 33 8
text "Elevation", 13, 8 120 33 8
text "", 14, 40 48 49 8
text "", 15, 40 56 49 8
text "", 16, 40 64 49 8
text "", 17, 40 72 49 8
text "", 18, 40 80 49 8
text "", 19, 40 88 49 8
text "", 20, 40 96 49 8
text "", 21, 40 104 49 8
text "", 22, 40 112 109 8
text "", 23, 40 120 49 8
icon 24, 104 16 63 63
button "5-Day Forecast", 25, 96 123 41 12, disable
button "Close", 26, 144 123 37 12, cancel
text "Enter City State or Zip Code", 27, 96 88 81 8, center
edit "", 28, 96 96 82 10, autohs
button "Search", 29, 152 107 29 12
text "", 30, 8 128 81 8
}
On *:Dialog:CurrentConditions:init:*: { Wunderground Cincinnati Ohio }
On *:Dialog:CurrentConditions:Close:*: {
if (!$dialog(5-DayForecast)) { hfree WundergroundDialog }
}
On *:Dialog:CurrentConditions:Sclick:25: {
if ($dialog(5-DayForecast)) {
did -a 5-DayForecast 1 $hget(WundergroundDialog,location)
var %5-days = $gettok($hget(WundergroundDialog,days),0,32)
while (%5-days) {
did -a 5-DayForecast $calc(%5-days + 1) $gettok($hget(WundergroundDialog,days),%5-days,32)
did -g 5-DayForecast $calc(%5-days + 6) $+(Wunderground\,$nopath($hget(WundergroundDialog,$+(day,%5-days,pic))))
did -a 5-DayForecast $calc(%5-days + 11) $+($hget(WundergroundDialog,$+(day,%5-days,high)),|,$hget(WundergroundDialog,$+(day,%5-days,low)))
did -a 5-DayForecast $calc(%5-days + 16) $hget(WundergroundDialog,$+(day,%5-days,condition))
dec %5-days
}
}
else { 5-Day }
}
On *:Dialog:CurrentConditions:Sclick:29: {
if ($did(CurrentConditions,28).text) { Wunderground $did(CurrentConditions,28).text }
else { did -a CurrentConditions 30 No search Item!! | .timer 1 3 did -a CurrentConditions 30 }
}
dialog 5-DayForecast {
title "5-Day Forecast"
size -1 -1 208 64
option dbu
text "", 1, 0 0 209 8, center
text "", 2, 4 8 41 8, center
text "", 3, 44 8 41 8, center
text "", 4, 84 8 41 8, center
text "", 5, 124 8 41 8, center
text "", 6, 164 8 41 8, center
icon 7, 16 16 15 15
icon 8, 56 16 15 15
icon 9, 96 16 15 15
icon 10, 136 16 15 15
icon 11, 176 16 15 15
text "", 12, 4 32 41 8, center
text "", 13, 44 32 41 8, center
text "", 14, 84 32 41 8, center
text "", 15, 124 32 41 8, center
text "", 16, 164 32 41 8, center
text "", 17, 4 40 41 24, center
text "", 18, 44 40 41 24, center
text "", 19, 84 40 41 24, center
text "", 20, 124 40 41 24, center
text "", 21, 164 40 41 24, center
}
On *:Dialog:5-DayForecast:Close:*: {
if (!$dialog(CurrentConditions)) { hfree WundergroundDialog }
}
On *:Dialog:5-DayForecast:init:*: {
did -a 5-DayForecast 1 $hget(WundergroundDialog,location)
var %5-days = $gettok($hget(WundergroundDialog,days),0,32)
while (%5-days) {
did -a 5-DayForecast $calc(%5-days + 1) $gettok($hget(WundergroundDialog,days),%5-days,32)
did -g 5-DayForecast $calc(%5-days + 6) $+(Wunderground\,$nopath($hget(WundergroundDialog,$+(day,%5-days,pic))))
did -a 5-DayForecast $calc(%5-days + 11) $+($hget(WundergroundDialog,$+(day,%5-days,high)),|,$hget(WundergroundDialog,$+(day,%5-days,low)))
did -a 5-DayForecast $calc(%5-days + 16) $hget(WundergroundDialog,$+(day,%5-days,condition))
dec %5-days
}
}
alias -l Wunderground.timeout {
if (%Wunder.chan != dialog) { .msg %Wunder.chan Nothing Found... :( | if ($hget(%Wunder.name)) { hfree %Wunder.name } }
else { did -a CurrentConditions 30 Nothing Found!! | .timer 1 3 did -a CurrentConditions 30 }
Wunderground.clear
}
alias -l Wunderground.clear {
sockclose %Wunder.name
unset %getpic.*
unset %Wunder*
.timer-Wunderground off
halt
}
alias Wunderground {
.enable #5day
set %Wunder.nick $me
set %Wunder.chan dialog
set %Wunder.name $+(Wunderground,%Wunder.chan)
if ($hget(%Wunder.name)) { hfree %Wunder.name }
if ($dialog(CurrentConditions)) { did -b CurrentConditions 25 }
hmake %Wunder.name 5
sockclose $+(Wunderground,%Wunder.chan)
set %Wunderurl $+(/cgi-bin/findweather/getForecast?query=,$replace($1-,$chr(32),$+(%,20)),&wuSelect=WEATHER)
set %Wundersite classic.wunderground.com
sockopen %Wunder.name %Wundersite 80
.timer-Wunderground 1 10 Wunderground.timeout
}
#Wunderground.trigger on
on $*:TEXT:/^!(Forecast|Weather)+/Si:# {
if (!$timer(wunderground)) {
.timerwunderground 1 5 noop
$iif($regml(1) == forecast,.enable,.disable) #5day
set %Wunder.inuse 1
set %Wunder.nick $nick
set %Wunder.chan $chan
set %Wunder.name $+(Wunderground,%Wunder.chan)
if ($hget(%Wunder.name)) { hfree %Wunder.name | hmake %Wunder.name 5 }
else { hmake %Wunder.name 5 }
sockclose %Wunder.name
set %Wunderurl $+(/cgi-bin/findweather/getForecast?query=,$replace($2-,$chr(32),$+(%,20)),&wuSelect=WEATHER)
set %Wundersite classic.wunderground.com
sockopen $+(Wunderground,$chan) %Wundersite 80
.msg $chan Weather Search in Progress. Please Wait.....
.timer-Wunderground 1 10 Wunderground.timeout
}
}
#Wunderground.trigger end
on *:sockopen:Wunderground*: {
sockwrite -n $sockname GET %Wunderurl HTTP/1.1
sockwrite -n $sockname Host: %Wundersite $+ $CRLF $+ $CRLF
}
on *:sockread:Wunderground*: {
if ($sockerr > 0) { echo -a >Socket Error< | Wunderground.clear }
else {
var %Wundervar | sockread %Wundervar
if (Scroll down to view a list of all all cities isin %Wundervar) {
if (%Wunder.chan == dialog) && ($dialog(CurrentConditions)) { did -a CurrentConditions 30 Country match. Be more Specific. | .timer 1 3 did -a CurrentConditions 30 }
else { .msg %Wunder.chan You searched for a Country. Be more specific. | if ($hget(%Wunder.name)) { hfree %Wunder.name } }
Wunderground.clear
}
if (Click on a column heading to sort this information isin %Wundervar) {
if (%Wunder.chan == dialog) && ($dialog(CurrentConditions)) { did -a CurrentConditions 30 Be more Specific. | .timer 1 3 did -a CurrentConditions 30 }
else { .msg %Wunder.chan Too many results! Be more specific. | if ($hget(%Wunder.name)) { hfree %Wunder.name } }
Wunderground.clear
}
if (There has been an error isin %Wundervar) {
if (%Wunder.chan == dialog) && ($dialog(CurrentConditions)) { did -a CurrentConditions 30 Location Doesn't exist | .timer 1 3 did -a CurrentConditions 30 }
else { .msg %Wunder.chan Location Doesn't exist!! | if ($hget(%Wunder.name)) { hfree %Wunder.name } }
Wunderground.clear
}
if (<div id="curcondbox"> isin %Wundervar) { set %Wunder.Box On }
if (5-Day Forecast isin %Wundervar) && ($dialog(CurrentConditions)) && (%Wunder.Chan == dialog) {
hadd %Wunder.name 5-Day On
did -e CurrentConditions 25
}
if ($between(%Wundervar,<img src="," height="140",1)) {
if (jpg isin $right($between(%Wundervar,<img src="," height="140",1),3)) {
hadd %Wunder.name radarlink $between(%Wundervar,<img src="," height="140",1)
getrad $hget(%wunder.name,radarlink) $nopath($hget(%wunder.name,radarlink))
if ($hget(%Wunder.name,radarlink)) && (%wunder.chan == dialog) {
.timer 1 5 did -g Currentconditions 24 $+(Wunderground\,$nopath($hget(%Wunder.name,radarlink)))
}
}
else {
hadd %Wunder.name radarlink temppic.gif
getrad $between(%Wundervar,<img src="," height="140",1) temppic.gif
if (%wunder.chan == dialog) {
if ($hget(%Wunder.name,radarlink)) { .timer 1 5 did -g Currentconditions 24 $+(Wunderground\,temppic.gif) }
}
}
}
if (%Wunder.Box == On) {
if (Humidity: isin %Wundervar) { set %Wunder.Humidity On }
if (Dew Point: isin %Wundervar) { set %Wunder.dewpoint On }
if (Wind: isin %Wundervar) { set %Wunder.wind On }
if (Wind Gust: isin %Wundervar) { set %Wunder.windgust On }
if (Pressure: isin %Wundervar) { set %Wunder.pressure On }
if (Heat Index: isin %Wundervar) { set %Wunder.heatindex On }
if (Visibility: isin %Wundervar) { set %Wunder.visibility On }
if (UV: isin %Wundervar) { set %Wunder.UV On }
if (Clouds: isin %Wundervar) { set %Wunder.clouds On }
if (Elevation: isin %Wundervar) { set %Wunder.elevation On }
if (titleSubtle">Temperature isin %Wundervar) { set %Wunder.temp On }
if ($between(%Wundervar,<div class="subG b">,</div>,1)) {
hadd %Wunder.name location $between(%Wundervar,<div class="subG b">,</div>,1)
}
if ((<span class="nobr"><span class="b"> isin %Wundervar) && (!$hget(%Wunder.name,temperature))) {
hadd %Wunder.name temperature $deg($httpstrip(%Wundervar))
}
if ($between(%Wundervar,<td class="vaM taC"><img src="," width="42",1)) {
hadd %Wunder.name ConditionLink $between(%Wundervar,<td class="vaM taC"><img src="," width="42",1)
getpik $hget(%Wunder.name,Conditionlink) $nopath($hget(%Wunder.name,Conditionlink))
}
if ($between(%Wundervar,<div class="b" style="font-size: 14px;">,</div>,1)) {
hadd %Wunder.name condition $between(%Wunder,<div class="b" style="font-size: 14px;">,</div>,1)
}
if (<span class="nobr"><span class="b"> isin %Wundervar) && (%Wunder.elevation) {
hadd %Wunder.name elevation $httpstrip(%Wundervar)
unset %Wunder.elevation
unset %Wunder.Box
}
if ($between(%Wundervar,<b>,</b>,1)) && (%Wunder.clouds) {
hadd %Wunder.name clouds $between(%Wundervar,<b>,</b>,1)
unset %Wunder.clouds
}
if ($between(%Wundervar,<td class="b">,</td>,1)) && (%Wunder.UV) {
hadd %Wunder.name UV $httpstrip(%Wundervar)
unset %Wunder.UV
}
if (<span class="nobr"><span class="b"> isin %Wundervar) && (%Wunder.visibility) {
hadd %Wunder.name visibility $httpstrip(%Wundervar)
unset %Wunder.visibility
}
if (<span class="nobr"><span class="b"> isin %Wundervar) && (%Wunder.heatindex) {
hadd %Wunder.name heatindex $deg($httpstrip(%Wundervar))
unset %Wunder.heatindex
}
if ($between(%Wundervar,<b>,</b>,1)) && (%Wunder.pressure) {
hadd %Wunder.name pressure $httpstrip(%Wundervar)
unset %Wunder.pressure
}
if (<span class="nobr"><span class="b"> isin %Wundervar) && (%Wunder.windgust) {
hadd %Wunder.name windgust $httpstrip(%Wundervar)
unset %Wunder.windgust
}
if (<span class="nobr"><span class="b"> isin %Wundervar) && (%Wunder.wind) {
hadd %Wunder.name wind $httpstrip(%Wundervar)
unset %Wunder.wind
}
if (<span class="nobr"><span class="b"> isin %Wundervar) && (%Wunder.dewpoint) {
hadd %Wunder.name dewpoint $deg($httpstrip(%Wundervar))
unset %Wunder.dewpoint
}
if ($between(%Wundervar,<td class="full b"><span class="pwsrt",</nobr></span></td>,1)) && (%Wunder.humidity) {
hadd %Wunder.name humidity $httpstrip(%Wundervar)
unset %Wunder.humidity
}
}
if (<tr class="wHover noBorder"> isin %Wundervar) { set %Wunder.5-day On | unset %Wunder.Box }
if (<td class="taC" style="width: isin %Wundervar) && (</td> isin %Wundervar) {
hadd %Wunder.name days $hget(%Wunder.name,days) $httpstrip(%Wundervar)
}
if (<td>Enable</td> isin %Wundervar) {
if (%Wunder.chan == dialog) && ($dialog(CurrentConditions)) {
if ($hget(%Wunder.name,location)) { did -a Currentconditions 1 $hget(%Wunder.name,location) }
if ($hget(%Wunder.name,temperature)) { did -a Currentconditions 3 $hget(%Wunder.name,temperature) }
if ($hget(%Wunder.name,humidity)) { did -a Currentconditions 14 $hget(%Wunder.name,humidity) }
if ($hget(%Wunder.name,dewpoint)) { did -a Currentconditions 15 $hget(%Wunder.name,dewpoint) }
if ($hget(%Wunder.name,wind)) { did -a Currentconditions 16 $hget(%Wunder.name,wind) }
if ($hget(%Wunder.name,windgust)) { did -a Currentconditions 17 $hget(%Wunder.name,windgust) }
if ($hget(%Wunder.name,pressure)) { did -a Currentconditions 18 $hget(%Wunder.name,pressure) }
if ($hget(%Wunder.name,heatindex)) { did -a Currentconditions 19 $hget(%Wunder.name,heatindex) }
if ($hget(%Wunder.name,visibility)) { did -a Currentconditions 20 $hget(%Wunder.name,visibility) }
if ($hget(%Wunder.name,UV)) { did -a Currentconditions 21 $hget(%Wunder.name,UV) }
if ($hget(%Wunder.name,clouds)) { did -a Currentconditions 22 $hget(%Wunder.name,clouds) }
if ($hget(%Wunder.name,elevation)) { did -a Currentconditions 23 $hget(%Wunder.name,elevation) }
if ($hget(%Wunder.name,conditionlink)) { .timer 1 5 did -g Currentconditions 2 $+(Wunderground\,$nopath($hget(%Wunder.name,conditionlink))) }
}
else {
.msg %wunder.chan $colorz(Weather for $hget(%Wunder.name,location) Temperature: $hget(%Wunder.name,temperature) Humidity: $hget(%Wunder.name,humidity) $&
Dew Point: $hget(%Wunder.name,dewpoint) Wind: $hget(%Wunder.name,wind) Pressure: $hget(%Wunder.name,pressure) Heat Index: $&
$hget(%Wunder.name,heatindex) Visibility: $hget(%Wunder.name,visibility) Clouds: $hget(%Wunder.name,clouds)) $+ .
if ($group(#5day) == off) { Wunderground.clear }
}
}
if (<td class="full">Forecast for isin %Wundervar) {
if (%Wunder.chan != dialog) { hfree %Wunder.name }
Wunderground.clear
}
if ($group(#5day) == on) {
if (%Wunder.5-day == On) {
if (<tr class="wHover noBorder"> isin %Wundervar) && ($hget(%Wunder.name,day5pic)) {
if (%Wunder.chan == dialog) && $dialog(CurrentConditions) {
WunderGround.Clear
}
else {
.msg %wunder.chan $colorz(5-Day Forecast - $gettok($hget(%Wunder.name,days),1,32) $hget(%Wunder.name,day1high)  $hget(%Wunder.name,day1low) $&
$hget(%Wunder.name,day1condition) - $gettok($hget(%Wunder.name,days),2,32) $hget(%Wunder.name,day2high)  $hget(%Wunder.name,day2low) $&
$hget(%Wunder.name,day2condition) - $gettok($hget(%Wunder.name,days),3,32) $hget(%Wunder.name,day3high)  $hget(%Wunder.name,day3low) $&
$hget(%Wunder.name,day3condition) .)
.msg %wunder.chan $colorz(5-Day Forecast - $gettok($hget(%Wunder.name,days),4,32) $hget(%Wunder.name,day4high)  $hget(%Wunder.name,day4low) $&
$hget(%Wunder.name,day4condition) - $gettok($hget(%Wunder.name,days),5,32) $hget(%Wunder.name,day5high)  $hget(%Wunder.name,day5low) $&
$hget(%Wunder.name,day5condition) .)
hfree %Wunder.name
}
wunderground.clear
}
if ($between(%Wundervar,<div><img src="," alt=",1)) && (!$hget(%Wunder.name,day5pic)) && ($hget(%Wunder.name,day4pic)) {
hadd %Wunder.name day5pic $between(%Wundervar,<div><img src="," alt=",1)
hadd %Wunder.name day5condition $between(%Wundervar,alt="," width="42",1)
.timer 1 5 getpic $hget(%Wunder.name,day5pic) $nopath($hget(%Wunder.name,day5pic))
}
if ($between(%Wundervar,<span style="color: #900;">,</span>,1)) && (!$hget(%Wunder.name,day5high)) && ($hget(%Wunder.name,day4high)) {
hadd %Wunder.name day5high $deg($between(%Wundervar,<span style="color: #900;">,</span>,1))
}
if ($between(%Wundervar,<span style="color: #009;">,</span>,1)) && (!$hget(%Wunder.name,day5low)) && ($hget(%Wunder.name,day4low)) {
hadd %Wunder.name day5low $deg($between(%Wundervar,<span style="color: #009;">,</span>,1))
}
if ($between(%Wundervar,<div><img src="," alt=",1)) && (!$hget(%Wunder.name,day4pic)) && ($hget(%Wunder.name,day3pic)) {
hadd %Wunder.name day4pic $between(%Wundervar,<div><img src="," alt=",1)
hadd %Wunder.name day4condition $between(%Wundervar,alt="," width="42",1)
.timer 1 4 getpic $hget(%Wunder.name,day4pic) $nopath($hget(%Wunder.name,day4pic))
}
if ($between(%Wundervar,<span style="color: #900;">,</span>,1)) && (!$hget(%Wunder.name,day4high)) && ($hget(%Wunder.name,day3high)) {
hadd %Wunder.name day4high $deg($between(%Wundervar,<span style="color: #900;">,</span>,1))
}
if ($between(%Wundervar,<span style="color: #009;">,</span>,1)) && (!$hget(%Wunder.name,day4low)) && ($hget(%Wunder.name,day3low)) {
hadd %Wunder.name day4low $deg($between(%Wundervar,<span style="color: #009;">,</span>,1))
}
if ($between(%Wundervar,<div><img src="," alt=",1)) && (!$hget(%Wunder.name,day3pic)) && ($hget(%Wunder.name,day2pic)) {
hadd %Wunder.name day3pic $between(%Wundervar,<div><img src="," alt=",1)
hadd %Wunder.name day3condition $between(%Wundervar,alt="," width="42",1)
.timer 1 3 getpic $hget(%Wunder.name,day3pic) $nopath($hget(%Wunder.name,day3pic))
}
if ($between(%Wundervar,<span style="color: #900;">,</span>,1)) && (!$hget(%Wunder.name,day3high)) && ($hget(%Wunder.name,day2high)) {
hadd %Wunder.name day3high $deg($between(%Wundervar,<span style="color: #900;">,</span>,1))
}
if ($between(%Wundervar,<span style="color: #009;">,</span>,1)) && (!$hget(%Wunder.name,day3low)) && ($hget(%Wunder.name,day2low)) {
hadd %Wunder.name day3low $deg($between(%Wundervar,<span style="color: #009;">,</span>,1))
}
if ($between(%Wundervar,<div><img src="," alt=",1)) && (!$hget(%Wunder.name,day2pic)) && ($hget(%Wunder.name,day1pic)) {
hadd %Wunder.name day2pic $between(%Wundervar,<div><img src="," alt=",1)
hadd %Wunder.name day2condition $between(%Wundervar,alt="," width="42",1)
.timer 1 2 getpic $hget(%Wunder.name,day2pic) $nopath($hget(%Wunder.name,day2pic))
}
if ($between(%Wundervar,<span style="color: #900;">,</span>,1)) && (!$hget(%Wunder.name,day2high)) && ($hget(%Wunder.name,day1high)) {
hadd %Wunder.name day2high $deg($between(%Wundervar,<span style="color: #900;">,</span>,1))
}
if ($between(%Wundervar,<span style="color: #009;">,</span>,1)) && (!$hget(%Wunder.name,day2low)) && ($hget(%Wunder.name,day1low)) {
hadd %Wunder.name day2low $deg($between(%Wundervar,<span style="color: #009;">,</span>,1))
}
if ($between(%Wundervar,<div><img src="," alt=",1)) && (!$hget(%Wunder.name,day1pic)) {
hadd %Wunder.name day1pic $between(%Wundervar,<div><img src="," alt=",1)
hadd %Wunder.name day1condition $between(%Wundervar,alt="," width="42",1)
.timer 1 1 getpic $hget(%Wunder.name,day1pic) $nopath($hget(%Wunder.name,day1pic))
}
if ($between(%Wundervar,<span style="color: #900;">,</span>,1)) && (!$hget(%Wunder.name,day1high)) {
hadd %Wunder.name day1high $deg($between(%Wundervar,<span style="color: #900;">,</span>,1) )
}
if ($between(%Wundervar,<span style="color: #009;">,</span>,1)) && (!$hget(%Wunder.name,day1low)) {
hadd %Wunder.name day1low $deg($between(%Wundervar,<span style="color: #009;">,</span>,1))
}
}
}
}
}
alias -l deg {
return $replace($1-,&deg;,$chr(186),&#176;,$chr(176)) $iif(F isin $1-,$FtoC($remove($1-,&deg;,&#176;,F)),$CtoF($remove($1-,&deg;,&#176;,C)))
}
Alias -l GetPic {
if ($sock($+(getpic,$2))) { return }
if ($isfile($+(wunderground\,$2))) { return }
set %GetPic.Site $gettok($remove($1,http://),1,47)
set %GetPic.URL $remove($1,$gettok($1,1,47),$gettok($1,2,47),//)
set %GetPic.PicName $2
if (!$isdir($+($mircdir,wunderground))) { mkdir wunderground }
sockopen $+(GetPic,%getpic.picname) %getpic.site 80
}
On *:sockopen:GetPic*:{
sockwrite -nt $sockname GET %getpic.url HTTP/1.0
sockwrite $sockname Host: %getpic.site $+ $crlf $+ $crlf
}
On *:sockread:GetPic*:{
if (!$sock($sockname).mark) {
var %GetPic.var | sockread %GetPic.var
if (%GetPic.var == $null) { sockmark $sockname 1 }
}
else {
sockread &picture
bwrite $qt($+($mircdir,wunderground\,%getpic.picname)) -1 -1 &picture
}
}
Alias -l GetPik {
if ($isfile($+(wunderground\,$2))) { return }
sockclose GetPik
set %GetPik.Site $gettok($remove($1,http://),1,47)
set %GetPik.URL $remove($1,$gettok($1,1,47),$gettok($1,2,47),//)
set %GetPik.PicName $2
if (!$isdir($+($mircdir,wunderground))) { mkdir wunderground }
sockopen GetPik %GetPik.site 80
}
On *:sockopen:GetPik:{
sockwrite -nt $sockname GET %GetPik.url HTTP/1.0
sockwrite $sockname Host: %GetPik.site $+ $crlf $+ $crlf
}
On *:sockread:GetPik:{
if (!$sock($sockname).mark) {
var %GetPik.var | sockread %GetPik.var
if (%GetPik.var == $null) { sockmark $sockname 1 }
}
else {
sockread &pict
bwrite $qt($+($mircdir,wunderground\,%GetPik.picname)) -1 -1 &pict
}
}
On *:sockclose:GetPik:{
unset %GetPik.*
}
alias -l CurrentConditions {
if ($dialog(CurrentConditions)) { dialog -v CurrentConditions CurrentConditions }
else { dialog -m CurrentConditions CurrentConditions }
}
alias -l 5-Day {
if ($dialog(5-DayForecast)) { dialog -v 5-DayForecast 5-DayForecast }
else { dialog -m 5-DayForecast 5-DayForecast }
}
Alias -l GetRad {
if ($isfile($+(wunderground\,$2))) { .remove $+(wunderground/,$2) }
set %GetRad.Site $gettok($remove($1,http://),1,47)
set %GetRad.URL $remove($1,$gettok($1,1,47),$gettok($1,2,47),//)
set %GetRad.PicName $2
if (!$isdir($+($mircdir,wunderground))) { mkdir wunderground }
sockclose GetRad
sockopen GetRad %GetRad.site 80
}
On *:sockopen:GetRad:{
sockwrite -nt $sockname GET %GetRad.url HTTP/1.0
sockwrite $sockname Host: %GetRad.site $+ $crlf $+ $crlf
}
On *:sockread:GetRad:{
if (!$sock($sockname).mark) {
var %GetRad.var | sockread %GetRad.var
if (%GetRad.var == $null) { sockmark $sockname 1 }
}
else {
sockread &pict
bwrite $qt($+($mircdir,wunderground\,%GetRad.picname)) -1 -1 &pict
}
}
On *:sockclose:GetRad:{
unset %GetRad.*
}
;alias by Gummo
alias -l between {
noop $regex($1,/\Q $+ $2 $+ \E(.*?)\Q $+ $3 $+ \E/gi)
return $regml($4)
}
alias -l httpstrip {
var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x,&nbsp;,$chr(9),$chr(13))
return %x
}
alias -l colorz {
var %string = $1-, %count = $gettok($1-,0,32), %counter = 1, %return
var %c1 04
var %c2 04
while (%counter <= %count) {
if ($left($gettok(%string,%counter,32),1) isalpha) {
%return = %return $+(,%c1,$left($gettok(%string,%counter,32),1),,%c2,$right($gettok(%string,%counter,32),$calc($len($gettok(%string,%counter,32)) - 1)),)
}
else { %return = %return $gettok(%string,%counter,32) }
inc %counter
}
$iif($isid,return,say) %return
}
alias -l FtoC { $iif($isid,return,echo -a) $+($round($calc((5 / 9) * ($1 - 32)),0),°,C) }
alias -l CtoF { $iif($isid,return,echo -a) $+($round($calc(((9 / 5) * $1) + 32),0),°,F) }
menu * {
Wunderground
.Weather Dialogs:CurrentConditions
.$iif($group(#Wunderground.Trigger) == On,$style(1)) Wunderground Trigger
..$iif($group(#Wunderground.Trigger) == On,$style(2)) On: .enable #Wunderground.Trigger
..$iif($group(#Wunderground.Trigger) == Off,$style(2)) Off: .disable #Wunderground.Trigger
-
}
#5day off
#5day end

Comments

Sign in to comment.
PackardBell   -  Aug 25, 2013
@FordLawnmower
don't know why, but i get the 'Â' thing between all numbers...

<Found> Weather Search in Progress. Please Wait.....
<Found> Weather for Drongen, Drongen, OOST VLAANDEREN (PWS) Temperature: 23.2ºC 74°F Humidity: 59% Dew Point: 15ºC 59°F Wind: 4.0km/h Pressure: 1012hPa Heat Index: 25ºC 77°F Visibility: 10.0kilometers Clouds: Scattered Clouds.
<Found> 5-Day Forecast - Sunday 24º C 75°F  13º C 55°F Chance of Rain - Monday 26º C 79°F  14º C 57°F Clear - Tuesday 26º C 79°F  14º C 57°F Mostly Cloudy .
<Found> 5-Day Forecast - Wednesday 26º C 79°F  13º C 55°F Chance of Rain - Thursday 25º C 77°F  12º C 54°F Mostly Cloudy .

Can it be an override from another script?

Thx for the help
 Respond  
PackardBell   -  Jun 01, 2013
@FordLawnmower
i copied the script from your pastebin
but i get this

[01/06/13|17:37:12] <+testing> !weather Deinze
[01/06/13|17:37:15] <@Found> Weather for 04D04rongen, 04D04rongen, 04O04OST 04V04LAANDEREN (PWS) 04T04emperature: 12.3ºC 54°F 04H04umidity: 78% 04D04ew 04P04oint: 9ºC 48°F 04W04ind: 8.2km/h 04P04ressure: 1022hPa 04H04eat 04I04ndex: 04V04isibility: 10.0kilometers 04C04louds: 04F04ew.
[01/06/13|17:37:22] <@Found> Nothing Found... :(

1: it shows the forecast at this moment : not the 5-day forecast
2: !forecast and !weather give same results?
3: After a couple of triggers, it automaticly says "Nothing Found... :(" -> but it has found something!

Thx for helping
 Respond  
cptpan   -  Jul 24, 2012
Y U NO ADD AUSTRALIA???????????????????????????????
 Respond  
chachin   -  May 18, 2012
hey thanks a lot @FordLawnmower.. this script looks awesome and its almost instantaneous at looking and posting it on irc. but could you be awesome and help me make the script from the pastebin.com look more like this

[7:47:11pm] <chachin> !w
[7:47:14pm] <+Amy> Baytown, Texas (29.8°N 95.0°W) - Updated: 19:47 CDT
[7:47:14pm] <+Amy> Conditions: Clear - Temperature: 25.2°C (77.3°F) - High/Low: 31/17°C (88/63°F)
[7:47:14pm] <+Amy> Dew Point: 18°C (64°F) - Humidity: 65%
[7:47:14pm] <+Amy> Wind: SSE at 0.0 MPH (0.0 KPH)

[7:49:18pm] <chachin> !fc
[7:49:21pm] <+Amy> Baytown, Texas Forecast (High/Low) - Updated: 19:47 CDT
[7:49:21pm] <+Amy> Friday: Partly Cloudy, 31/17°C (88/63°F)
[7:49:21pm] <+Amy> Saturday: Partly Cloudy, 30/18°C (86/64°F)
[7:49:21pm] <+Amy> Sunday: Partly Cloudy, 30/20°C (86/68°F)
 Respond  
FordLawnmower   -  May 14, 2012
@chachin Unfortunately this script has also fallen victim to the parsing issue in the code box here.
Please get the code from here for the time being. :: http://pastebin.com/P6nB0aV8
 Respond  
chachin   -  Apr 23, 2012
why on my side i see the script like this:

[4:04:27] <@chachin> !forecast 77521
[4:04:27] <@chick3n> Weather Search in Progress. Please Wait.....
[4:04:29] <@chick3n> Weather for East Harris County, Baytown, Texas (PWS) Temperature: 75.8&nbsp;&deg;F 0°C Humidity: 33% Dew Point: 45&nbsp;&deg;F 0°C Wind: 5.0&nbsp;mph Pressure: 30.12&nbsp;in Heat Index: 77&nbsp;&deg;F 0°C Visibility: 10.0&nbsp;miles Clouds: Few.
[4:04:31] <@chick3n> 5-Day Forecast - Monday 79&deg; F 0°C  52&deg; F 0°C Clear - Tuesday 79&deg; F 0°C  63&deg; F 0°C Clear - Wednesday 81&deg; F 0°C  70&deg; F 0°C Partly Cloudy .
[4:04:32] <@chick3n> 5-Day Forecast - Thursday 82&deg; F 0°C  66&deg; F 0°C Partly Cloudy - Friday 84&deg; F 0°C  72&deg; F 0°C Mostly Cloudy .

you know the 45&nbsp;&deg;F things?
 Respond  
BigSteve   -  Dec 31, 2011
is wunderground down
 Respond  
DragonHeart   -  Sep 26, 2011
Works just as described Ford! Another great script!
 Respond  
Donovan   -  May 07, 2011
Hey is it possible to just hide all the Celcius readings? Also, its not reading the degree sign..just showing a random symbol
 Respond  
JoKabua   -  Apr 06, 2011
I have question on the weather code. Is any diff weather use timer.. went i type .wz location it will show each line in 5 sec? I think i saw one in here..
 Respond  
JoKabua   -  Apr 05, 2011
Thanks
 Respond  
Jethro   -  Apr 05, 2011
My mistake. I made a little oversight earlier:
Code
 
 Respond  
JoKabua   -  Apr 05, 2011
I want this one only .
 Respond  
JoKabua   -  Apr 05, 2011
Ford is any way i can change !w to .w?
 Respond  
jasonh   -  Mar 18, 2011
thanks for keeping your great scripts updated
 Respond  
FordLawnmower   -  Feb 26, 2011
@Henco I posted an update for this a couple of weeks ago. Should be working now.
 Respond  
Jethro   -  Feb 26, 2011
Henco, you have to be absolutely certain that Ford's script stops working for you, not the rest of people. ;o
 Respond  
Henco   -  Feb 26, 2011
This seems to be broken :(
 Respond  
FordLawnmower   -  Feb 03, 2011
Temp fix on this for now. Trigger script for this is now back to working for !forecast and !weather.
Going to start a rewrite of this from scratch now. It's been patched way too many times now.
 Respond  
FordLawnmower   -  Feb 03, 2011
I just noticed this is broken Snowbound.
I'll start working on fixing it now.
 Respond  
Snowbound   -  Feb 03, 2011
I fixed a typo in the Wundersite var but now I am getting "Sorry, But Somebody else is already looking up their Weather." showing up and I have no idea where the %Wunder.inuse variable is being set all the time but never reset.
 Respond  
Snowbound   -  Feb 02, 2011
I do notice that the old site appears to still be available at classic.wunderground.com however changing the set %Wundersite classic.wunderground.com still results in Nothing Found... :( when one searches for a forecast.
 Respond  
Jethro   -  Feb 02, 2011
Unfortunately that's one of the downsides of utilizing sockets, which is like taking care of your own car...maintenance and more maintenance if needed.
 Respond  
Snowbound   -  Feb 02, 2011
Looks like weatherunderground changed their website and forecast no longer works. :(
 Respond  
Jethro   -  Jan 01, 2011
Well, I think with the auto split feature existed in mIRC's latest built, I don't think that is much of an issue these days. Though I still agree with you; there are still folks who stick with the old versions.
 Respond  
PcGuy   -  Jan 01, 2011
Is there anyway of allowing the windchill temp to be shown?
 Respond  
FordLawnmower   -  Jan 01, 2011
@Jethro_ This was originally 2 lines. The 3rd line was added because it started cutting off on some servers after I added the F to C conversion. The results here do not have fixed lengths so I changed it because the possibility existed for it to run over 2 lines.
I think Blood-King has a very small monitor or viewing area for mirc and he is counting the lines he sees as opposed to the number of lines returned by the server.
 Respond  
Jethro   -  Jan 01, 2011
Pardon me, Ford. :P

Let's say you have 4 lines sent

line1
line2
line3
line4

What I meant was to have 'em sent as:

line1 line2 line3 line4
 Respond  
FordLawnmower   -  Jan 01, 2011
@Blood-King No idea how you get 10 lines when the script only sends 4 (One of them being the searching line).
@Jethro_ No idea what you mean by "horizontally instead of vertically".

AnyHow , I added a !weather trigger that doesn't show the forecast.
Triggers now: !weather !forecast.

Crazy a*ss code ;/ Surprised I could even edit it ;/
 Respond  
Jethro   -  Jan 01, 2011
It'd be less 'spammish' if it's displayed horizontally instead of vertically.
 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.