mIRC Homepage

weather

Posted By: ATMA

weather - 30/10/03 11:04 AM

ok when ever i try to run this it gets pissy at me and wont open the socket....

and any other tips and pointers to make this more simple would be very nice grin

Code:
alias getweather { sockopen weather www.weather.com 80 }

on *:sockopen:weather: { 
  sockwrite -n weather GET /weather/local/ $+ %weather.zip.town  $+ ?lswe= $+ %weather.zip.town  $+ &lwsa=WeatherLocalUndeclared HTTP/1.0
  sockwrite -n weather Host: www.weather.com 
  sockwrite -n weather Connection: close
  sockwrite -n weather 
  echo Connecting to sock
}
on *:scokread:weather: {
  var %temp 
  sockread %temp
  if CLASS=obsInfo2><B CLASS=obsTextA> isin %temp {
    set %display.1 1
  }
  if %display.1 {
    if $regex(%temp,/color=black>([^<]+)/g) {
      var %i = 1
      while $regml(%i) {
        set $weather.condition $nohtml($ifmatch) $+ $crlf
        inc %i
      }
    }
    if </B></TD> isin %temp {
      unset %display.1
    }
  }
  if (%weather.short $+ 1.gif isin %temp) {
    set %weather.pic $mircdirimages\icons\1.png
  }
  elseif (%weather.short $+ 2.gif isin %temp) {
    set %weather.pic $mircdirimages\icons\2.png
  }
  elseif (%weather.short $+ 3.gif isin %temp) {
    set %weather.pic $mircdirimages\icons\3.png
  }
  elseif (%weather.short $+ 4.gif isin %temp) {
    set %weather.pic $mircdirimages\icons\4.png
  }
  elseif (%weather.short $+ 5.gif isin %temp) {
    set %weather.pic $mircdirimages\icons\5.png
  }
  elseif (%weather.short $+ 6.gif isin %temp) {
    set %weather.pic $mircdirimages\icons\6.png
  }
  elseif (%weather.short $+ 7.gif isin %temp) {
    set %weather.pic $mircdirimages\icons\7.png
  }
  elseif (%weather.short $+ 8.gif isin %temp) {
    set %weather.pic $mircdirimages\icons\8.png
  }
  elseif (%weather.short $+ 9.gif isin %temp) {
    set %weather.pic $mircdirimages\icons\9.png
  }
  elseif (%weather.short $+ 10.gif isin %temp) {
    set %weather.pic $mircdirimages\icons\10.png
  }
  elseif (%weather.short $+ 11.gif isin %temp) {
    set %weather.pic $mircdirimages\icons\11.png
  }
  elseif (%weather.short $+ 12.gif isin %temp) {
    set %weather.pic $mircdirimages\icons\12.png
  }
  elseif (%weather.short $+ 13.gif isin %temp) {
    set %weather.pic $mircdirimages\icons\13.png
  }
  elseif (%weather.short $+ 14.gif isin %temp) {
    set %weather.pic $mircdirimages\icons\14.png
  }
  elseif (%weather.short $+ 15.gif isin %temp) {
    set %weather.pic $mircdirimages\icons\15.png
  }
  elseif (%weather.short $+ 16.gif isin %temp) {
    set %weather.pic $mircdirimages\icons\16.png
  }
  elseif (%weather.short $+ 17.gif isin %temp) {
    set %weather.pic $mircdirimages\icons\17.png
  }
  elseif (%weather.short $+ 18.gif isin %temp) {
    set %weather.pic $mircdirimages\icons\18.png
  }
  elseif (%weather.short $+ 19.gif isin %temp) {
    set %weather.pic $mircdirimages\icons\19.png
  }
  elseif (%weather.short $+ 20.gif isin %temp) {
    set %weather.pic $mircdirimages\icons\20.png
  }
  elseif (%weather.short $+ 21.gif isin %temp) {
    set %weather.pic $mircdirimages\icons\21.png
  }
  elseif (%weather.short $+ 22.gif isin %temp) {
    set %weather.pic $mircdirimages\icons\22.png
  }
  elseif (%weather.short $+ 23.gif isin %temp) {
    set %weather.pic $mircdirimages\icons\23.png
  }
  elseif (%weather.short $+ 24.gif isin %temp) {
    set %weather.pic $mircdirimages\icons\24.png
  }
  elseif (%weather.short $+ 25.gif isin %temp) {
    set %weather.pic $mircdirimages\icons\25.png
  }
  elseif (%weather.short $+ 26.gif isin %temp) {
    set %weather.pic $mircdirimages\icons\26.png
  }
  elseif (%weather.short $+ 27.gif isin %temp) {
    set %weather.pic $mircdirimages\icons\27.png
  }
  elseif (%weather.short $+ 28.gif isin %temp) {
    set %weather.pic $mircdirimages\icons\28.png
  }
  elseif (%weather.short $+ 29.gif isin %temp) {
    set %weather.pic $mircdirimages\icons\29.png
  }
  elseif (%weather.short $+ 30.gif isin %temp) {
    set %weather.pic $mircdirimages\icons\30.png
  }
  elseif (%weather.short $+ 31.gif isin %temp) {
    set %weather.pic $mircdirimages\icons\31.png
  }
  elseif (%weather.short $+ 32.gif isin %temp) {
    set %weather.pic $mircdirimages\icons\32.png
  }
  elseif (%weather.short $+ 33.gif isin %temp) {
    set %weather.pic $mircdirimages\icons\33.png
  }
  elseif (%weather.short $+ 34.gif isin %temp) {
    set %weather.pic $mircdirimages\icons\34.png
  }
  elseif (%weather.short $+ 35.gif isin %temp) {
    set %weather.pic $mircdirimages\icons\35.png
  }
  elseif (%weather.short $+ 36.gif isin %temp) {
    set %weather.pic $mircdirimages\icons\36.png
  }
  elseif (%weather.short $+ 37.gif isin %temp) {
    set %weather.pic $mircdirimages\icons\37.png
  }
  elseif (%weather.short $+ 38.gif isin %temp) {
    set %weather.pic $mircdirimages\icons\38.png
  }
  elseif (%weather.short $+ 39.gif isin %temp) {
    set %weather.pic $mircdirimages\icons\39.png
  }
  elseif (%weather.short $+ 40.gif isin %temp) {
    set %weather.pic $mircdirimages\icons\40.png
  }
  elseif (%weather.short $+ 41.gif isin %temp) {
    set %weather.pic $mircdirimages\icons\25.png
  }
  elseif (%weather.short $+ 42.gif isin %temp) {
    set %weather.pic $mircdirimages\icons\42.png
  }
  elseif (%weather.short $+ 43.gif isin %temp) {
    set %weather.pic $mircdirimages\icons\43.png
  }
  elseif (%weather.short $+ 44.gif isin %temp) {
    set %weather.pic $mircdirimages\icons\44.png
  }
  elseif (%weather.short $+ 45.gif isin %temp) {
    set %weather.pic $mircdirimages\icons\45.png
  }
  elseif (%weather.short $+ 46.gif isin %temp) {
    set %weather.pic $mircdirimages\icons\46.png
  }
  elseif (%weather.short $+ 47.gif isin %temp) {
    set %weather.pic $mircdirimages\icons\47.png
  }
}

Posted By: rela

Re: weather - 30/10/03 02:20 PM

on *: scokread :weather:
Posted By: pheonix

Re: weather - 30/10/03 02:23 PM

sockopen weather www.weather.com
remove the www.
Posted By: LocutusofBorg

Re: weather - 30/10/03 04:25 PM

The www is irrelevant
Posted By: pheonix

Re: weather - 30/10/03 04:25 PM

ok
Posted By: ATMA

Re: weather - 30/10/03 10:26 PM

umm for some reason its still not staying connected =/ every time i try to do /getweather it says it connects
but when i type /socklist it says:
-
* No open sockets
-
Posted By: pheonix

Re: weather - 31/10/03 04:12 PM

try what rela said also: change on *:scokread:..:{ to on *:sockread
Posted By: ATMA

Re: weather - 01/11/03 01:15 AM

i did... =P
© 2022 mIRC Discussion Forums