Hi Sybershot.
I updated the plugin, you can manually put your zip code in both code sections to manually override zip code tables.
I have modded the plugin to work with your zip code manually, try this plugin and let me know if it works with your HAL.
Rem Type=Plugin
Rem Name= Weather Alert 3
Rem Author= Bill DeWitt, OnTheCuttingEdge2005
Rem Host=All
'-----------------------------------------------------------------
'This sub sets up the plug-ins option panel in Hal's options dialog
'-----------------------------------------------------------------
Sub OptionsPanel()
lblPlugin(0).Caption = "Simple plugin to read the weather conditions to you. Use different phrases for different reports - see script."
lblPlugin(0).Move 120, 120, 3300, 1200
lblPlugin(0).WordWrap = True
lblPlugin(0).Visible = True
End Sub
Rem PLUGIN: PLUGINAREA7
If HalBrain.CheckTableExistence("UserWeather") = False Then HalBrain.CreateTable "UserWeather", "TopicSearch", ""
GetWeatherPat = HalBrain.SearchPattern(UserSentence, "*ZIP CODE IS *", 2)
If GetWeatherPat <> "" Then
GetResponse = "I have stored your Zip code for future weather forecasts, from now on all you have to do is ask about your weather."
HalBrain.AddToTable "UserWeather", "TopicSearch", UserName, GetWeatherPat
End If
HalBrain.ReadOnlyMode = False
'Determines that you are talking about the weather
GetW = HalBrain.TopicSearch(UserName, "UserWeather")
'Added Mod here
If Len(GetW) < 2 Then GetW = "02838" '<--- You can add your zip code manually here if you wish.
If InStr(1,OriginalSentence, "weather",1) And Len(GetW) > 2 Then
GetResponse = "For the " & GetW & " zipcode area, " & GetForecast(UserName)
ElseIf InStr(1,OriginalSentence, "weather",1) And Len(GetW) < 2 Then
GetResponse = "I have not recorded your zip code for weather in your area, simply say, My zip code is 12345, where 12345 would be your zip code and I will save it for future weather look up in your area, after doing so simply say: Weather."
End If
Rem PLUGIN: FUNCTIONS
Function GetForecast(UserName)
Dim objXMLNews
Dim NewsArray()
set objXMLNews = CreateObject("Msxml2.DomDocument.4.0")
objXMLNews.async = False
objXMLNews.ValidateOnParse = false
GetW = HalBrain.TopicSearch(UserName, "UserWeather")
'Added Mod here
If Len(GetW) < 2 Then GetW = "02838" '<--- You can add your zip code manually here if you wish.
objXMLNews.load("http://www.intellicast.com/IcastRSS/FcstRSS.aspx?loc=" & GetW & "&CID=15786")
Dim xmlNodeNews
set xmlNodeNews = objXMLNews.documentElement.selectNodes("//item")
Dim xmlNewsItem
dim strResult
For Each xmlNewsItem In xmlNodeNews
CountNews = CountNews+1
Next
ReDim NewsArray(CountNews-1)
For Each xmlNewsItem In xmlNodeNews
If xmlNewsItem.selectSingleNode("title").Text = "Forecast" Then
Set oForcast = xmlNewsItem.selectSingleNode("description")
End If
If xmlNewsItem.selectSingleNode("title").Text = "High Temperature" Then
Set oHighTemp = xmlNewsItem.selectSingleNode("description")
End If
If xmlNewsItem.selectSingleNode("title").Text = "Low Temperature" Then
Set oLowTemp = xmlNewsItem.selectSingleNode("description")
End If
Next
s= DialogChooseThree("We are expecting ", "The forecast calls for ", "I'm told we will have ") & oForcast.text _
& DialogChooseThree(" weather with a high of ", " weather. Our high could reach ", " weather. The high temp should be ") & oHighTemp.text _
& DialogChooseThree(" and a low of ", " and our low may reach ", " and it may get as low as ") & oLowTemp.text & " degrees."
GetForecast = s
End Function
Function GetCurrent()
Set objXMLDoc = CreateObject("Microsoft.XMLDOM")
objXMLDoc.async = False
objXMLDoc.load("http://www.weather.gov/data/current_obs/KVSF.xml")
Set oWeather = objXMLDoc.documentElement.selectSingleNode("weather")
Set oTemperature = objXMLDoc.documentElement.selectSingleNode("temp_f")
Set oHumidity = objXMLDoc.documentElement.selectSingleNode("relative_humidity")
Set oWind = objXMLDoc.documentElement.selectSingleNode("wind_string")
s= DialogChooseThree("The weather is ", "The current conditions are ", "The weather at the airport is ") & oWeather.text _
& DialogChooseThree(". The present temperature is ", ". The temperature is ", ". It's ") & oTemperature.text & " degrees farenhite" _
& DialogChooseThree(", the relative humidity is ", ", the humidity outside is ", ", our humidity is at ") & oHumidity.text & " percent" _
& DialogChooseThree(" and the wind is ", " and winds are ", " and our winds are ") & oWind.text & "."
GetCurrent = s
End Function
Function DialogChooseThree(ChoiceOne, ChoiceTwo, ChoiceThree)
'--------------------------------------------
'Selects from three strings sent as arguments
'--------------------------------------------
Randomize
Select Case Int(rnd()*3)
Case 0 DialogChooseThree=ChoiceOne
Case 1 DialogChooseThree=ChoiceTwo
Case 2 DialogChooseThree=ChoiceThree
Case Else ChoiceOne
End Select
End Function
I hope it works.
Jerry