Weather script for mIRC

By eqrunner on Dec 10, 2009

Screenshots

READ FIRST:
VERSION 5.0 AND UP NOTICE: Script now REQUIRES an API key. You must get your own key in order for you to use version 5.0 and up.
Go to http://www.wunderground.com/weather/api/ and sign up for free. Follow the steps to create a API Key ID. When complete, Insert it into the code below in the 'Preparation' section set %wu_api
wundergoround is phasing out their old xml site and up to Version 4.0 held on as long as possible. The script has been updated to work with wundergrounds new API. I can not give out my API key due to the limit of hits my API key can take before billing gets involved. Sorry for the inconvenience.
/READ FIRST.

Weather Bot Script. Does !WEATHER - !CURRENT - !FORECASTS - !ALERTS - !TIME - !ALMANAC WorldWide coverage.

I built a Weather bot script for that gets its data from wunderground.com site for mIRC. It allows the ability to get the weather, forecasts, alerts, and time from around the world.

I did see there was one for php but needed one for mIRC. weather.com only accepts US zipcodes, and there are users from across the world. This will work with US and outside zipcodes (ex: e2l1n5) or city and state (dallas,tx) or city,country (Sydney,AU or Sydney, Australia) and airports (LAX)

Commands:
!w or !weather [zipcode|city,state|city,country|airport] = will return weather current conditions.
!current [zipcode|city,state|city,country|airport] = will return current conditions.
!forecast [zipcode|city,state|city,country|airport] = will give detailed 3 day forecast (for us)
!forecast5 [zipcode|city,state|city,country|airport] = will send 5 day forecast to $nick that requested. (to prevent chan flooding)
!alerts [zipcode|city,state|city,country|airport] = will tell you if there are any weather alerts in your area.
!alertinfo [zipcode|city,state|city,country|airport] = will send $nick the detailed report of alerts in said area
!time [zipcode|city,state|city,country|airport] = will return current time.
!almanac = Will give almanac records
!moon or !moonphase = Will give the status of the moon

Script uses 1 socket for all above commands, but each command links to slightly different xml page.
It is setup right now to grab all the data from the xml page and set them to all to corresponding variables.(long list of if statements) To view what it returns, just comment out the unset %wu_* at the bottom of the script. execute the script (ex: !weather 90210) and then look at your variables.

on sockclose you will find a lot of $+ and $chr(##) actions. This is to squish the results together and to add items like °F ($chr(176),F) or I have spacers like -|- ($chr(45) $+ $chr(124) $+ $chr(45))
ex: msg %wu_chan %wu_full $+ : %wu_weather and $+(%wu_temp_f,$chr(176),F,$chr(40),%wu_temp_c,$chr(176),C,$chr(41))
gives you City,State: Overcast and 34°F(1°C)

Revisions noted in bottom of script

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;; weather underground for mIRC ;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;by eqrunner ;;v5.41;
;;;;;;http://www.hawkee.com/snippet/7010/;;;;;;;;;;;

/*
-- REQUIRMENTS --
- YOU MUST HAVE AN API CODE TO USE USE VERSION 5.0 AND ABOVE
- Go to http://www.wunderground.com/weather/api/ and sign up for free. 
- Follow the steps to create a API Key ID. 
- When complete, Insert it into the code below in the 'Preperation' section set %wu_api

-- COMMANDS --
!w  or !weather [zipcode|city,state|city,country|airport] = will return weather current conditions.
!current [zipcode|city,state|city,country|airport] = will return current conditions.
!forecast [zipcode|city,state|city,country|airport] = will give detailed 3 day forecast (for us)
!forecast[1-10] [zipcode|city,state|city,country|airport] = will send from 1 day up to 10 day forecast to $nick that requested. (to prevent chan flooding)
!alerts [zipcode|city,state|city,country|airport] = will tell you if there are any weather alerts in your area.
!alertinfo [zipcode|city,state|city,country|airport] = will send $nick the detailed report of alerts in said area
!time [zipcode|city,state|city,country|airport] = will return current time.
!almanac [zipcode|city,state|city,country|airport] = will return the record highs and lows.

-- REGISTER --
Register - Each user can assign a default location with themself. So in the future they can use just the command ( !weather, or !forecast, or !alerts, etc)
![w|forecast|forecast5|alerts|alertinfo|time|current|almanac] REGISTER [zipcode|city,state|city,country|airport] = will link user to said default location
![w|forecast|forecast5|alerts|alertinfo|time|current|almanac] REGISTER [zipcode|city,state|city,country|airport] = will CHANGE users default if they already have registured.
![w|forecast|forecast5|alerts|alertinfo|time|current|almanac] REMOVE = will remove the users default location
User can use any of the !commands to registure. !weather register 90210, will work just as well as !time register 90210

-- HELP --
![w|forecast|forecast5|alerts|alertinfo|time|current|almanac] [?|help] = Will message user the list of above commands just as they are written.

-- Switch --
![w|forecast|forecast5|alerts|alertinfo|time|current|almanac] [ON|OFF] = Will turn the script ON or OFF. Currently only set for Ops only.

-- NOTES- -
Notes from wunderground:
We don't support old style abbreviations like Conn. for Connecticut, use CT
If you are searching for an international city, try the name of the country or province
Don't use provinces for non-us cities (ie: Vancouver, BC)
Zipcodes only work in Canada, UK and the US
*/

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
on *:CONNECT: {
  if ($hget(wu_reg) == $null) { hmake wu_reg 100 }
  if ($isfile(wu_reg.dat)) { hload wu_reg wu_reg.dat }
}
ON *:DISCONNECT: {
  if ($hget(wu_reg)) { hsave -o wu_reg wu_reg.dat }
}

on $*:INPUT:#: {
  if ($regex($1,/^[!](w|weather|forecast|forecast5|alert|alerts|alertinfo|alertsinfo|time|current|almanac|moon|moonphase)?/Si)) wunderground $1-
}

on $*:text:/^[!](w|weather|forecast|forecast5|alert|alerts|alertinfo|alertsinfo|time|current|almanac|moon|moonphase)/Si:#: {
  wunderground $1-
}

;-----------------------------------------------------------------------------
; Preperation
;-----------------------------------------------------------------------------

alias wunderground {
  botabuse 
  unset %wu_*

  ;PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP
  ;--- Preperation. Sets up all the variables needed for the script ---
  set %wu_command $1
  set %wu_2 $2
  set %wu_location $2-
  set %wu_3 $3
  set %wu_3_long $3-
  set %wu_nick $nick
  set %wu_network $network
  set %wu_chan $chan
  set %wu_host api.wunderground.com

  ;APIKEYAPIKEYAPIKEYAPIKEYAPIKEYAPIKEYAPIKEYAPIKEYAPIKEYAPIKEY
  set %wu_api YourAPICodeGoesHere
  ;APIKEYAPIKEYAPIKEYAPIKEYAPIKEYAPIKEYAPIKEYAPIKEYAPIKEYAPIKEY

  ;PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP
  ; Option to Change ! to something else. Simply remove the ; comment and change this to reflect your new command
  ; Displayed is for users who want to use the Period (.) $chr(46)
  ; Below command does this: Replace(%wu_command, "replace .", "with a !")
  ;set %wu_command $replace(%wu_command,$chr(46),$chr(33))

  ;PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP
  ;--- Registration Check. Checks to see if the $nick already has a 'default' location on file ---
  if ($2 == $null) { 
    if ($hget(wu_reg,%wu_nick) != $null) {
      set %wu_location $hget(wu_reg,%wu_nick)
    }
    if ($hget(wu_reg,%wu_nick) == $null) {
      .notice $nick Please specify a location $1 [zipcode|city,state|city,country|airport]
      wu_cleanup
    }
  }

  ;PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP
  ;--- Modify Registration and Help and ON/OFF Switch ---
  if ($2 != $null) {
    if (%wu_2 == register) && (%wu_3 != $null) {
      hadd -m wu_reg %wu_nick %wu_3_long
      .notice %wu_nick You are now linked to %wu_3_long
      set %wu_location $hget(wu_reg,%wu_nick)
      ;echo -s %wu_location
    }
    if (%wu_2 == remove) {
      hdel wu_reg %wu_nick
      .notice %wu_nick Your location association has been removed. 
      wu_cleanup
      halt
    }
    ;;--- Checks to see if the $2 is an already registured nick. ----
    if ($hget(wu_reg,%wu_2) != $null) {
      set %wu_location $hget(wu_reg,%wu_2)
    }
    if (%wu_2 == ?) || (%wu_2 == help) { 
      wu_help 
      wu_cleanup
      halt
    }
    ;;;---Below is used to turn the script on or off, but only if user is an op of a channel ---

    if (%wu_2 == on) || (%wu_2 == off) && (%wu_nick isop %wu_chan) {
      if (%wu_2 == on) {
        set $+(%,wunderground_,%wu_chan) ON
        .notice %wu_nick !weather script is now ON
        wu_cleanup
        halt   
      }
      if (%wu_2 == off) {
        set $+(%,wunderground_,%wu_chan) OFF
        .notice %wu_nick !weather script is now OFF
        wu_cleanup
        halt     
      }
    } ;end of %wu_on/off

    ;--- Default for a channel ---
    if ($2 == shoutdrive) && (%wu_network == iPocalypse) {
      set %wu_location 90046
    } ; end of Default for a channel
    if ($2 == shoutdrive) && (%wu_network == freenode) {
      set %wu_location 90046
    } ; end of Default for a channel

  } ;end of ($2 != $null)

  ;PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP
  ;--- Checks if wunderground is suppost to be OFF for the channel --
  if ($($+(%,wunderground_,%wu_chan),2) == OFF) {
    wu_cleanup
    halt
  }

  ;PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP
  ;---Command Prep. Checks command to see which data file it will be pulling from depending on command entered ---
  ;NEW
  ;Reformats City, State to the corrected  /State/City.xml

  if ($chr(44) isin %wu_location) {
    ;set %wu_location_format $+(/,$remove($gettok(%wu_location,2,44),/,$gettok(%wu_location,1,44))
    var %wu_location_city $replace($gettok(%wu_location,1,44),$chr(32),$chr(95))
    var %wu_location_state $remove($gettok(%wu_location,2,44),$chr(32))
    ;echo -s %wu_location_city %wu_location_State
    set %wu_address $+(/,%wu_location_state,/,%wu_location_city)

    ;echo -s %wu_address
    ;wu_cleanup
    ;halt
  }
  if ($chr(44) !isin %wu_location) {
    set %wu_address $replace(%wu_location,$chr(32),$chr(95))
    ;echo -s %wu_address
    ;wu_cleanup
    ;halt
  }
  ;/NEW

  ;PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP
  ;-- Sets specific %wu_links depending on what is requested.

  ;-- Weather --
  if (%wu_command == !w )  set %wu_command !weather
  if (%wu_command == !weather) || (%wu_command == !current) || (%wu_command == !time) { 
    ;Eample: set %wu_link $+(/api/154dfe245e155eee1/conditions/q/20721.xml)
    set %wu_link $+(/api/,%wu_api,/conditions/q/,%wu_address,.xml)
  }
  ;pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp
  ;-- Forecast --
  ;- Below finds out if it is a !forecast or a !forecast[1-10]. If there is a number,
  ;  then it strips the number and sets %wu_command back to !forecast5 so remainder of the code
  ;  works. and creates a %wu_forecast_count to be used after the sock closes.

  if ($left(%wu_command,9) == !forecast) {
    if ($mid(%wu_command,10,0) > 0)  {
      set %wu_forecast_count $remove(%wu_command,!forecast)
      ; ^ removes !forecast, leaving only the number
      if (%wu_forecast_count > 10) set %wu_forecast_count 10
      ; ^ If number is greater than 10. Changes it to 10. (no one wants 999 days of forecast)
      set %wu_command !forecast5
      ; ^ resets %wu_command back to !forecast5 so the rest of the code works.
    }
  }

  if (%wu_command == !forecast) || (%wu_command == !forecast5) { 
    set %wu_link $+(/api/,%wu_api,/forecast10day/q/,%wu_address,.xml)
  }

  ;pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp
  ;-- Alerts --
  if (%wu_command == !alert) set %wu_command !alerts
  if (%wu_command == !alertsinfo) set %wu_command !alertinfo
  if (%wu_command == !alerts) || (%wu_command == !alertinfo) { 
    set %wu_link $+(/api/,%wu_api,/alerts/q/,%wu_address,.xml)
    set %wu_a_count 0
  }
  ;pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp
  ;-- Almanac --
  if (%wu_command == !almanac) { 
    set %wu_link $+(/api/,%wu_api,/almanac/q/,%wu_address,.xml)
  }
  ;pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp
  ;-- Moon --
  if (%wu_command == !moonphase) set %wu_command !moon
  if (%wu_command == !moon) { 
    set %wu_link $+(/api/,%wu_api,/astronomy/q/,%wu_address,.xml)
  }

  sockopen wunderground %wu_host 80
  ;echo -s LINK: %wu_link
}

;-----------------------------------------------------------------------------
;SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
; SOCKETS
;SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
;-----------------------------------------------------------------------------

on *:sockopen:wunderground: {
  sockwrite -n $sockname GET %wu_link HTTP/1.1
  sockwrite -n $sockname Host: %wu_host
  sockwrite -n $sockname $crlf

}

;SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS

on *:sockread:wunderground: {
  sockread %wu_temp
  if ($regex(%wu_temp,/([[:xdigit:]]{2});/)) {
    set %wu_temp $replace(%wu_temp,$+(&#x,$regml(1),;),$chr($base($regml(1),16,10)))
  }
  set %wu_temp $regsubex(%wu_temp,/[\46\43](\d+)\73/g,$chr(\1))
  set %wu_temp $replacex(%wu_temp,&quot;,",&amp;lt;,<,&amp;rt;,>,&amp;deg;,°,&amp;,&)
  if (<name> isin %wu_temp) && (%wu_name == $null) %wu_name = $remove(%wu_temp,<name>,</name>,$chr(9))

  ;VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
  ;-ERROR-CHECKING-ERROR-CHECKING-ERROR-CHECKING-ERROR-CHECKING-ERROR-CHECKING
  ;checks for an error
  if (<error> isin %wu_temp) set %wu_error Error
  if (%wu_error == Error) && (<description> isin %wu_temp) {
    set %wu_error_description $remove(%wu_temp,<description>,</description>,$chr(9))
  }

  if (<results> isin %wu_temp) set %wu_results ON
  if (%wu_results == ON) {
    if (<result> isin %wu_temp) inc %wu_result_count 
    if (<city> isin %wu_temp) set $+(%,wu_result_city,%wu_result_count) $remove(%wu_temp,<city>,</city>,$chr(9))
    if (<state> isin %wu_temp) set $+(%,wu_result_state,%wu_result_count) $remove(%wu_temp,<state>,</state>,$chr(9))
    if (<country_name> isin %wu_temp) set $+(%,wu_result_country_name,%wu_result_count) $remove(%wu_temp,<country_name>,</country_name>,$chr(9))

  }

  ;-ERROR-CHECKING-ERROR-CHECKING-ERROR-CHECKING-ERROR-CHECKING-ERROR-CHECKING
  ;VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV

  ;set %wu_temp $regsubex(%wu_temp,/&#(\d+)\;/g,$chr(\1))
  ;echo -s %wu_temp

  ;VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
  ;--- Variables for Weather, Current and Time Command ---
  if (%wu_command == !weather) || (%wu_command == !current) || (%wu_command == !time) { 
    ; local info
    if (<full> isin %wu_temp) && (%wu_full == $null) %wu_full = $remove(%wu_temp,<full>,</full>,$chr(9)) 
    if (<city> isin %wu_temp) && (%wu_city == $null) %wu_city = $remove(%wu_temp,<city>,</city>,$chr(9)) 
    if (<state> isin %wu_temp) && (%wu_state == $null) %wu_state = $remove(%wu_temp,<state>,</state>,$chr(9)) 
    if (<state_name> isin %wu_temp) && (%wu_state_name == $null) %wu_state_name = $remove(%wu_temp,<state_name>,</state_name>,$chr(9)) 
    if (<country> isin %wu_temp) && (%wu_country == $null)  %wu_country = $remove(%wu_temp,<country>,</country>,$chr(9)) 
    if (<country_iso3166> isin %wu_temp) && (%wu_country_iso3166 == $null) %wu_country_iso3166 = $remove(%wu_temp,<country_iso3166>,</country_iso3166>,$chr(9)) 
    if (<zip> isin %wu_temp) && (%wu_zip == $null)  %wu_zip = $remove(%wu_temp,<zip>,</zip>,$chr(9)) 
    if (<latitude> isin %wu_temp) && (%wu_latitude == $null) %wu_latitude = $remove(%wu_temp,<latitude>,</latitude>,$chr(9)) 
    if (<longitude> isin %wu_temp) && (%wu_longitude == $null) %wu_longitude = $remove(%wu_temp,<longitude>,</longitude>,$chr(9)) 
    if (<elevation> isin %wu_temp) && (%wu_elevation == $null) %wu_elevation = $remove(%wu_temp,<elevation>,</elevation>,$chr(9)) 

    ;; NO LONGER if (<local_time> isin %wu_temp) %wu_local_time = $remove(%wu_temp,<local_time>,</local_time>,$chr(9)) 
    if (<local_time_rfc822> isin %wu_temp) %wu_local_time_rfc822 = $remove(%wu_temp,<local_time_rfc822>,</local_time_rfc822>,$chr(9)) 

    ; current weather
    if (<weather> isin %wu_temp) %wu_weather = $remove(%wu_temp,<weather>,</weather>,$chr(9)) 
    if (<temperature_string> isin %wu_temp) %wu_temperature_string = $remove(%wu_temp,<temperature_string>,</temperature_string>,$chr(9)) 
    if (<temp_f> isin %wu_temp) %wu_temp_f = $remove(%wu_temp,<temp_f>,</temp_f>,$chr(9))
    if (<temp_c> isin %wu_temp) %wu_temp_c = $remove(%wu_temp,<temp_c>,</temp_c>,$chr(9)) 
    if (<relative_humidity> isin %wu_temp) %wu_relative_humidity = $remove(%wu_temp,<relative_humidity>,</relative_humidity>,$chr(9)) 

    ; wind
    if (<wind_string> isin %wu_temp) %wu_wind_string = $remove(%wu_temp,<wind_string>,</wind_string>,$chr(9)) 
    if (<wind_dir> isin %wu_temp) %wu_wind_dir = $remove(%wu_temp,<wind_dir>,</wind_dir>,$chr(9)) 
    if (<wind_degrees> isin %wu_temp) %wu_wind_degrees = $remove(%wu_temp,<wind_degrees>,</wind_degrees>,$chr(9)) 
    if (<wind_mph> isin %wu_temp) %wu_wind_mph = $remove(%wu_temp,<wind_mph>,</wind_mph>,$chr(9)) 
    if (<wind_gust_mph> isin %wu_temp) %wu_wind_gust_mph = $remove(%wu_temp,<wind_gust_mph>,</wind_gust_mph>,$chr(9)) 

    if (<pressure_string> isin %wu_temp) %wu_pressure_string = $remove(%wu_temp,<pressure_string>,</pressure_string>,$chr(9)) 
    if (<pressure_mb> isin %wu_temp) %wu_pressure_mb = $remove(%wu_temp,<pressure_mb>,</pressure_mb>,$chr(9))
    if (<pressure_in> isin %wu_temp) %wu_pressure_in = $remove(%wu_temp,<pressure_in>,</pressure_in>,$chr(9))
    if (<dewpoint_string> isin %wu_temp) %wu_dewpoint_string = $remove(%wu_temp,<dewpoint_string>,</dewpoint_string>,$chr(9))
    if (<dewpoint_f> isin %wu_temp) %wu_dewpoint_f = $remove(%wu_temp,<dewpoint_f>,</dewpoint_f>,$chr(9))
    if (<dewpoint_c> isin %wu_temp) %wu_dewpoint_c = $remove(%wu_temp,<dewpoint_c>,</dewpoint_c>,$chr(9))

    if (<heat_index_string> isin %wu_temp) %wu_heat_index_string = $remove(%wu_temp,<heat_index_string>,</heat_index_string>,$chr(9))
    if (<heat_index_f> isin %wu_temp) %wu_heat_index_f = $remove(%wu_temp,<heat_index_f>,</heat_index_f>,$chr(9))
    if (<heat_index_c> isin %wu_temp) %wu_heat_index_c = $remove(%wu_temp,<heat_index_c>,</heat_index_c>,$chr(9))
    if (<windchill_string> isin %wu_temp) %wu_windchill_string = $remove(%wu_temp,<windchill_string>,</windchill_string>,$chr(9))
    if (<windchill_f> isin %wu_temp) %wu_windchill_f = $remove(%wu_temp,<windchill_f>,</windchill_f>,$chr(9))
    if (<windchill_c> isin %wu_temp) %wu_windchill_c = $remove(%wu_temp,<windchill_c>,</windchill_c>,$chr(9))

    if (<visibility_mi> isin %wu_temp) %wu_visibility_mi = $remove(%wu_temp,<visibility_mi>,</visibility_mi>,$chr(9))
    if (<visibility_km> isin %wu_temp) %wu_visibility_km = $remove(%wu_temp,<visibility_km>,</visibility_km>,$chr(9))
  }

  ;VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
  ;--- Variables for Forecast Command ---
  if (%wu_command == !forecast) || (%wu_command == !forecast5) {
    if (<simpleforecast> isin %wu_temp) set %wu_period 1
    set %wu_temp $remove(%wu_temp,<![CDATA[,]]>)
    if (<period> isin %wu_temp) set %wu_period $remove(%wu_temp,<period>,</period>,$chr(9),$chr(32))

    ;-- Detailed Forecast ---
    if (%wu_command == !forecast) {
      if (<title> isin %wu_temp) set $+(%,wu_df_title_,%wu_period) $remove(%wu_temp,<title>,</title>,$chr(9))
      if (<fcttext> isin %wu_temp) set $+(%,wu_df_fcttext_,%wu_period) $remove(%wu_temp,<fcttext>,</fcttext>,$chr(9))
      if (<fcttext_metric> isin %wu_temp) set $+(%,wu_df_fcttext_metric_,%wu_period) $remove(%wu_temp,<fcttext_metric>,</fcttext_metric>,$chr(9))
      if (<pop> isin %wu_temp) set $+(%,wu_df_pop_,%wu_period) $remove(%wu_temp,<pop>,</pop>,$chr(9))
      ; pop = possibility of precipitation 
    }

    ;-- Simple Forecast ---
    if (%wu_command == !forecast5) {
      if (<simpleforecast> isin %wu_temp) set %wu_period 1
      ;-- ^ Resets %wu_period to 1 when entering the <simpleforecast> section
      if (</forecastday> isin %wu_temp) inc %wu_period
      ;-- ^ Need the increase becasue the <period> is after the <weekday>

      if (<weekday> isin %wu_temp) set $+(%,wu_sf_weekday_,%wu_period) $remove(%wu_temp,<weekday>,</weekday>,$chr(9))
      if (<high> isin %wu_temp) set %wu_sf_temp high
      if (<low> isin %wu_temp) set %wu_sf_temp low
      if (<fahrenheit> isin %wu_temp) set $+(%,wu_sf_fahrenheit_,%wu_sf_temp,_,%wu_period) $+($remove(%wu_temp,<fahrenheit>,</fahrenheit>,$chr(9)),$chr(176),F)
      if (<celsius> isin %wu_temp) set $+(%,wu_sf_celsius_,%wu_sf_temp,_,%wu_period) $+($remove(%wu_temp,<celsius>,</celsius>,$chr(9)),$chr(176),C)
      if (<conditions> isin %wu_temp) set $+(%,wu_sf_conditions_,%wu_period) $remove(%wu_temp,<conditions>,</conditions>,$chr(9))
    }

  }
  ;VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
  ;--- Variables for Alerts Command ---
  if (%wu_command == !alerts) || (%wu_command == !alertinfo) { 
    ;echo -s %wu_temp
    ;set -n %wu_ac <alert count="
    ;-- Counts the amount of alerts.
    if (<alert> isin %wu_temp) { inc %wu_a_i | inc %wu_a_count }

    ;-- Writes variables for each alert. 
    if (<type> isin %wu_temp) set $+(%,wu_a,%wu_a_i,_type) $remove(%wu_temp,<type>,</type>,$chr(9)) 
    if (<description> isin %wu_temp) set $+(%,wu_a,%wu_a_i,_description) $remove(%wu_temp,<description>,</description>,$chr(9))
    if (<date> isin %wu_temp) set $+(%,wu_a,%wu_a_i,_date) $remove(%wu_temp,<date>,</date>,$chr(9))
    if (<expires> isin %wu_temp) set $+(%,wu_a,%wu_a_i,_expires) $remove(%wu_temp,<expires>,</expires>,$chr(9))
    if (</message> isin %wu_temp) { set %wu_msg OFF | set $+(%,wu_a,%wu_a_i,_count) $(%wu_msg_c,2) | set %wu_msg_c 0 }
    if (%wu_msg == ON) {
      inc %wu_msg_gc
      inc %wu_msg_c 
      set $+(%,wu_a,%wu_a_i,_message,%wu_msg_c) %wu_temp
    }
    if (<message> isin %wu_temp) { set %wu_msg ON }
  }

  ;VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
  ;---- Variables for Almanac ----
  if (%wu_command == !almanac) {
    if (<error> isin %wu_temp) {
      set %wu_airport $remove(%wu_temp,<airport_code>,</airport_code>,$chr(9))
      if (%wu_airport == $null) {
        set %wu_almanac_error NotFound
        sockclose wunderground
        wu_sockclose
      }
    }
    if (<temp_high> isin %wu_temp) set %wu_almanac_temp high
    if (<temp_low> isin %wu_temp) set %wu_almanac_temp low
    if (<normal> isin %wu_temp) set %wu_almanac_rate normal
    if (<record> isin %wu_temp) set %wu_almanac_rate record
    if (<F> isin %wu_temp)  set $+(%,wu_almanac_,%wu_almanac_rate,_,%wu_almanac_temp,_F) $+($remove(%wu_temp,<F>,</F>,$chr(9)),$chr(176),F)
    if (<C> isin %wu_temp)  set $+(%,wu_almanac_,%wu_almanac_rate,_,%wu_almanac_temp,_C) $+($remove(%wu_temp,<C>,</C>,$chr(9)),$chr(176),C)
    if (<recordyear> isin %wu_temp) set $+(%,wu_almanac_,%wu_almanac_temp,_year) $remove(%wu_temp,<recordyear>,</recordyear>,$chr(9))
  }
  ;VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
  ;---- Variables for Moon ----
  if (%wu_command == !moon) {

    if (<percentIlluminated> isin %wu_temp) set %wu_percentIlluminated  $remove(%wu_temp,<percentIlluminated>,</percentIlluminated>,$chr(9))
    if (<ageOfMoon> isin %wu_temp) set %wu_ageOfMoon $remove(%wu_temp,<ageOfMoon>,</ageOfMoon>,$chr(9))

  }
  ;VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV

  ;---- End of xml ----
  if (</response> isin %wu_temp) {
    ; This is so at the end of the reading, it immedely closes the socket and moves on, instead of waiting for the connection to time out.
    ;echo -s ---- wunderground sockclose ----
    sockclose wunderground
    wu_sockclose
  }
}

;SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS

on *:sockclose:wunderground: {
  ; OLD 
  ; This section has been changed to an alias. 
}

;SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
; END SOCKETS
;SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS

;-----------------------------------------------------------------------------
;RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
; RESULT
;RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
;-----------------------------------------------------------------------------

alias wu_sockclose {
  ;echo -s Result: wu_sockclose
  ;--- Spacers. Such as -|-  |  and -|
  set %wu_space $+($chr(45),$chr(124),$chr(45))
  set %wu_space2 $+($chr(32),$chr(124),$chr(32))
  set %wu_spaceend $+($chr(45),$chr(124))

  ;--- Removes + sign from address variable
  set %wu_address $replace(%wu_address,$chr(43),$chr(32)) 

  ;RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
  ;-ERROR-CHECKING-ERROR-CHECKING-ERROR-CHECKING-ERROR-CHECKING-ERROR-CHECKING
  ; Error? Was there an error?
  if (%wu_error == error) {
    msg %wu_chan Error: %wu_error_description
    wu_cleanup 
    halt
  }

  if (%wu_results == ON) {
    msg %wu_nick %wu_result_count Found. Please be more specific: ---- Type STOP at any time to end ---
    set %wu_results_int 1
    while (%wu_results_int <= %wu_result_count) {
      ;.timer 1  %wu_results_int .msg %wu_nick Option $+(%wu_results_int,$chr(58)) $+($($+(%,wu_result_city,%wu_results_int),2),$chr(44))  $+($($+(%,wu_result_state,%wu_results_int),2),$chr(46)) Country: $+(%,wu_result_country_name,%wu_results_int)
      $+(.,timer_wu_,%wu_nick,_,error_,%wu_results_int) 1 %wu_results_int .msg %wu_nick Option $+(%wu_results_int,$chr(58)) $+($($+(%,wu_result_city,%wu_results_int),2),$chr(44))  $+($($+(%,wu_result_state,%wu_results_int),2),$chr(46)) Country: $+(%,wu_result_country_name,%wu_results_int)

      inc  %wu_results_int
    }
    .timer 1 %wu_results_int wu_cleanup
    halt
  }

  ;-ERROR-CHECKING-ERROR-CHECKING-ERROR-CHECKING-ERROR-CHECKING-ERROR-CHECKING
  ;RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR

  if (%wu_command == !weather) { 

    msg %wu_chan %wu_full $+ : %wu_weather and $+(%wu_temp_f,$chr(176),F,$chr(47),%wu_temp_c,$chr(176),C)
  }  
  if (%wu_command == !current) { 
    msg %wu_chan %wu_full $+ : %wu_weather and $+(%wu_temp_f,$chr(176),F,$chr(47),%wu_temp_c,$chr(176),C) $&
      $+ %wu_space2 Heat Index: $+(%wu_heat_index_f,$chr(176),F,$chr(47),%wu_heat_index_c,$chr(176),C)$&
      $+ %wu_space2 Winds %wu_wind_string $&
      $+ %wu_space2 Windchill: $+(%wu_windchill_f,$chr(176),F,$chr(47),%wu_windchill_c,$chr(176),C) $&
      $+ %wu_space2 Pressure: $+(%wu_pressure_in,in,$chr(47),%wu_pressure_mb,mb) $&
      $+ %wu_space2 Humidity: %wu_relative_humidity $&
      $+ %wu_space2 Dew: $+(%wu_dewpoint_f,$chr(176),F,$chr(47),%wu_dewpoint_c,$chr(176),C) $&
      $+ %wu_space2 Visiblity: $+(%wu_visibility_mi,mi,$chr(47),%wu_visibility_km,km)
  }
  ;RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
  if (%wu_command == !time) {
    ; Military time format (Strait from the code):
    msg %wu_chan %wu_full $+ : %wu_local_time_rfc822

    ; Standard time format (modified):
    ;Coming soon, maybe.

  }

  ;RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR  
  ;To Start, Let see if the location accually exists:
  if (%wu_command == !forecast) {
    .timer 1 0 msg %wu_chan %wu_location $+ : %wu_df_title_0 $+ : %wu_df_fcttext_0 %wu_space %wu_df_title_1 $+ : %wu_df_fcttext_1
    .timer 1 1 msg %wu_chan %wu_df_title_2 $+ : %wu_df_fcttext_2 %wu_space %wu_df_title_3 $+ : %wu_df_fcttext_3 
  }

  ;RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
  if (%wu_command == !forecast5) {
    ;echo -s %wu_forecast_count

    .timer 1 0 .msg %wu_nick Your forecast for %wu_location

    set %wu_f_i 1
    while (%wu_f_i <= %wu_forecast_count) {
      ; Setup variables
      set %wu_sf_dow $($+(%,wu_sf_weekday_,%wu_f_i),2)
      set %wu_sf_con $($+(%,wu_sf_conditions_,%wu_f_i),2)
      set %wu_sf_fh $($+(%,wu_sf_fahrenheit_high_,%wu_f_i),2)
      set %wu_sf_ch $($+(%,wu_sf_celsius_high_,%wu_f_i),2)
      set %wu_sf_fl $($+(%,wu_sf_fahrenheit_low_,%wu_f_i),2)
      set %wu_sf_cl $($+(%,wu_sf_celsius_low_,%wu_f_i),2)
      ; msg nick: DayOfWeek: CurrentCondition. High: 00°F(00°C) - Low: 00°F(00°C)
      .timer 1 %wu_f_i .msg %wu_nick %wu_sf_dow $+ : %wu_sf_con $+ . High: $+(%wu_sf_fh,$chr(40),%wu_sf_ch,$chr(41)) - Low: $+(%wu_sf_fl,$chr(40),%wu_sf_cl,$chr(41))
      inc %wu_f_i
    }
  }

  ;RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
  if (%wu_command == !alerts) {
    ;echo -s --Start of alerts---
    if (%wu_a_count == 0) msg %wu_chan %wu_location $+ : No Alerts
    if (%wu_a_count > 0) {
      msg %wu_chan %wu_location $+ : %wu_a_count Alerts
      var %i 1
      while (%i <= %wu_a_count) {
        .timer 1 %i msg %wu_chan %wu_a_start $($+(%,wu_a,%i,_description),2) till $($+(%,wu_a,%i,_expires),2) %wu_a_end
        inc %i
      }
      .timer 1 %i .notice %wu_nick use $chr(2) !alertinfo $chr(2) [zipcode|city,state|city,country|airport] for alert details
    }
  }
  ;RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR  
  if (%wu_command == !alertinfo) {
    if (%wu_a_count == 0) msg %wu_chan %wu_location $+ : No Alerts
    if (%wu_a_count > 0) {
      ;msg %wu_chan %wu_location $+ : %wu_a_count Alerts - See PM for details
      .timer 1 1 .msg %wu_nick %wu_location $+ : %wu_a_count Alerts
      .timer 1 2 .msg %wu_nick Type STOP at any time to end.

      set %wu_alert_total_alerts 1
      ; Used to count the while loops compaired to the origial totall of Alerts
      ; Aka, what Alert are we on. 

      set %wu_alert_timer_msgcount 3
      ; Used to tally the message count used for timers

      while (%wu_alert_total_alerts <= %wu_a_count) {     ;Is the tally of alerts less than or equal to the Total a_counts
        ;echo -s Total Alerts %wu_alert_total_alerts
        set %wu_alert_alert_message 1

        .timer 1 %wu_alert_timer_msgcount .msg %wu_nick $chr(2) $($+(%,wu_a,%wu_alert_total_alerts,_description),2) $chr(2) from $($+(%,wu_a,%wu_alert_total_alerts,_date),2) till $($+(%,wu_a,%wu_alert_total_alerts,_expires),2)
        inc %wu_alert_timer_msgcount

        while (%wu_alert_alert_message <= $($+(%,wu_a,%wu_alert_total_alerts,_count),2)) {
          ;echo -s Total Alert %wu_alert_total_alerts Messages %wu_alert_alert_message
          $+(.,timer_wu_,%wu_nick,_,alert_,%wu_alert_total_alerts,_message,%wu_alert_alert_message) 1 %wu_alert_timer_msgcount .msg %wu_nick $($+(%,wu_a,%wu_alert_total_alerts,_message,%wu_alert_alert_message),2)

          inc %wu_alert_alert_message
          inc %wu_alert_timer_msgcount
        }

        inc %wu_alert_total_alerts
      }
      $+(.,timer_wu_,%wu_nick,_,alert_,%wu_alert_total_alerts,_message_End) 1 %wu_alert_timer_msgcount .msg %wu_nick --------- End of Alerts -------

    }
  }
  ;RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR  
  if (%wu_command == !almanac) {
    if (%wu_almanac_error == NotFound) && (%wu_name == $null) msg %wu_chan Location Not Found. Try location near an airport.
    if (%wu_almanac_error == $null) && (%wu_name != $null) msg %wu_chan %wu_name Found. No data provided.

    if (%wu_almanac_error == $null) && (%wu_name == $null) {
      .timer 1 0 msg %wu_chan $+(%wu_airport,$chr(58)) Normal High: $+(%wu_almanac_normal_high_F,$chr(47),%wu_almanac_normal_high_C,$chr(46)) Normal Low: $+(%wu_almanac_normal_low_F,$chr(47),%wu_almanac_normal_low_C,$chr(46))
      .timer 1 1 msg %wu_chan $+(%wu_airport,$chr(58)) Record High: $+(%wu_almanac_record_high_F,$chr(47),%wu_almanac_record_high_C) in %wu_almanac_high_year - Record Low: $+(%wu_almanac_record_low_F,$chr(47),%wu_almanac_record_low_C,) in %wu_almanac_low_year
    }
  }
  ;RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR  
  if (%wu_command == !moon) {
    msg %wu_chan $+(%wu_location ,$chr(39),s) Moon is $+(%wu_percentIlluminated,$chr(37)) illuminated. Age: %wu_ageOfMoon days

  }
  ;RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR  
  ;echo -s End-------- of WU $time --------
  ;wu_cleanup
}

;RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR

:MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM

;--- Private Message ----
; -- If user requested !AlertsInfo, and wants to stop the long string of alerts. they can simply type STOP ---
on 1:OPEN:?:*stop*:{
  $+(.,timer_wu_,$nick,$chr(42)) off
  .msg $nick --------- Messages Stopped -------

}

:MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM

alias wu_help {
  .timer 1 0 .msg %wu_nick $me $+ ' Weather Commands: (16 lines)
  .timer 1 1 .msg %wu_nick !weather !current !forecast !forecast5 !alerts !alertinfo !time !almanac
  .timer 1 2 .msg %wu_nick Use above commands with your desired location. 
  .timer 1 3 .msg %wu_nick !weather [zipcode|city,state|city,country|airport]
  .timer 1 4 .msg %wu_nick Examples: !weather 90210 - !weather Beverly Hills, CA - !weather LAX - !weather E2J4C7
  .timer 1 5 .msg %wu_nick You can also set a default location for yourself. Just type: !weather REGISTER [location]
  .timer 1 6 .msg %wu_nick To remove from the list, simply type !weather REMOVE
  .timer 1 7 .msg %wu_nick After you have registure, You can simply use !weather and it will bring up your default
  .timer 1 8 .msg %wu_nick -----END OF WEATHER HELP -----
  wu_cleanup
}

;=============================================================================
alias wu_cleanup {
  ;echo -s End-------- of WU $time --------
  unset %wu_*
}

;=============================================================================
/*
---- VERSION HISTORY -----
1.0 
- Original creation

2.0 
- Added !current command
- Unknown modifications (Did so many, I can't remember)

3.0 
- Added REGISTER and HELP functions
- Fixed !forecast, !forecast5, !alerts !alertinfo Address still including + sign error.

3.1
- Added !weather ON and OFF command to turn the script on or off. (set for OPS ONLY)

3.2
- Modified !weather ON/OFF command. Now the ON and OFF commands are Per #channel basis. (allowing it to be on in one chan, but off in another

3.3
- Line 238, TOS line had changed. Updated $remove() to reflect new text.

4.0
- Local Support. Now Local user (mIRC client hosting the script) can also activate and use the script. .
4.1
- Fixed !w command. Now it works.

5.0
- New Format: Code now uses wunderground's API. YOU MUST HAVE AN API code in order for this to work.
- Various parts changed to accomidate the new API requirments. OLD stuff commented out and NEW stuff noted (For those who read the code)
- Current code uses CONDITIONS, FORECAST. But wunderground has more paramerters you can pull from not included in this code: http://www.wunderground.com/weather/api/d/docs?d=data/index&MR=1
- Release to the public in Working order. But may still have bugs. 
5.1
- Added line spacers to each section. (I kept getting lost, so I decided to add spacers for each section so I knew where I was in the code)
- Added !almanac for record highs and lows.
5.2
- Fixed !alerts, !alertinfo, Now works with new API platform
- Added STOP ablity to long !alertinfo. (Simply type STOP in the private message window)
- Fixed !forecast and !forecast5 to new API platform.
5.3
- Added !forecast[1-10] ablity. Now you can request up to 10 days of private messages. Instead of the default 5. Want 3 days? !forecast3.  Want 10 days? !forecast10
- Fixed Spelling issue with forecast. (forEcast)
- Fixed Location Not Found to effect All commands. Added responce if city is found, but with out any information. Ex: ORD  (Chicago-O'Hare International Airport)
- Fixed !almanac not responding to local input. Due to extra space on INPUT, If line.
5.4
- Adjusted !forecast $chan message. To include %wu_location
- Fixed !weather REMOVE command resulting in a /sockopen: insufficient parameters error. 
- Fixed "Location Found, No results." Multiple locations are actually found, user is givin a list to choose from.
- Fixed !alertinfo From [Time] till [Time] glitch. (had old $right() from old xml that was removing text)
- Fixed !alertinfo Message timer glitch. Kept overwriting previous alert messages.
- Added script ULR to top of code for easy refference
5.41
- Changed Location Not Found to now output the error reported from wunderground
5.42
- Added private message STOP feature to also stop City/State Option [#] messages.
5.43
- Added Change activation command string to allow a user to call upon this script with a different leading character, and not have to change the entire code. 
5.44
- Added !moon and !moonphase to show the current status of the moon 
*/

Comments

Sign in to comment.
XxBonf1r3xX   -  28 days ago

How I can make my BOT to send !weather and !w commands with /me color code? How I need to edit this script to make this work?

Thank you for your phenomenal script my friend.

dma  -  28 days ago

thats all you have to do is !w or !weather thats what i do with mine

XxBonf1r3xX  -  28 days ago

But would it be possible to do it automatically, if I do "!weather /me " with Ankhbot it won't work.

For example my BOT's color is red, so when I do "!weather /me" my BOT would answer me with a red text instead of default white text.

Sign in to comment

RothschildJR   -  Jun 25, 2016

error msg for any !w xxx : BOTABUSE Unknown command

/sockopen: 'wunderground' socket in use (line 235, remote.ini)

 Respond  
Karlien   -  Mar 03, 2016

I just got this script and everything works great! For the first person to use it. If you then enter another zip, city, whatever it will only output the first person's information. I've tried deleting all the variables from .vars and the same thing happens again. Its a great script with great features but this is driving me crazy and I can't figure it out. Help please

 Respond  
Shadow7557   -  Feb 18, 2016

Hi, what would I do if I only !weather by itself

dma  -  Feb 18, 2016

i dunno i use something different - try !w

Sign in to comment

ovelayer   -  Dec 24, 2015

eqrunner
is there a way to change it so that when you use the forecast and !forecast5 it shows the city and state instead of zipcode? like it does when you do !weather
?
would be cool
thanks for your amazing script

 Respond  
ovelayer   -  Oct 16, 2015

keep getting this error now..

(Fri 8:35pm) BOTABUSE Unknown command

i see it on line 66 in your script as
alias wunderground {
botabuse
unset %wu_*

but i find no alias for it?

rebel9  -  Oct 24, 2015

Then delete the 'botabuse' line, or create a botabuse alias that disables users from spam. Here's one I found within 30 seconds of searching for it, and it's by eqrunner.

alias botabuse {

  var %botabuse_count = $hget(botabuse ,$nick)
  if (%botabuse_count > 60 ) {
    .notice $nick is citing bot abuse. $me is now ignoring you.
    .notice eqrunner -IGNORED- $nick
    .msg BotServ ACT $chan adds $nick to $me $+ 's ignore list
    hinc -zm botabuse $nick 1800
    echo -s IGNORED: $nick on $chan at $date(mm/dd/yyyy) $time(HH:nn.ss)
    ignore -pcntikdu1800 $nick
  }
  if ($nick isop #) { hinc -zm botabuse $nick 15 }
  if ($nick ishop #) { hinc -zm botabuse $nick 30 }
  if ($nick isvoice #) { hinc -zm botabuse $nick 30 }
  if ($nick isreg #) { hinc -zm botabuse $nick 35 }
}
Sign in to comment

mrdoody55   -  Oct 15, 2015

I first want to say thanks for the great script, I've been using it in a friends & family irc channel for a while now, and haven't had any issues. This unfortunately stopped today, as the script is no longer responding to any of the commands, except for help and remove. There seems to be no response for register, weather, current, forecast, or alerts.

 Respond  
ovelayer   -  Oct 13, 2015

one thing i noted is that this script creates and leave's a bunch of var's...
anyway to clean those once the script is done msgin the output?

 Respond  
H0LLYWOOD   -  Oct 12, 2015

i know this is being overly picky and asking a lot, but, since users have profiles. for their individual weather. i'm wondering if there's a way to make the !w and !weather triggers network + channel specific. so if a channel owner doesn't want to use !w for the full layout and just use !weather for the one-liner, they can choose to do so. and since the bot may be on two or more networks with the same channel name. that's why i put $network + $chan
thanks for continuing to update and provide this great script.

dma  -  Oct 18, 2015

yes you can make it .. it !w is the long way full ( !weather ) is the short way to do it

Sign in to comment

ovelayer   -  Sep 26, 2015

Ever thought of adding !moonphase/!phase trigger that would display the different moon phases and their dates? Dont know if u can but it would be cool

eqrunner  -  Sep 28, 2015

Done! I uploaded version 5.44. You currently get the percentage of illumination, and the age of Moon when you use the command !moon or !moonphase.

I am not up on the status of the moon, So you may need to adjust to what you need. Hope this helps.

ovelayer  -  Sep 29, 2015

nice i really like it
(Tue 7:37pm) <~xXBERTOXx> !moonphase
(Tue 7:37pm) <~BrAiNs> 99004's Moon is 94% illuminated. Age: 17 days
is there anyway to add more info to it? like !moon would give the current moonphase but !moonphase would give the current moonphase and the dates of the expected changes to the moonphase leading up to the fullmoonphase? or u could just use !fullmoon to show when the next expected date of the full moon would be..
but awsome job this is a NICE addition

Sign in to comment

dma   -  May 11, 2015

is this updated ?last time i tried it wasnt

eqrunner  -  May 20, 2015

Most recent verison 5.41 was updated last year. And has been working with no issues. No further updates since then.

Sign in to comment

tlchost   -  Apr 20, 2014

How can I modify the script so that all messages go to the nick, rather then the channel?

cptpan  -  Apr 21, 2014

Change instances of msg $chan to either notice $nick or msg $nick

tlchost  -  Apr 24, 2014

ah...the current version of the script doesn't seem to have those instances.

cptpan  -  Apr 26, 2014

Fuks me then. Soz

eqrunner  -  May 03, 2014

You can change all the "msg %wu_chan" to "msg %wu_nick" (Lines
444
467
478
482
493-494
522
524
527

751-752
575-576)

Sign in to comment

anviska   -  Mar 15, 2014

Great script! thanks! I just have one problem. When I type i. e. "!w finland" and the bot PM's me all the available location, there is so much data coming in such a short time that Quakenet kills my bot for excess flood. What kind of flood settings I should have in mIRC to prevent this from happening or is there any script that would somehow make the locations come a bit slower?

 Respond  
TehJibba   -  Mar 10, 2014

This script has a major security flaw in the !w register command that leaves anyone running this open to possible attacks. Im not going into public detail about what is wrong with it so that this wont become a widely known flaw. the author can contact me for a better explanation, The exploit was tested several times on several different users and it does infact work

 Respond  
damaks   -  Feb 27, 2014

Hi, great script, but could you please make metric version? Than it would be prefect!
Thanks!

eqrunner  -  Mar 11, 2014

There is already metric in the script. if you comment out the 'unset' at the very bottom in the alias 'WUCLEANUP' . Run the script, and look at all the variables tab for all the available results. Then simply modify the msg %wu_chan Lines in the alias 'WU_SOCKCLOSE' to adapt to your likeing. A simple of change of things like "%wu_windchill_f" to "%wu_windchill_c", or "%wu_visibility_mi" to %wu_visibility_km" would work as a simple fix.

I do have intentions at some point to give an option in the beginning of the script to select Imperial or Metric as the 'primary.' But that would result in a lot of adjustment to the code. Along with each user who uses my code may have a different audience who lives in different locations. But I will keep this in mind. [As I write this, I could see my self adding to the !weather REGISTER function a way to also specify your preferred measurement scale. I will continue to ponder this one]

damaks  -  Mar 11, 2014

yes i have changed all eg. %wu_windchill_f to %wu_windchill_c" , and everything works great except !forecast . with that i cant do anything about, it always shows in imperial units

eqrunner  -  Mar 13, 2014

Forecast has it. You need to use the #wu_fcttext_metric variable.

damaks  -  Mar 14, 2014

thx! :)

Sign in to comment

cptpan   -  Feb 16, 2014

There are so many areas now that just result in:

WHATEVER Found. No data provided.

eqrunner  -  Feb 17, 2014

That is due to the site the script pulls from. It's api shows that the location exisits, but the site does not have any information from that location at all. Nothing that I can do on the script will fix this issue. Your users will just have to enter in a more populated/larger city.

cptpan  -  Feb 22, 2014

lol. It often happens for some of the biggest cities in the world.

Their API must be a piece of $hit then.

eqrunner  -  Feb 23, 2014

I can understand this being a big issue if it was in the states. But around the world, there are so many cities and countries around the world. And not all of the are connected to the internet 24/7. Or have sensors in those towns that are made public that can be accessed online.

Sign in to comment

chachin2009   -  Jan 16, 2014

I know i've asked this before.. and it was a loooong time ago and code has changed so much i cant find a way to do it.. so how can i have

!fc amy is not my bot.. Baytown, TX Forecast (High/Low) - Updated: 11:41 CST Thursday: Clear, 20/6°C (68/43°F) Friday: Clear, 18/3°C (64/37°F) Saturday: Clear, 20/8°C (68/46°F) instead of all that stuff on pm do show 3 days only like that on chan instead of pm :) ty like always
rebel9  -  Jan 16, 2014

You can make it message a channel now.

Line 553:
.timer 1 %wu_f_i .msg %wu_nick %wu_sf_dow $+ : %wu_sf_con $+ . High: $+(%wu_sf_fh,$chr(40),%wu_sf_ch,$chr(41)) - Low: $+(%wu_sf_fl,$chr(40),%wu_sf_cl,$chr(41))

Change that to:
.timer 1 %wu_f_i .msg %wu_chan %wu_sf_dow $+ : %wu_sf_con $+ . High: $+(%wu_sf_fh,$chr(40),%wu_sf_ch,$chr(41)) - Low: $+(%wu_sf_fl,$chr(40),%wu_sf_cl,$chr(41))

You can also make it notice by changing .msg %wu_chan to .notice %wu_nick. This way it doesn't spam the channel when people !forecast3/4/5/6 etc and only you get the information, nobody else cares about what your weather is going to do for 5 days in your area.

Sign in to comment

chachin2009   -  Dec 08, 2013

what about instead of posting Heat Index: NA°F/NA°C or cold index na make it so it hides it when you do .current to make it look clean or shorter since its not there why bother having heat or cold depending on weather :)

ovelayer  -  Dec 08, 2013

well it works for me when it is 0 and we have a windchill factor like now its -2

Sign in to comment

TerrapinStaion   -  Nov 25, 2013

eqrunner, Perhaps the script could be ported to http://www.localweather.net or even yahoo weather. As wunderground.com was bought out by the weather channel. The weather channel is believe it or not a very bias reporting weather network. They are bias on reporting weather news on the cities on the east coast almost exclusively. Even if its just a half inch of rain their going to receive or 3 inches of snow. This is a catastrophe for the east coast cities according to the Weather Channel. Also weather network and website WeatherNation "www.weathernationtv.com" founded by world founded by world famous meteorologist from Minnesota Paul Douglas would also be another excellent source.

eqrunner  -  Nov 26, 2013

@TerrapinStaion The buyout was over 18 months ago and has not affected the wundergound script that I have created. The Weather Channel may be opinionated to be biast, but the script above is not. What The Weather Channel reports on has no effect on the wunderground script as the individual user requests the info they want. I have looked at localweather.net and weathernation.tv in the past but neither of them support an API platform on which the script now runs on. Yahoo Weather API does not contain all the additional features that wunderground supports. Hence the reason why I have stuck with wunderground as the source.

Sign in to comment

Wizardkat   -  Nov 12, 2013

What are the chances of adding a Celsius to Fahrenheit converter and vice versa to the script? Something like !convert 15F or !convert 15C

eqrunner  -  Nov 12, 2013

Odds are stacked against you. If you are looking for the script to spit out Celsius answers, you can always modify the msg $chan section, as there are Celsius variables availble (%wu_temp_c, %wu_dewpoint_c, %wu_heat_index_c, %wu_windchill_c, etc) This weather script is not intended to do conversions.

Might I suggest you search above for a temperature converter script, or post a request in the forums http://www.hawkee.com/phpBB2/viewforum.php?f=9

(after doing a little searching) I can suggest http://www.hawkee.com/snippet/6727/ or http://www.hawkee.com/snippet/3826/ That is a simple script you can use.

Sign in to comment

morte   -  Nov 05, 2013

Sorry, I am new here and thought I screwed something up and posted something that is not at all relevant to this script.

 Respond  
chachin2009   -  Nov 04, 2013

Hey eqrunner could you be cool and come to irc.freenode.net #chick3n to help me out with a script? :P

 Respond  
RIcko   -  Oct 24, 2013

In spite of the on INPUT and on TEXT issues, I'm getting this error each time I typ !weather or !forecast:

(Oct-Fri-25|4:30:04|am) <~Ricko> !weather Florida
[my bot's status window]: * /sockopen: 'wunderground' socket in use (line 224, Weather-Script-2.ini)

blackvenomm666  -  Oct 24, 2013

On your bot type /sockclose wunderground then try using it again

Sign in to comment

^WeSt   -  Oct 09, 2013

LOL have a look here:

!wow -RafaeLLa-v2- Please specify a location !wow [zipcode|city,state|city,country|airport] * /sockopen: insufficient parameters (line 224, script4.ini) !what-a-fuck -RafaeLLa-v2- Please specify a location !what-a-fuck [zipcode|city,state|city,country|airport] * /sockopen: insufficient parameters (line 224, script4.ini) !w -RafaeLLa-v2- Please specify a location !w [zipcode|city,state|city,country|airport] * /sockopen: insufficient parameters (line 224, script4.ini)
eqrunner  -  Oct 09, 2013

Yup, this is a problem I still haven't been able to get right. It is in the on INPUT and on TEXT part. For some reason, because of the w| part. If I add a space w |. It doesn't work. But if is just the w|. I t will respond to all W related things.

^WeSt  -  Oct 11, 2013

This is an several bug , into my bot i have a lot of !w.... commands so you must find a way to fix this, try an other way and not the regex.

^WeSt  -  Oct 11, 2013

Also the problem is not only in !weather and on the other commands:

e.g:

!forecastttttttt
!alertsssssssssssssss
!timeeeeeeeeeeee
.....

eqrunner  -  Oct 11, 2013

I am unable to recreate your issue. Other than !forecast. But I will keep an eye on this.

For now, just remove the W from the on text and on input section.

 on $*:INPUT:#: {
  if ($regex($1,/^[!](weather|forecast|forecast5|alert|alerts|alertinfo|alertsinfo|time|current|almanac)/Si)) wunderground $1-
}

on $*:text:/^[!](weather|forecast|forecast5|alert|alerts|alertinfo|alertsinfo|time|current|almanac)/Si:#: {
  wunderground $1-
}
^WeSt  -  Oct 11, 2013

Ok but i don't know why this is happening.

rebel9  -  Oct 20, 2013

on $*:text:/^!? /Si:#: {
wunderground $1-
} A simple ? after the (weather|forecast|etc|)? /Si: <--will fix the issue.

eqrunner  -  Oct 23, 2013

@rebel9 That works for the onTEXT. But not for the onINPUT

rebel9  -  Oct 23, 2013

on $*:INPUT:#: {
if ($regex($1,/^!? /Si)) wunderground $1-
}
This doesnt work? If not try almanac)? \w+$/Si))

Sign in to comment

chachin2009   -  Oct 08, 2013

Yo eqrunner. SO i went and try to do the code change so i can use . instead of ! so the bot doesn't interfere with the other bot i have that uses !w for other stuff but that one bot is'nt mine so i can't do nothing about it and im not op to kick the that bot :P so i went for the lines 47 to 53 then try to go down to 130 to 131 or whatever but couldnt find the rest so Im stuck on 47 to 53.. if you wanna be cool to help me once again.. you're just too awesome. thanks anyways :)

eqrunner  -  Oct 09, 2013

Let me simplify that for you. Change the following: (Lines 55 thru 58)

on $*:INPUT:#: {
  if ($regex($1,/^[.](w|weather|forecast|forecast5|alert|alerts|alertinfo|alertsinfo|time|current|almanac)/Si)) 
  wunderground $1-
}

on $*:text:/^[.](w|weather|forecast|forecast5|alert|alerts|alertinfo|alertsinfo|time|current|almanac)/Si:#: {
  wunderground $1-
}

This is just changing the ! to a .

And add this code right below the APIKEY area (Insert at line 88)

  ;APIKEYAPIKEYAPIKEYAPIKEYAPIKEYAPIKEYAPIKEYAPIKEYAPIKEYAPIKEY
  ;set %wu_api YourAPICodeGoesHere
  ;APIKEYAPIKEYAPIKEYAPIKEYAPIKEYAPIKEYAPIKEYAPIKEYAPIKEYAPIKEY
set %wu_command $replace(%wu_command,$chr(46),$chr(33))

This will solve all your problems. This allows you to use .weather .time .forecast etc. But once the script is started. It internally changes it back to !weather !time !forecast, etc. So that the rest of the code works.

chachin2009  -  Oct 10, 2013

wow just wow this is so much better.. thank you man.. like always you're just too awesome :)

