Stealthbot Plugin Help

This is a discussion on Stealthbot Plugin Help within the Warcraft 3 Hacks, bots and tools board part of the Warcraft 3 forum category; Hello, This started today, were my weather Plugin gave me an error. Well, I checked the link that the plugin ...

Results 1 to 3 of 3
  1. #1
    Masterchief's Avatar
    Masterchief is offline Hacker
    Array
    Join Date
    Dec 2008
    Location
    USA
    Posts
    179
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Rep Power
    9
    Reputation
    27

    Exclamation Stealthbot Plugin Help

    Hello,

    This started today, were my weather Plugin gave me an error. Well, I checked the link that the plugin was using to see if the link/site was working. Both are working correct, but I think that it is giving me an error due to weather.com has changed to a "theme" site.

    Here is the Plugin:(Yes, the plugin is in Stealthbot 2.6R3 Plugin System due to thats what im using)

    Code:
     
    'weatherinfo
    '2.1
    '&Weather Info: #Define
    '&weather [city][city, state][zipcode]:forecast [city][city, state][zipcode]
    '&26003
    'Author: #Define
    'Version Info: Added celcius to all temperature data
     
    public ZipcodeFile, WeatherDictionary, VocabDictionary, weatherAccess
     
    Set WeatherDictionary = CreateObject("Scripting.Dictionary")
    Set VocabDictionary = CreateObject("Scripting.Dictionary")
    '//2.1 Edit by Snap - Modified so PressedEnter would work no matter what - and vetothismessage.
    '//Changed "plugin name" to the actual plugin name...
    '//Moved ZipCodeFile to the plugins folder and removed botpath - due to being out of event_load
    ZipcodeFile = ".\plugins\zip-dictionary.txt"
    WeatherAccess = -1
    WeatherFlag = ""
     
    Sub weatherinfo_Event_Load()
      '// Not Used
      'uv, temph3, templ3, fcond3
      VocabDictionary.Add "temp", "temperature"
      VocabDictionary.Add "humid", "humidity"
      VocabDictionary.Add "cond", "condition"
      VocabDictionary.Add "temph1", "today's high"
      VocabDictionary.Add "templ1", "today's low"
      VocabDictionary.Add "fcond1", "condition"
      VocabDictionary.Add "temph2", "tomorrow's high"
      VocabDictionary.Add "templ2", "tomorrow's low"
      VocabDictionary.Add "fcond2", "tomorrow's condition"
      VocabDictionary.Add "dew", "dew"
      VocabDictionary.Add "wind", "wind"
     
      '//Warn user if they are missing the zip-dictionary
      '//Note: weather commands will still work, but only when given a zipcode as <args>
      Set fso = CreateObject("Scripting.FileSystemObject")
      If not fso.FileExists(ZipcodeFile) Then
        addchat vbred, "No zipcode lookup file found."
        addchat vbyellow, "To add zipcode lookup functionality, download the zip-dictionary.txt and place it in stealthbot folder."
      End If
    End Sub
     
    Sub weatherinfo_Event_UserTalk(Username, Flags, Message, Ping)
      If Left(LCase(Message), 9) = BotVars.Trigger & "weather " Then
        GetDBEntry Username, myAccess, myFlags
        If Username = Botvars.Username AND Ping = -4 Then
          VetoThisMessage
        Else
          If myAccess < WeatherAccess and instr(UCase(myFlags), WeatherFlag) = 0 Then Exit Sub
        End If
     
        success = false
        Location = Trim(Mid(Message, 10))
        Call DisplayTodaysWeather(Location)
      End If
     
      If Left(LCase(Message), 10) = BotVars.Trigger & "forecast " Then
        GetDBEntry Username, myAccess, myFlags
        If Username = Botvars.Username AND Ping = -4 Then
          VetoThisMessage
        Else
          If myAccess < WeatherAccess and instr(UCase(myFlags), WeatherFlag) = 0 Then Exit Sub
        End If
     
        success = false
        Location = Trim(Mid(Message, 11))
        Call DisplayAllWeather(Location)
      End If
    End Sub
     
    Sub weatherinfo_Event_WhisperFromUser(Username, Flags, Message)
      Call weatherinfo_Event_UserTalk(Username, Flags, Message, -3)
    End sub
     
    Sub weatherinfo_Event_PressedEnter(Text)
      Call weatherinfo_Event_UserTalk(BotVars.Username, 0, Text, -4)
    End Sub
     
    '-----------------------------------------------------------
    'Display only the common weather information for today
    '-----------------------------------------------------------
    Sub DisplayTodaysWeather(Location)
      success = false
      If Instr(Location, ",") Then
        Args = Split(Location, ",")
        City = Trim(Args(0))
        State = Trim(Args(1))
        Call ObtainWeatherByCity(City, State, cityName, success)
      Else
        If IsNumeric(Location) Then 
          Call ObtainWeatherByZip(Location, cityName, success)
        Else
          Call ObtainWeatherByCity(Location, vbnullstring, cityName, success)
        End If
      End If
     
      If WeatherDictionary.Count > 0 and success = true then
        If WeatherDictionary.Exists("temp") Then
          output = output & "temperature = " & WeatherDictionary.Item("temp") & "F, "
        End If
     
        If WeatherDictionary.Exists("cond") Then
          output = output & "condition = " & WeatherDictionary.Item("cond") & ", "
        End If
     
        If WeatherDictionary.Exists("wind") Then
          output = output & "wind = " & WeatherDictionary.Item("wind") & "mph, "
        End If
     
        If cityName <> vbnullstring Then cityName = cityName & " - "
     
        If output <> vbnullstring then
          output = cityName & Mid(output, 1, len(output) - 2)
          Addq output
        End If
      End If
    End Sub
     
    '-----------------------------------------------------------
    'Display all the weather data that exists in our
    ' vocabulary dictionary.
    '-----------------------------------------------------------
    Sub DisplayAllWeather(Location)
      success = false
      If Instr(Location, ",") Then
        Args = Split(Location, ",")
        City = Trim(Args(0))
        State = Trim(Args(1))
        Call ObtainWeatherByCity(City, State, cityName, success)
      Else
        If IsNumeric(Location) Then 
          Call ObtainWeatherByZip(Location, cityName, success)
        Else
          Call ObtainWeatherByCity(Location, vbnullstring, cityName, success)
        End If
      End If
     
      '//Check if we have anything in the dictionary first
      If WeatherDictionary.Count > 0 and success = true then
        ItemArray = WeatherDictionary.Items
        KeyArray = WeatherDictionary.Keys
     
        For i=0 to ubound(ItemArray)
          '//make sure the data is what we want displayed
          If VocabDictionary.Exists(KeyArray(i)) then
            output = output & VocabDictionary.Item(KeyArray(i)) & "=" & ItemArray(i) & ", "
          End If
        Next
        '//Even though there is data in the dictionary, it might all be unwanted data, so check for null string
        If output <> vbnullstring Then 
          output = Mid(output, 1, len(output)-2)
          Addq output
        End If
      End If
    End Sub
     
    '-----------------------------------------------------------
    'Build dictionary of weather data given a zipcode
    '-----------------------------------------------------------
    Sub ObtainWeatherByZip(byVal zipcode, byRef cityName, byRef success)
      On Error Resume Next
      '//Clear dictionary when entering Sub
      '//Note: Wasn't sure how much overhead is involved in recreating a dictionary every time so I did it this way
      WeatherDictionary.RemoveAll
      If ScINet.stillExecuting then
        success = false
        Exit Sub
      End If
      content = LCase(SciNet.OpenURL("http://www.weather.com/outlook/homeandgarden/home/local/"&zipcode&"?lswe="&zipcode&"&lwsa=Weather36HourHomeCommand&from=whatwhere"))
      'content = LCase(ScINet.OpenURL("http://www.weather.com/outlook/homeandgarden/home/local/"&zipcode&"?from=hp_promolocator&lswe="&zipcode&"&lwsa=Weather36HourHomeCommand"))
     
      '//Invalid zipcode
      If Instr(content, "no items found.") then
        success = false
        Exit Sub
      End If
     
      cityName = vbnullstring
      If instr(content, "today's weather for") Then
        cityData = Mid(content, instr(content, "today's weather for"))
        cityName = Mid(cityData, 20, instr(cityData, "<")-20)
      End If
     
      PosStart = Instr(content, "oas_query")
      PosEnd = Instr(content, "cm_tag")
     
      '//Relevant data is missing
      If PosStart = -1 or PosEnd = -1 or PosEnd < PosStart then
        success = false
        Exit Sub
      End If
     
      Data = Mid(content, PosStart, PosEnd - PosStart)
      DataArray = Split(Data, "&")
     
      '//Build my dictionary
      For i=0 to ubound(DataArray)
        If Instr(DataArray(i), "=") Then
          key = Trim(Split(DataArray(i), "=")(0))
          item = Split(DataArray(i), "=")(1)
          If key = "cond" Then
            item = replace(item, "cloud_partly", "partly cloudy")
            item = replace(item, "clear_mostly_sunny", "clear, mostly sunny")
            item = replace(item, "cloud_mostly", "mostly cloudy")
            item = replace(item, "cloud_haze", "cloudy and hazy")
            item = replace(item, "clear_sunny", "clear and sunny")
            item = replace(item, "clear_mostly", "mostly clear")
            item = replace(item, "rain_showers", "rain showers")
            item = replace(item, "snow_showers", "snow showers")
            item = replace(item, "cloud_fog", "cloudy and foggy")
            If item = "cloud" then item = "cloudy"  
          End If
     
          If Left(key, 4) = "temp" Then
            item = item & " (" & Left(CStr(5/9 * (item - 32)), 4) & "C)"
          End If
          WeatherDictionary.Add key, item
        End If
      Next
      success = true
     
      '//catch any errors and show user in addchat
      If Err.Number <> 0 Then
        addchat vbred, "Error in ObtainWeatherByZip Sub"
     addQ "Im sorry, there is an error with the plugin."
        addchat vbred, Err.Message
        success = false
      End If
      On Error Goto 0
    End Sub
     
    '-----------------------------------------------------------
    'Build dictionary of weather data given a city name and state (optional)
    '-----------------------------------------------------------
    Sub ObtainWeatherByCity(byVal city, byVal state, byRef cityName, byRef success)
      On Error Resume Next
      Set fso = CreateObject("Scripting.FileSystemObject")
      '//Make sure the zipcode file exists first
      If not fso.FileExists(ZipcodeFile) Then
        addchat vbred, "Failed: zipcode lookup file not found, check path"
        success = false
        Exit Sub
      End If
     
      '//Read in all data from text file and then close the file
      Set InFile = fso.OpenTextFile(ZipcodeFile, 1, True) 
      data = InFile.ReadAll
      InFile.close
     
      foundCity = false
     
      If state <> vbnullstring Then '// Only look for cities under given state
        '//Make sure the state given is an actual state abbreviation
        If Instr(data, "*** " & UCase(state) & " ***") = 0 then
          success = false
          Exit Sub
        End If
     
        '//Chop off all data preceding the state we care about
        data = mid(data, instr(data, "*** " & UCase(state) & " ***"))
        data = split(data, vbnewline)   
        For i=1 to ubound(data)
          '//If we hit another state, we went too far and our city is not there
          If Instr(data(i), "***") then
            success = false
            Exit Sub
          End If
          If Instr(data(i), "|") then
            lineInfo = split(data(i), "|")
            If Trim(lcase(lineInfo(0))) = lcase(city) then
              zipcode = Trim(lineInfo(1))
              foundcity = true
              Exit For
            End If
          End If
        Next
      Else '// State is null so find first city that matches
        data = split(data, vbnewline) 
        For i=1 to ubound(data)
          If instr(data(i), "|") then
            lineInfo = split(data(i), "|")
            If Trim(lcase(lineInfo(0))) = Trim(lcase(city)) then
              zipcode = Trim(lineInfo(1))
              foundCity = true
              Exit For
            End If
          End If      
        Next
      End If
     
      '//Did we find the city?
      If foundCity = false then
        success = false
        Exit Sub
      End If
     
      '//catch any errors and show user in addchat
      If Err.Number <> 0 Then
        addchat vbred, "Error in ObtainWeatherByCity Sub"
        addchat vbred, Err.Message
        success = false
      End If
     
      On Error Goto 0
      '//Now we have a valid zipcode, time to build weatherDictionary with it
      Call ObtainWeatherByZip(zipcode, cityName, success)
    End Sub
    Heres the Error:

    [108:14 AM] <JoeUser> .forecast 12345
    [108:15 AM] Error in ObtainWeatherByZip Sub
    [108:15 AM] <Stealthbot> Im sorry, there is an error with the plugin.
    Thanks for your help!

    Also, I will leave a for any users who help!

    Last edited by Masterchief; 02-13-2010 at 10:45 PM.

  2. #2
    Masterchief's Avatar
    Masterchief is offline Hacker
    Array
    Join Date
    Dec 2008
    Location
    USA
    Posts
    179
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Rep Power
    9
    Reputation
    27
    Can anybody fix this for me please?

  3. #3
    Yoyoshawty is offline Mentor Array
    Join Date
    Oct 2008
    Posts
    111
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Rep Power
    0
    Reputation
    3
    PHP Code:
    Script("Name") = "Weather"
    Script("Author") = "eXiLed."
    Script("Major") = 1
    Script
    ("Minor") = 4
    Script
    ("Revision") = 0


    Private wtFSO          '// FileSystemObject
    Private wtFP           '
    // ini file path
    Private wtXML          '// XMLHTTP object
    Private wtAttempts     '
    // Number of times the same site gets accessed
    Private wtLastRequest  '// Holds Now() for anti-spam
    Private wtUS           '
    // US states that need to be gathered
    Private wtCA           '// Canada provinces that need to be gathered
    Private wtLocation     '
    // Location that's currently being looked at
    Private wtSource       '// Origin of the command
    Private wtCities       '
    // Number of cities that need to be gathered


    Sub Event_Load()

       
    wtFP BotPath "Weather Script - City Directory.ini"
       
    Set wtFSO CreateObject("Scripting.FileSystemObject")
       
    Set wtCities CreateObject("Scripting.Dictionary")
       
    Set wtXML CreateObject("Msxml2.XMLHTTP")
       
       
    Call CreateCmds

       wtAttempts 
    0
       
       wtLastRequest 
    Now-1

       
    If NOT wtFSO.FileExists(wtFPThen
          Call CreateObj
    ("LongTimer""GetProvinceState")
          
    GetProvinceState.Interval 10
          GetProvinceState
    .Enabled False

          Call CreateObj
    ("LongTimer""GetCities")
          
    GetCities.Interval 5
          GetCities
    .Enabled False

          wtUS 
    51
          wtCA 
    13
          GetProvinceState
    .Enabled True
       End 
    If

       
    Call CreateObj("LongTimer""GetWeatherInfo")
       
    GetWeatherInfo.Interval 5
       GetWeatherInfo
    .Enabled False
    End Sub


    Sub Event_Command
    (Command)

       
    Select Case Lcase(Command.Name)
          Case 
    "weather" Call weatherCMD(CommandNow)
       
    End Select
    End Sub


    Private Sub weatherCMD(CommandsNow)

       If 
    Command.WasWhispered Then Exit Sub
       
    If DateDiff("s"wtLastRequestNow) < CInt(GetSettingsEntry("antispam")) Then Exit Sub   
       
       
    If NOT CheckCityFile Then
          Command
    .Respond "Unable to determine weather information; required city file is non-existant or is incomplete. Please contact the bot owner."
          
    Exit Sub
       End 
    If
       
       
    args Command.Args

       city 
    Left(argsInStr(args", ")-1)
       
    provstate Mid(argsInStr(args", ")+2)

       If 
    Len(provstate) = 2 Then
          webLocation 
    GetProvStateShort(cityprovState)      
       Else
          
    webLocation GetConfigEntry(provstatecitywtFP)
       
    End If
       
       If 
    LenB(webLocation) = 0 Then
          Command
    .Respond "I cannot find information for the location "" " Command.Args " "". Please try a different city or check your spelling."
          
    Exit Sub
       End 
    If

       
    wtLocation webLocation wtSource Command.Source   
       Call GetWeatherInfo_Timer
    End Sub


    Sub GetWeatherInfo_Timer
    ()

       
    Call wtXML.Open("GET""http://www.google.ca" RNDTrue)
       
    Call wtXML.Open("GET""http://www.theweathernetwork.com/weather/" wtLocationTrue)
       
    Call wtXML.Send()

       If 
    wtXML.readyState 4 Then
          
    If wtXML.Status 200 Then
             data 
    wtXML.responseText        
          GetWeatherInfo
    .Enabled False
             Call ParseWeather
    (datawtSource)
             Exit 
    Sub
          End 
    If
       
    End If

       
    wtAttempts wtAttempts+1
       
    If NOT GetWeatherInfo.Enabled Then GetWeatherInfo.Enabled True
       
       
    If wtAttempts <> AND wtAttempts MOD 3 0 Then
          GetWeatherInfo
    .Interval GetWeatherInfo.Interval GetWeatherInfo.Interval
          AddChat 16759296
    "Weather Script: "10682112"After 3 consecutive attempts of getting no updated responses from the website, the script will increase the rate of which it is requesting information to every " GetWeatherInfo.Interval " seconds."
       
    End If
    End Sub


    Sub GetProvinceState_Timer
    ()

       If 
    wtCities.Count 13+51 Then
          AddChat 16759296
    "Weather Script: "10682112"All States and Provinces have been accounted for. Attempting to locate all cities for each State and Province..."
          
    GetProvinceState.Enabled False
          wtAttempts 
    0
          wtUS 
    vbNullString
          wtCA 
    vbNullString
          GetCities
    .Enabled True
          
    Exit Sub
       End 
    If

       
    AddChat 16759296"Weather Script: "10682112"Canadian Provinces remaining: " 13-CA
       AddChat 16759296
    "Weather Script: "10682112"United States remaining: " 51-US

       sFound 
    0

       
    If wtCA 0 Then
         
    '// Canadian Cities
          Call wtXML.Open("GET", "http://www.google.ca" & RND, True)
          Call wtXML.Open("GET", "http://www.theweathernetwork.com/index.php?product=weather&pagecontent=cancities_en", True)
          Call wtXML.Send()

          If wtXML.readyState = 4 Then
             If wtXML.Status = 200 Then
                data = wtXML.responseText

                provinceRaw = Mid(data, InStr(data, "<ol>")+4)
                provinceRaw = Mid(provinceRaw, 1, InStr(provinceRaw, "</ol>"))
                provinceArr = Split(provinceRaw, "cancities")

                For i =1 To Ubound(provinceArr)
                   province = Mid(provinceArr(i), InStr(provinceArr(i), ">")+1)
                   province = Trim(Left(province, Len(province)-Len(province)+InStr(province, "<")-1))
                   If NOT wtCities.Exists(province & " - Canada") Then
                      sFound = sFound+1
                      wtCities.Item(province & " - Canada") = Left(provinceArr(i), 5)
                      wtCA = wtCA -1
                   End If
                Next
             Else
                AddChat vbRed, "Bad request for populating cities - " & wtXML.StatusText
                Exit Sub
             End If
          End If
       End If

       If wtUS > 0 Then
         '
    // US Cities
          
    Call wtXML.Open("GET""http://www.google.ca" RNDTrue)
          
    Call wtXML.Open("GET""http://www.theweathernetwork.com/index.php?product=weather&pagecontent=usacities_en"True)
          
    Call wtXML.Send()

          If 
    wtXML.readyState 4 Then
             
    If wtXML.Status 200 Then
                data 
    wtXML.responseText

                stateRaw 
    Mid(dataInStr(data"<ol>")+4)
                
    stateRaw Mid(stateRaw1InStr(stateRaw"</ol>"))
                
    stateArr Split(stateRaw"usacities")

                For 
    =1 To Ubound(stateArr)
                   
    state Mid(stateArr(i), InStr(stateArr(i), ">")+1)
                   
    state Trim(Left(stateLen(state)-Len(state)+InStr(state"<")-1))
                   If 
    NOT wtCities.Exists(state " - United States"Then
                      sFound 
    sFound+1
                      wtCities
    .Item(state " - United States") = Left(stateArr(i), 5)
                      
    wtUS wtUS-1
                   End 
    If
                
    Next
             
    Else
                
    AddChat vbRed"Bad request for populating cities - " wtXML.StatusText
                
    Exit Sub
             End 
    If
          
    End If
       
    End If

       If 
    sFound 0 Then
          wtAttempts 
    wtAttempts+1
       
    Else
          
    wtAttempts 0
          GetProvinceState
    .Interval 5
       End 
    If

       If 
    wtAttempts <> AND wtAttempts MOD 3 0 Then
          GetProvinceState
    .Interval GetProvinceState.Interval GetProvinceState.Interval
          AddChat 16759296
    "Weather Script: "10682112"After 3 consecutive attempts of getting no updated responses from the website, the script will increase the rate of which it is requesting information to every " GetProvinceState.Interval " seconds."
       
    End If
    End Sub


    Sub GetCities_Timer
    ()

       If 
    wtCities.Count 0 Then
          GetCities
    .Enabled False
          AddChat 16759296
    "Weather Script: "10682112"All cities have been found. Script is ready to use."
          
    Exit Sub
       End 
    If

       
    AddChat 16759296"Weather Script: "10682112"Cities remaining: " wtCities.Count

       sName 
    wtCities.Keys
       sItems 
    wtCities.Items

       sFound 
    0

       
    For 0 To Ubound(sName)
          
    Call wtXML.Open("GET""http://www.google.ca"True)

          If 
    Instr(sName(i), "Canada") > 0 Then
             Call wtXML
    .Open("GET""http://www.theweathernetwork.com/index.php?product=weather&pagecontent=cancities" sItems(i), True)
          ElseIf 
    InStr(sName(i), "United States") > 0 Then
             Call wtXML
    .Open("GET""http://www.theweathernetwork.com/index.php?product=weather&pagecontent=usacities" sItems(i), True)
          
    End If

          
    Call wtXML.Send()

          If 
    wtXML.readyState 4 Then
             
    If wtXML.Status 200 Then
                data 
    wtXML.responseText

                cityRaw 
    Mid(dataInstr(data"<ol>")+4)
                
    cityRaw Mid(cityRaw1InStr(cityRaw"</ol><br />"))
                
    cityArr Split(cityRaw"/weather/")

                For 
    j=1 To Ubound(cityArr)
                   If 
    InStr(cityArr(j), "</a></li>") > 0 Then
                      c1 
    Mid(cityArr(j), InStr(cityArr(j), ">")+1)
                      
    c2 Left(c1InStr(c1"<")-1)
                      
    provstate Left(sName(i), InStr(sName(i), " - ")-1)
                      
    WriteConfigEntry provstatec2Left(cityArr(j), 8), wtFP
                   End 
    If
                
    Next
                sFound 
    sFound+1
                wtCities
    .Remove sName(i)
             Else
                
    AddChat vbRed"Bad request for populating cities - " wtXML.StatusText
                wtCities
    .Remove sName(i)
             
    End If
          
    End If
       
    Next

       
    If sFound 0 Then
          wtAttempts 
    wtAttempts+1
       
    Else
          
    wtAttempts 0
          GetCities
    .Interval 5
       End 
    If

       If 
    wtAttempts <> AND wtAttempts MOD 3 0 Then
          GetCities
    .Interval GetCities.Interval GetCities.Interval
          AddChat 16759296
    "Weather Script: "10682112"After 3 consecutive attempts of getting no updated responses from the website, the script will increase the rate of which it is requesting information to every " GetCities.Interval " seconds."
       
    End If
    End Sub


    Private Sub CreateCmds()

       If 
    GetSettingsEntry("antispam") = vbNullString Then
          WriteSettingsEntry 
    "'//  Change this value to the number of seconds users must wait before using the command again."vbNullString
          WriteSettingsentry 
    "antispam"10
       End 
    If

       
    Set cmd OpenCommand("weather")
       If 
    cmd Is Nothing Then
          Set cmd 
    CreateCommand("weather")
          
    With cmd
             
    .Description "Looks up the current weather for the specified city and province/state."
             
    .RequiredRank 200
             Set Parameter 
    = .NewParameter("Location"False"String")
             
    With Parameter
                
    .Description "City, State/Province."
                
    .MatchMessage "^[a-zA-Z ].+, [a-zA-Z ].+$"
                
    .MatchError "Input must follow the format: City, State/Province"
                
    .SpecialNotes "State/Provinces can be abbreviated to two letters."
             
    End With
             
    .Parameters.Add Parameter
             
    .Save
          End With
       End 
    If

       
    Set cmd Nothing
    End Sub


    Private Sub ParseWeather(dataorigin)
        
       
    '// Current Conditions
       dataIso = Mid(data, InStr(data, "Current Weather"))
          
       wLocation = Mid(dataIso, InStr(dataIso, "display:")+7)
       wLocation = Mid(wLocation, InStr(wLocation, ">")+1)
       wLocation = Left(wLocation, InStr(wLocation, "<")-1)
       
       wCondition = Mid(dataIso, InStr(dataISo, "title=""")+7)
       wCondition = Left(wCondition, InStr(wCondition, """")-1)
       
       wTemp = Mid(dataIso, InStr(dataIso, "<p>")+3)
       wTempC = CInt(Left(wTemp, InStr(wTemp, "<")-1))
       wTempF = CInt(wTempC*(9/5)+32)
       wUnit = Mid(dataIso, InStr(dataIso, "&deg;")+5)
       wUnit = Left(wUnit, InStr(wUnit, "<")-1)
       
       '
    // Short term Forecast
       
    '// Overnight: 12:00 AM - 5:59 AM
       '
    // Morning: 6:00 AM - 11:59 AM
       
    '// Afternoon: 12:00 PM - 5:59 PM
       '
    // Evening: 6:00 PM - 11:59 PM
       
       
    dataIso Mid(dataInStr(data"Short Term Forecast"))
       
       If 
    InStr(dataIso"onmouseover=""tooltip(") > 0 Then
          wDayIso 
    Mid(dataIsoInStr(dataIso"<th>")+4)
          
    wDayIso Left(wDayIsoInStr(wDayIso"</tr>")-5)
          
    wDayIso Split(wDayIso"<th>")
          For 
    0 To Ubound(wDayIso)
             
    wDay Mid(wDayIso(i), InStr(wDayIso(i), "<th>")+4)
             
    wDay Left(wDayInStr(wDay"<")-1):wDay Replace(wDayCHR(9), vbNullString):wDay Replace(wDayCHR(32), vbNullString):wDay Replace(wDayvbCrLfvbNullString)   
             
             
    wTime Mid(wDayIso(i), InStr(wDayIso(i), "tooltip"">")+9)
             
    wTime Left(wTimeInStr(wTime"<")-1)   
             
             
    tHour Hour(time)
             
             If 
    tHour => AND tHour 6 Then
                wDay 
    wDay " " wTime
                
    Exit For   
             ElseIf 
    tHour => AND tHour 12 Then
                wDay 
    wDay " " wTime       
                
    Exit For 
             ElseIf 
    tHour => 12 AND tHour 18 Then
                wDay 
    wDay " " wTime         
                
    Exit For             
             ElseIf 
    tHour => 18 AND tHour 0 Then
                wDay 
    wDay " " wTime        
                
    Exit For  
             
    End If
          
    Next
          
          
    '// Condition
          temp = Mid(dataIso, InStr(dataIso, "stcond")+6)
          temp = Left(temp, InStr(temp, "</tr>")-5)
          temp = Split(temp, "cond"">")
          wConditionB = Left(temp(i+1), InStr(temp(i+1), "<")-1)      
          
          '
    // Temp
          
    temp Mid(dataIsoInStr(dataIso"sttemp")+6)
          
    temp Left(tempInStr(temp"</tr>")-5)
          
    temp Split(temp"temp"">")
          
    wTempCB Left(temp(i+1), InStr(temp(i+1), "&")-1)   
          
    wTempFB CInt(wTempCB*(9/5)+32)
          
    wUnitB Mid(temp(i+1), InStr(temp(i+1), ";")+1):wUnitB Left(wUnitB1)
          
          
    '// Percent of Precipitation
          temp = Mid(dataIso, InStr(dataIso, "stpop")+6)
          temp = Left(temp, InStr(temp, "</tr>")-5)
          temp = Split(temp, "<td>")      
          wPOP = Replace(temp(i+1), CHR(9), vbNullString):wPOP = Replace(wPOP, CHR(32), vbNullString):wPOP = Left(wPOP, Instr(wPOP, "<")-1):wPOP = Replace(wPOP, vbNewLine, vbNullString)
          
          '
    // Wind
          
    temp Mid(dataIsoInStr(dataIso"stwind")+6)
          
    temp Left(tempInStr(temp"</tr>")-5)
          
    temp Split(temp"<td>")      
          
    wWind Replace(temp(i+1), CHR(9), vbNullString):wWind Left(wWindInstr(wWind"<")-1):wWind Replace(wWindvbNewLinevbNullString)
          
    wWindMPH Mid(wWindInStr(wWind" ")+1):wWindMPH Left(wWindMPHInStr(wWindMPH"k")-1):wWindMPH CInt(wWindMPH/1.609)
          
          
    '// Humidity
          temp = Mid(dataIso, InStr(dataIso, "sthumidity")+10)
          temp = Left(temp, InStr(temp, "</tr>")-5)
          temp = Split(temp, "<td>")
          wHumidity = Replace(temp(i+1), CHR(9), vbNullString):wHumidity = Replace(wHumidity, CHR(32), vbNNullsTring):wHumidity = Left(wHumidity, Instr(wHumidity, "<")-1):wHumidity = Replace(wHumidity, vbNewLine, vbNullString)
          
          '
    // Rain / Snow
          
    If InStr(dataIso"stprecip")>0 Then
             temp 
    Mid(dataIsoInStr(dataIso"stprecip")+8)
             
    temp Left(tempInStr(temp"</tr>")-5)
             
    temp Split(temp"<td>")
             
    wRain Replace(temp(i+1), CHR(9), vbNullString):wRain Left(wRainInstr(wRain"<")-1):wRain Replace(wRainvbNewLinevbNullString)
          
    End If
          
          If 
    InStr(dataIso"stsnow")>0 Then
             temp 
    Mid(dataIsoInStr(dataIso"stsnow")+6)
             
    temp Left(tempInStr(temp"</tr>")-5)
             
    temp Split(temp"<td>")
             
    wSnow Replace(temp(i+1), CHR(9), vbNullString):wSnow Left(wSnowInstr(wSnow"<")-1):wSnow Replace(wSnowvbNewLinevbNullString)
          
    End If
          
          If (
    wRain "-" AND wSnow "-") OR (LenB(wRain)=AND LenB(wSnow) = 0Then
             wPrecipType 
    "No rain or snow"
          
    Else
             If 
    wRain "-" OR LenB(wRain) = 0 Then
                
    If wSnow <> "-" Then wPrecipType "Snow: " wSnow
             
    Else
                If 
    wSnow "-" OR LenB(wSnow) = 0 Then wPrecipType "Rain: " wRain
             End 
    If
          
    End If   
          
       Else
          
    wDayIso Split(dataIso"table class=""stermfxus""")
          For 
    1 To 2
             temp 
    Mid(wDayIso(i), InStr(wDayIso(i), "thead")+5):temp Left(tempInStr(temp"</tr>")-5):temp Split(temp"<th scope=""col""")
             For 
    1 To UBound(temp)
                
    wTime Replace(temp(j), CHR(9), vbNullString):wTime Replace(wTimevbNewLinevbNullString):wTime Left(wTimeInStr(wTime"<")-1):wTime Right(wTimeLen(wTime)-1):wTime Replace(wTime"class=""lastColumn"">"vbNullString)
                
    tTime Hour(Time)

                If 
    tTime 23 Then tTime 0            
                
                tMatch 
    False
                
    If tTime <= Hour(wTimeThen
                   wDay 
    wTime
                   tMatch 
    True
                   
    Exit For
                
    End If            
             
    Next
             
    If tMatch Then Exit For
          
    Next   
          
          
    '// Condition
          temp = Mid(wDayIso(i), InStr(wDayIso(i), "<td class=""cond""")+16)
          temp = Left(temp, InStr(temp, "</tr>")+5)
          wConditionB = Split(temp, "</td>")(j-1):wConditionB = Mid(wConditionB, InStr(wConditionB, ">")+1)    

          '
    // Temp
          
    temp Mid(wDayIso(i), InStr(wDayIso(i), "td class=""temp""")+15)
          
    temp Left(tempInStr(temp"</tr>")+5)
          
    temp Split(temp"temp")(j):temp Replace(tempCHR(9), vbNullString):temp Replace(tempvbNeWLinevbNullString):temp Left(tempInStr(temp"<")-1)
          
    wTempCB Left(tempInStr(temp"&")-1):wTempCB Mid(wTempCBInStr(wTempCB">")+1)     
          
    wTempFB CInt(wTempCB*(9/5)+32)
          
    wUnitB Mid(tempInStr(temp";")+1)
          
          
    '// Percent of Precipitation
          temp = Mid(wDayIso(i), InStr(wDayIso(i), "P.O.P.</a></td>")+15)
          temp = Left(temp, InStr(temp, "</tr>")+5)
          wPOP = Split(temp, "<td")(j):wPOP = Mid(wPOP, InStr(wPOP, ">")+1):wPOP = Left(wPOP, InStr(wPOP, "<")-1)
          
          '
    // Wind
          
    temp Mid(wDayIso(i), InStr(wDayIso(i), "Wind</a></td>")+13)
          
    temp Left(tempInStr(temp"</tr>")+5)
          
    wWind Split(temp"<td")(j):wWind Mid(wWindInStr(wWind">")+1):wWind Left(wWindInStr(wWind"<")-1)
          
    wWindMPH Mid(wWindInStr(wWind" ")+1):wWindMPH Left(wWindMPHInStr(wWindMPH" k")-1):wWindMPH CInt(wWindMPH/1.609)
          
          
    '// Humidity
          temp = Mid(wDayIso(i), InStr(wDayIso(i), "Humidity</a></td>")+17)
          temp = Left(temp, InStr(temp, "</tr>")+5)
          wHumidity = Split(temp, "<td")(j):wHumidity = Mid(wHumidity, InStr(wHumidity, ">")+1):wHumidity = Left(wHumidity, InStr(wHumidity, "<")-1):wHumidity = Replace(wHumidity, CHR(9), vbNullString):wHumidity = Replace(wHumidity, vbNewLine, vbNullSTring):wHumidity = Replace(wHumidity, CHR(32), vbNullString)

          '
    // Rain / Snow
          
    temp Mid(wDayIso(i), InStr(wDayIso(i), "Rain</a></td>")+13)
          
    temp Left(tempInStr(temp"</tr>")+5)
          
    wRain Split(temp"<td")(j):wRain Mid(wRainInStr(wRain">")+1):wRain Left(wRainInStr(wRain"<")-1):wRain Replace(wRainCHR(9), vbNullString):wRain Replace(wRainvbNewLinevbNullSTring)
          
          
    temp Mid(wDayIso(i), InStr(wDayIso(i), "Snow</a></td>")+13)
          
    temp Left(tempInStr(temp"</tr>")+5)
          
    wSnow Split(temp"<td")(j):wSnow Mid(wSnowInStr(wSnow">")+1):wSnow Left(wSnowInStr(wSnow"<")-1):wSnow Replace(wSnowCHR(9), vbNullString):wSnow Replace(wSnowvbNewLinevbNullSTring)
          
          If (
    wRain "-" AND wSnow "-") OR (LenB(wRain)=AND LenB(wSnow) = 0Then
             wPrecipType 
    "No rain or snow"
          
    Else
             If 
    wRain "-" OR LenB(wRain) = 0 Then
                
    If wSnow <> "-" Then wPrecipType "Snow: " wSnow
             
    Else
                If 
    wSnow "-" OR LenB(wSnow) = 0 Then wPrecipType "Rain: " wRain
             End 
    If
          
    End If           
       
    End If
       
       
    Select Case origin
          
    Case 1
             AddQ 
    "Weather for " wLocation ": Currently " wTempC CHR(176) & wUnit " (" wTempF CHR(176) & "F) - " wCondition ". " wDay ": " wConditionB ", " wTempCB CHR(176) & wUnitB " (" wTempFB CHR(176) & "F), P.O.P: " wPOP ", Winds: " wWind " (" wWindMPH " mi/h), Humidity: " wHumidity ", " wPrecipType "."
          
    Case 2
             AddQ 
    "Weather for " wLocation ": Currently " wTempC CHR(176) & wUnit " (" wTempF CHR(176) & "F) - " wCondition ". " wDay ": " wConditionB ", " wTempCB CHR(176) & wUnitB " (" wTempFB CHR(176) & "F), P.O.P: " wPOP ", Winds: " wWind " (" wWindMPH " mi/h), Humidity: " wHumidity ", " wPrecipType "."
          
    Case 4
             AddChat 16759296
    "Weather Script: "10682112"Weather for " wLocation ": Currently " wTempC CHR(176) & wUnit " (" wTempF CHR(176) & "F) - " wCondition ". " wDay ": " wConditionB ", " wTempCB CHR(176) & wUnitB " (" wTempFB CHR(176) & "F), P.O.P: " wPOP ", Winds: " wWind " (" wWindMPH " mi/h), Humidity: " wHumidity ", " wPrecipType "."
       
    End Select   
       
       wtLastRequest 
    Now
    End Sub


    Private Function GetProvStateShort(cityprovState)

       
    Set File wtFSO.OpenTextFile(wtFP1True)
       
    data Split(LCase(File.ReadAll), vbNewLine)
       
    File.Close
       Set File 
    Nothing
       
       
    For Each line In data
          
    If InStr(line"[") < AND line <> vbNullString Then
             temp 
    Mid(lineInStr(line"=")+3)
             
    temp1 Left(lineInStr(line"=")-1)
             If 
    Left(temp2) = Lcase(provState) AND temp1 Lcase(cityThen 
                GetProvStateShort 
    Mid(lineInStr(line"=")+1)
                Exit Function
             
    End If
          
    End If
       
    Next
       
       GetProvStateShort 
    vbNullString
    End 
    Function


    Private Function 
    CheckCityFile

       
    If wtFSO.FileExists(wtFPThen
          Set getFile 
    wtFSO.GetFile(wtFP)
          If 
    Int(getFile.Size/1000) < 140 Then
             CheckCityFile 
    False
          
    Else
             
    CheckCityFile True
          End 
    If
       Else
          
    CheckCityFile False
       End 
    If   

       
    Set getFile Nothing      
    End 
    Function 
    Last edited by Yoyoshawty; 02-14-2010 at 11:00 AM.

Similar Threads

  1. Stealthbot Anleitung
    By Adrenalin in forum Deutsch
    Replies: 6
    Last Post: 03-19-2010, 07:18 PM
  2. New version : 2.7
    By xiN in forum Warcraft 3 Hacks, bots and tools
    Replies: 5
    Last Post: 11-16-2009, 12:11 AM
  3. HypGameColor -- Color Plugin
    By Toxik in forum Diablo 2 Hacks
    Replies: 1
    Last Post: 04-07-2009, 10:34 PM
  4. Stealthbot Plugin help!
    By gulf80 in forum Warcraft 3 Hacks, bots and tools
    Replies: 9
    Last Post: 12-15-2008, 06:57 PM
  5. StealthBot; Plugin System
    By xiN in forum Warcraft 3 Hacks, bots and tools
    Replies: 0
    Last Post: 07-06-2008, 02:49 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •