Halfway Weather Script - 11/05/04 07:38 AM
Code:
on *:text:!weather *:#: { set %zip.code $2 set %weather.chan $chan weather } alias weather { write -c E:\weather.txt | write -c E:\weather2.txt | window -eh @Weather | sockopen weather weatherforyou.com 80 | .timer 1 5 reportweather } on *:sockread:weather: { //sockread %weather aline 8 @Weather %weather write weather.txt %weather } on *:sockopen:weather: { sockwrite -n $sockname GET /cgi-bin/hw3/hw3.cgi?forecast=zandh&pands= $+ %zip.code $+ &Submit=Get+Forecast HTTP/1.1 sockwrite -n $sockname Host: weatherforyou.com $+ $crlf $+ $crlf } ;http://www.weatherforyou.com/cgi-bin/hw3/hw3.cgi?forecast=zandh&pands=55110&Submit=Get+Forecast alias reportweather { filter -wf @Weather E:\weather2.txt *Local Forecast* filter -wf @Weather E:\weather2.txt *&deg;F* filter -wf @Weather E:\weather2.txt *&deg;C* .timer 1 1 report2 } alias report2 { var %weather.one = $read(E:\weather2.txt,1) var %weather.one = $remove(%weather.one,<span class="titlewhite">) var %weather.one = $remove(%weather.one,Local Forecast</span><br>) set %weather.City %weather.one var %weather.two = $read(E:\weather2.txt,2) var %weather.two = $remove(%weather.two,<font face="Verdana) var %weather.two = $remove(%weather.two,Arial" size="4"><b>) var %weather.two = $remove(%weather.two,</b></font><br>) var %weather.two = $replace(%weather.two,&deg;,$chr(176)) set %weather.temp Current Temp: %weather.two var %weather.three = $read(E:\weather2.txt,3) var %weather.three = $remove(%weather.three,<) var %weather.three = $remove(%weather.three,td align="right" class="smalldefault">) var %weather.three = $remove(%weather.three,/td>) var %weather.three = $replace(%weather.three,&deg;,$chr(176)) set %weather.dew Current Dewpoint: %weather.three window -c @Weather humidity } alias humidity { var %a = $lines(E:\weather.txt) var %b = 1 :begin var %read = $read(E:\weather.txt, %b) if (%b <= %a) { if (Humidity isin %read) && (META !isin %read) { set %humidity Humidity: $read(E:\weather.txt, $calc(%b + 1)) set %humidity $remove(%humidity,<td align="right" class="smalldefault">,</td>) } inc %b goto begin } else { goto end } :end weathersay } alias weathersay { msg %weather.chan %weather.City msg %weather.chan %weather.temp msg %weather.chan %weather.dew msg %weather.chan $remove(%humidity,<td align="right" class="smalldefault">,</td>) }
!weather 55110
OutPuts:
Saint Paul, MN
Current Temp: ,57°F
Current Dewpoint: 36°F
Humidity: 39%
A: I cant get rid of the comma on the temp, ive tried to do something like hi $+ thevar and tried to tokenize it but /me shrugs.
B: I get a butt load of
-
* /aline: insufficient parameters (line 19, script3.mrc)
-
Not sure how to prevent this.
Also sorry for the side scroll I know I hate it to lol