Sign in to comment

^WeSt   -  Oct 08, 2013

The 5.4 version has an bug into the !weather command, i use !weather Athens, Greece with my SAME api key but the resault is location not found i had a backup of 5.3 and i restore it and i use !weather Athens, Greece and the resaults were correct, so please re-check the 5.4 version!

^WeSt  -  Oct 08, 2013

ERRORS:

I use all commands (with no parameters) => * /sockopen: insufficient parameters (line 224, script4.ini)

Also all commands are not working on me => Location not found

Also one suggestion to add BOLD on output messages, or an %wu_bold option to enable/disable it!

  • Thanks!
eqrunner  -  Oct 08, 2013

-You have me stumped on this one. Line 224 is the sockopen command. And nothing has changed with that.

 sockopen wunderground %wu_host 80
(sockopen wunderground api.wunderground.com 80)

-I have changed 5.41 to now show the error from the info. Try running this and send me back what errors you are recieving.
-If I was to add a bold option, Which part of the messages would I be bolding?

^WeSt  -  Oct 08, 2013

Well before when i c/p the new code (5.4) without changing my KEY and using !weather AXD it said me that Location not found now when i c/p the new (5.41) have done the same told me that i have wrong key setted, ( I HAVE NOTHING CHANGED )

Anyway without changing nothing when i set the new KEY it was working good into the 5.41 version.

Now about the BOLD i mean something like this:

!weather AXD
[westor]: Athens, Greece: Scattered Clodes and 69.6°F/20.9°C

and the error messages too: [westor]: Error, this key does not exist!

^WeSt  -  Oct 08, 2013

Also in v5.41 i found some problems:

(08/Oct/2013 20:10:15) <@westor> !almanac AXD
(08/Oct/2013 20:10:19) <@RafaeLLa-v2> LGAL: Normal High: 70°F/21°C. Normal Low: 54°F/12°C.
(08/Oct/2013 20:10:20) <@RafaeLLa-v2> LGAL: Record High: / in - Record Low: / in

(08/Oct/2013 21:10:47) <@westor> !current Bah, India
(08/Oct/2013 21:10:48) <@RafaeLLa-v2> Bah, India: and 81°F/27°C | Heat Index: 82°F/28°C | Winds From the West at 6 MPH | Windchill: NA°F/NA°C | Pressure: in/mb | Humidity: 69% | Dew: 70°F/21°C | Visiblity: mi/km

(08/Oct/2013 21:10:16) <@westor> !w RUP
(08/Oct/2013 21:10:17) <@RafaeLLa-v2> Rupsi, India: and 73°F/23°C

(08/Oct/2013 21:10:42) <@westor> !time RUP
(08/Oct/2013 21:10:48) <@RafaeLLa-v2> Rupsi, India: Tue, 08 Oct 2013 23:39:50 +0530

(08/Oct/2013 21:10:15) <@westor> !almanac RUP
(08/Oct/2013 21:10:18) <@RafaeLLa-v2> Location Not Found. Try location near an airport.

(08/Oct/2013 22:10:11) <@westor> !w Athens
(08/Oct/2013 22:10:13) 19 Found. Please be more specific:
(08/Oct/2013 22:10:14) Option 1: Athens, AL. Country:
(08/Oct/2013 22:10:15) Option 2: Athens, AR. Country:
(08/Oct/2013 22:10:16) Option 3: Athens, CA. Country:
(08/Oct/2013 22:10:17) Option 4: Athens, GA. Country:
(08/Oct/2013 22:10:18) Option 5: Athens, . Country:
(08/Oct/2013 22:10:19) Option 6: Athens, IL. Country:
(08/Oct/2013 22:10:20) Option 7: Athens, IN. Country:
(08/Oct/2013 22:10:21) Option 8: Athens, LA. Country:
(08/Oct/2013 22:10:22) Option 9: Athens, ME. Country:
(08/Oct/2013 22:10:24) Option 10: Athens, MI. Country:
(08/Oct/2013 22:10:24) Option 11: Athens, MO. Country:
(08/Oct/2013 22:10:25) Option 12: Athens, NY. Country:
(08/Oct/2013 22:10:26) Option 13: Athens, OH. Country:
(08/Oct/2013 22:10:27) Option 14: Athens, PA. Country:
(08/Oct/2013 22:10:28) Option 15: Athens, TN. Country:
(08/Oct/2013 22:10:29) Option 16: Athens, TX. Country:
(08/Oct/2013 22:10:31) Option 17: Athens, VT. Country:
(08/Oct/2013 22:10:32) Option 18: Athens, WV. Country:
(08/Oct/2013 22:10:32) Option 19: Athens, WI. Country:

(08/Oct/2013 22:10:08) <@westor> !w Greece
(08/Oct/2013 22:10:54) 55 Found. Please be more specific:
(08/Oct/2013 22:10:55) Option 1: Agrinion, . Country:
(08/Oct/2013 22:10:56) Option 2: Aktion, . Country:
(08/Oct/2013 22:10:57) Option 3: Alexandroupoli, . Country:
(08/Oct/2013 22:10:58) Option 4: Aliartos, . Country:

eqrunner  -  Oct 08, 2013

!almanac: There are empty slots, this is due to there is no information provided by wunderground (aka items don't exisit) I will see what I can do about "IF $null" type items. It will take a while as there is a lot of extra code to check "is there an variable| If so then send message| If not, then don't'

!current: Same thing. It is hard enough to get it to complete the entire msg %wu_chan portion. Let alone, checking in advance if it even exists. Same applies to metric vs imperial. I want to do something about it. There just adds in a long list of additional IF/Then statement I will need to add.

!almanac RUS: Simular issue I had before. There are multiple resuts for RUP when it comes to the almanac page. http://api.wunderground.com/api/553cdd0a841d3557/almanac/q/rus.xml. These things are unexpected, and hard to test every s location around. The almanac data is also very sparce an usually is only from a airport data log. In this case, RUP in almanac shows two results, even thou in !time it knows which one. This is unpredictable, but will keep this in mind.

!weather Athens, and !weather Greece. A City and State or City and Country is needed. Since you didn't specify, you got a response page with all the options. I will look at redoing this so you don't end up with 55+ messages. Testing from my side, it does say "Option 1: Agrinion, . Country: Greece" Not sure why yours does not. But it is listing all the parts of Greece that you can use.

^WeSt  -  Oct 09, 2013

Ok with the others i have just reported because i saw them.

Now about the !weather Athens command if you can see in the output display of 19 items does not say the Country: ?? this output message must be fixed, also the same with the !w Greece .

  • Thanks!
Sign in to comment

eqrunner   -  Oct 07, 2013

Version 5.4 Posted with a small list of fixes to glitches.

For those who are asking. The old NON-API version is now posted here. <http://www.hawkee.com/snippet/10052/ > Posted for reference purposes only. No support will be available for that script.

chachin2009  -  Oct 07, 2013

no matter what location I give it.. it says " Location not found " :( yes on 5.4

eqrunner  -  Oct 08, 2013

I made a small adjustment and posted 5.41. It no longer says "Location Not Found", But will spit back the error that the site gives. Location not found, is now "No cities matched your search query"
Try it with your issue, and tell me what the error is that comes back. I wonder if it is "this key does not exisit" which means your API key was entered in wrong.

chachin2009  -  Oct 08, 2013

woo 5.41 fixed it :D keep up the good job man you're awesome thanks for your work :)

Sign in to comment

^WeSt   -  Oct 06, 2013

There is an bug when i use : !weather ZIPCODE

e.g: !weather 19200

return me an error: * /sockopen: insufficient parameters (line 237, script4.ini)

also one more bug is:

e.g: !w REMOVE

NOTICE ME: Your location association has been removed.

but return me an error: * /sockopen: insufficient parameters (line 237, script4.ini)

Chromatic  -  Oct 06, 2013

Hrmm.. not sure what is going on. However, recently I had to upgrade and modify my code since an API key is now required for OAUTHentication...

I have a solidly working weather script from EQrunner -- It is somewhere on here, but I am just going to paste the code I use that I know works.. You can find it here:

http://pastebin.com/ye0CBSVA

Just note you will need to put your own API key in where it is denoted in the script -- you have to sign up as the script directs in the notation to obtain your key.. it takes 2 minutes to do. Hope this helps.

Sign in to comment

cptpan   -  Sep 28, 2013

I have updated the script to the above and still get 'Location not found' for !weather and !current

cptpan  -  Sep 28, 2013

Fuck. Just read I need to register or whatever.

cptpan  -  Sep 28, 2013

Now I'm getting: Location found. No data provided. (Replacing 'location' with whatever location was used in search)

eqrunner  -  Oct 03, 2013

Go down to line 593 and comment out the unset. Run the command. Then look at your variables. Your results should look like this:

%wu_command !weather
%wu_2 20001
%wu_location 20001
%wu_3
%wu_3_long
%wu_nick eqrunner
%wu_network iPocalypse
%wu_chan #danceradio
%wu_host api.wunderground.com
%wu_api 99i99ii9iii99i
%wu_address 20001
%wu_link /api/99i99ii9iii99i/conditions/q/20001.xml
%wu_temp </response>
%wu_full Washington, DC
%wu_city Washington
%wu_state DC
%wu_state_name District of Columbia
%wu_country US
%wu_country_iso3166 US
%wu_zip 20001
%wu_latitude 38.90856934
%wu_longitude -77.01797485
%wu_elevation 23.00000000
%wu_local_time_rfc822 Thu, 03 Oct 2013 06:44:38 -0400
%wu_weather Scattered Clouds
%wu_temperature_string 68.6 F (20.3 C)
%wu_temp_f 68.6
%wu_temp_c 20.3
%wu_relative_humidity 79%
%wu_wind_string From the North at 1.0 MPH Gusting to 2.0 MPH
%wu_wind_dir North
%wu_wind_degrees 360
%wu_wind_mph 1.0
%wu_wind_gust_mph 2.0
%wu_pressure_mb 1019
%wu_pressure_in 30.09
%wu_dewpoint_string 62 F (17 C)
%wu_dewpoint_f 62
%wu_dewpoint_c 17
%wu_heat_index_string NA
%wu_heat_index_f NA
%wu_heat_index_c NA
%wu_windchill_string NA
%wu_windchill_f NA
%wu_windchill_c NA
%wu_visibility_mi 10.0
%wu_visibility_km 16.1
%wu_space -|-
%wu_space2  |
%wu_spaceend -|

Try a more common location and see if it still does the same. Your location may not be available.

cptpan  -  Oct 04, 2013

Some locations work, others don't. But there are places that are so large they should have data (ie, some major cities have 'No data' and some VERY small towns do).

eqrunner  -  Oct 05, 2013

Can you specify what towns you are mentioning? I might be able to look at them and see if there is something else that may be a fault.

cptpan  -  Oct 07, 2013

[18:00] <@Me> !weather yorkshire
[18:00] Yorkshire Found. No data provided.

eqrunner  -  Oct 07, 2013

@cptpan This is because you are not specifying the State. If you look at the xml page: http://www.wunderground.com/cgi-bin/findweather/hdfForecast?query=yorkshire You will see that there are two locations listed. Same if you searched it directly on wunderground ( http://www.wunderground.com/cgi-bin/findweather/hdfForecast?query=yorkshire ) It is asking for which location. NY or OH. But let me see what I can do about adding this option as a feature.

Update: New v5.4 code posted. It will now notify you if your request has multiple results.

cptpan  -  Oct 08, 2013

[11:19] !weather wollongong new south wales australia
[11:19] Wollongong Found. No data provided.

The weird thing is it returns weather for nearby locations that are MUCH smaller than Wollongong.

Sign in to comment

zland   -  Sep 26, 2013

About a week and a half ago version 4.1 stopped working for me, which IIRC it uses the "free" and uncapped Wunderground API, yet I have a web application that utilizes the same free API and that still works. What caused the old script to mess up?

I know you probably don't support it anymore, but I just don't want to have to deal with the hassle of Wunderground's capped API.

eqrunner  -  Sep 26, 2013

The xml pages became un reliable. Along with how mIRC handles reading webpages. For example, the sockopen section. I go through a lot of testing to get the "sockwrite -n $sockname GET %wu_link HTTP/1.1" Section to work correctly. Some use XML/1.0, or XML/1.1. or in this case HTTP/1.1 vs 1.0. And some times it is not needed. Your other app may work fine because it reads the sock differently vs how mIRC reads it. I don't know the specifics, but mIRC can be extremely finicky on how it reads webpages. And wunderground was beginning to kick back more errors, hence why I changed to the API version.

I will try and look back at the old and see if I can get something to work. I found more options and capabilities in the API. (like almanac)

zland  -  Sep 26, 2013

Ah, that makes sense. Btw, this is unrelated to my first comment, but I caught a bug, and this is with calling up alerts. No time is specified, and instead just shows "T".

[9/26/2013 4:36:30pm] 33592: 1 Alerts
[9/26/2013 4:36:32pm] Coastal Hazard Statement till T on September 26, 2013

Sign in to comment

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.