Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; IRC Weather Server Script
- ; by Riamus
- ; v1.25
- ; #OldGames on Undernet
- ; In this version, § ( $chr(167) ) is used for linebreaking
- ctcp *:version: {
- .ctcpreply $nick version IRCWeather v1.25 by Riamus - http://www.KakkoiiTranslations.net/mircscripts/
- }
- on *:start:{
- if ($readini(" $+ $scriptdir\IRCWeather.ini $+ ",Settings,AutoUpdate) == 1) {
- IWUpdate
- }
- WeatherRegistrationsHash
- }
- on *:load:{
- dialog -m WSetup WSetup
- }
- dialog WSetup {
- title "Weather Setup"
- size -1 -1 150 202
- option dbu
- box "Channels",10,6 4 59 60
- combo 1,8 12 40 40,autohs
- button "Add",100,50 12 14 10
- button "Rem",101,50 22 14 10
- check "All Channels",102,8 52 40 10
- check "Allow Weather in Query",300,75 37 80 10
- check "Check for updates on start",301,75 47 80 10
- box "Colors",11,75 5 70 30
- text "Primary:",12,77 12 30 10
- combo 2,110 11 30 10,drop
- text "Secondary:",13,77 23 30 10
- combo 3,110 22 30 10,drop
- box "Default Units",15,6 66 139 20
- radio "SI (Celsius, kilometers)",204,8 73 70 10,group
- radio "US (Fahrenheit, miles)",205,80 73 62 10
- box "!weather Display Format",14,6 87 139 50
- radio "Location: *, Updated: *, Temp: *, etc.",200,8 94 135 10,group
- radio "Location: * § Updated: * § Temp: * § etc.",201,8 103 135 10
- radio "Custom:",202,8 112 100 10
- edit "",203,8 122 135 10,autohs
- box "!forecast Display Format",16,6 137 139 50
- radio "Forecast for: *, Updated: * - Day1: * and *, etc.",206,8 144 135 10,group
- radio "Forecast for: * § Updated: * § Day1: * and * § etc.",207,8 153 135 10
- radio "Custom:",208,8 162 100 10
- edit "",209,8 172 135 10,autohs
- button "OK",20,65 190 20 10
- }
- on *:dialog:WSetup:init:0: {
- if ($readini(" $+ $scriptdir\IRCWeather.ini $+ ",Settings,FormatNum) == 2) { did -c $dname 201 }
- elseif ($readini(" $+ $scriptdir\IRCWeather.ini $+ ",Settings,FormatNum) == 3) { did -c $dname 202 }
- else { did -c $dname 200 }
- if ($readini(" $+ $scriptdir\IRCWeather.ini $+ ",Settings,FormatNum.forecast) == 2) { did -c $dname 207 }
- elseif ($readini(" $+ $scriptdir\IRCWeather.ini $+ ",Settings,FormatNum.forecast) == 3) { did -c $dname 208 }
- else { did -c $dname 206 }
- if ($readini(" $+ $scriptdir\IRCWeather.ini $+ ",Settings,DefaultType) == si) { did -c $dname 204 }
- else { did -c $dname 205 }
- if ($readini(" $+ $scriptdir\IRCWeather.ini $+ ",Settings,AllChans) == 1) { did -c $dname 102 }
- if ($readini(" $+ $scriptdir\IRCWeather.ini $+ ",Settings,AllowQuery) == 1) { did -c $dname 300 }
- if ($readini(" $+ $scriptdir\IRCWeather.ini $+ ",Settings,AutoUpdate) == 1) { did -c $dname 301 }
- did -a $dname 2 Black
- did -a $dname 2 White
- did -a $dname 2 Blue
- did -a $dname 2 Green
- did -a $dname 2 Red
- did -a $dname 2 Brown
- did -a $dname 2 Purple
- did -a $dname 2 Orange
- did -a $dname 2 Yellow
- did -a $dname 2 Light Green
- did -a $dname 2 Cyan
- did -a $dname 2 Light Cyan
- did -a $dname 2 Royal Blue
- did -a $dname 2 Pink
- did -a $dname 2 Gray
- did -a $dname 2 Light Gray
- did -a $dname 3 Black
- did -a $dname 3 White
- did -a $dname 3 Blue
- did -a $dname 3 Green
- did -a $dname 3 Red
- did -a $dname 3 Brown
- did -a $dname 3 Purple
- did -a $dname 3 Orange
- did -a $dname 3 Yellow
- did -a $dname 3 Light Green
- did -a $dname 3 Cyan
- did -a $dname 3 Light Cyan
- did -a $dname 3 Royal Blue
- did -a $dname 3 Pink
- did -a $dname 3 Gray
- did -a $dname 3 Light Gray
- did -c $dname 2 $iif($readini(" $+ $scriptdir\IRCWeather.ini $+ ",Settings,PrimaryColor),$calc($readini(" $+ $scriptdir\IRCWeather.ini $+ ",Settings,PrimaryColor) + 1),4)
- did -c $dname 3 $iif($readini(" $+ $scriptdir\IRCWeather.ini $+ ",Settings,SecondaryColor),$calc($readini(" $+ $scriptdir\IRCWeather.ini $+ ",Settings,SecondaryColor) + 1),10)
- set %cnt 1
- while ($readini(" $+ $scriptdir\IRCWeather.ini $+ ",Channels,Channel $+ %cnt)) {
- did -a $dname 1 $readini(" $+ $scriptdir\IRCWeather.ini $+ ",Channels,Channel $+ %cnt)
- inc %cnt
- }
- did -a $dname 203 $iif($readini(" $+ $scriptdir\IRCWeather.ini $+ ",Settings,Format),$readini(" $+ $scriptdir\IRCWeather.ini $+ ",Settings,Format),See Help for codes to use for custom displays)
- did -a $dname 209 $iif($readini(" $+ $scriptdir\IRCWeather.ini $+ ",Settings,Format.forecast),$readini(" $+ $scriptdir\IRCWeather.ini $+ ",Settings,Format.forecast),See Help for codes to use for custom displays)
- unset %cnt
- }
- on *:dialog:WSetup:sclick:*:{
- if ($did == 100 && $did($dname,1).text) {
- unset %checkchan
- set %cnt 1
- while (%cnt <= $did($dname,1).lines) {
- if ($did($dname,1).text == $did($dname,1,%cnt)) { set %checkchan 1 }
- inc %cnt
- }
- if (%checkchan != 1) { did -a $dname 1 $did($dname,1).text }
- did -d WSetup 1 0
- }
- if ($did == 101 && $did($dname,1).sel) {
- did -d $dname 1 $did($dname,1).sel
- }
- if ($did == 20) {
- writeini " $+ $scriptdir\IRCWeather.ini $+ " Settings PrimaryColor $iif($calc($did($dname,2).sel - 1) > 9,$calc($did($dname,2).sel - 1),0 $+ $calc($did($dname,2).sel - 1))
- writeini " $+ $scriptdir\IRCWeather.ini $+ " Settings SecondaryColor $iif($calc($did($dname,3).sel - 1) > 9,$calc($did($dname,3).sel - 1),0 $+ $calc($did($dname,3).sel - 1))
- writeini " $+ $scriptdir\IRCWeather.ini $+ " Settings AllChans $iif($did($dname,102).state == 1,1,0)
- writeini " $+ $scriptdir\IRCWeather.ini $+ " Settings AllowQuery $iif($did($dname,300).state == 1,1,0)
- writeini " $+ $scriptdir\IRCWeather.ini $+ " Settings AutoUpdate $iif($did($dname,301).state == 1,1,0)
- if ($did($dname,200).state == 1) { writeini " $+ $scriptdir\IRCWeather.ini $+ " Settings FormatNum 1 | writeini " $+ $scriptdir\IRCWeather.ini $+ " Settings Format Location: #location, Updated: #time, Temp: #temp, Wind Chill: #wc, Dew Point: #dp, Humidity: #hum, Pressure: #pressure, Conditions: #cond, Wind: #wind, Visibility: #vis }
- elseif ($did($dname,201).state == 1) { writeini " $+ $scriptdir\IRCWeather.ini $+ " Settings FormatNum 2 | writeini " $+ $scriptdir\IRCWeather.ini $+ " Settings Format Location: #location § Updated: #time § Temp: #temp § Wind Chill: #wc § Dew Point: #dp § Humidity: #hum § Pressure: #pressure § Conditions: #cond § Wind: #wind § Visibility: #vis }
- elseif ($did($dname,202).state == 1) { writeini " $+ $scriptdir\IRCWeather.ini $+ " Settings FormatNum 3 | $iif($did($dname,203).text,writeini " $+ $scriptdir\IRCWeather.ini $+ " Settings Format $replace($replace($replace($replace($did($dname,203).text,,$chr(32) $ $+ + $ $+ chr(3) $ $+ + $+ $chr(32)),,$chr(32) $ $+ + $ $+ chr(15) $ $+ + $chr(32)),,$chr(32) $ $+ + $ $+ chr(2) $ $+ + $chr(32)),,$chr(32) $ $+ + $ $+ chr(31) $ $+ + $chr(32)),remini " $+ $scriptdir\IRCWeather.ini $+ " Settings Format) }
- if ($did($dname,206).state == 1) { writeini " $+ $scriptdir\IRCWeather.ini $+ " Settings FormatNum.forecast 1 | writeini " $+ $scriptdir\IRCWeather.ini $+ " Settings Format.forecast Forecast for: #location, Updated: #time - #day1: #temp1 and #cond1, #day2: #temp2 and #cond2, #day3: #temp3 and #cond3, #day4: #temp4 and #cond4, #day5: #temp5 and #cond5 }
- elseif ($did($dname,207).state == 1) { writeini " $+ $scriptdir\IRCWeather.ini $+ " Settings FormatNum.forecast 2 | writeini " $+ $scriptdir\IRCWeather.ini $+ " Settings Format.forecast Forecast for: #location § Updated: #time § #day1: #temp1 and #cond1 § #day2: #temp2 and #cond2 § #day3: #temp3 and #cond3 § #day4: #temp4 and #cond4 § #day5: #temp5 and #cond5 }
- elseif ($did($dname,208).state == 1) { writeini " $+ $scriptdir\IRCWeather.ini $+ " Settings FormatNum.forecast 3 | $iif($did($dname,209).text,writeini " $+ $scriptdir\IRCWeather.ini $+ " Settings Format.forecast $replace($replace($replace($replace($did($dname,209).text,,$chr(32) $ $+ + $ $+ chr(3) $ $+ + $+ $chr(32)),,$chr(32) $ $+ + $ $+ chr(15) $ $+ + $chr(32)),,$chr(32) $ $+ + $ $+ chr(2) $ $+ + $chr(32)),,$chr(32) $ $+ + $ $+ chr(31) $ $+ + $chr(32)),remini " $+ $scriptdir\IRCWeather.ini $+ " Settings Format.forecast) }
- if ($did($dname,204).state == 1) { writeini " $+ $scriptdir\IRCWeather.ini $+ " Settings DefaultType si }
- else { writeini " $+ $scriptdir\IRCWeather.ini $+ " Settings DefaultType us }
- set %cnt 1
- remini " $+ $scriptdir\IRCWeather.ini $+ " Channels
- while (%cnt <= $did($dname,1).lines) {
- writeini " $+ $scriptdir\IRCWeather.ini $+ " Channels Channel $+ %cnt $did($dname,1,%cnt)
- inc %cnt
- }
- unset %cnt
- dialog -c WSetup
- }
- }
- alias openmysock {
- set %zipcode $1-
- if ($sock(mysock)) { sockclose mysock }
- sockopen mysock classic.wunderground.com 80
- }
- alias historysock {
- if ($sock(historysock)) { sockclose historysock }
- sockopen historysock classic.wunderground.com 80
- }
- on *:sockopen:mysock: {
- sockwrite -n $sockname get /cgi-bin/findweather/getForecast?query= $+ %zipcode HTTP/1.0
- sockwrite -n $sockname User-Agent: Mozilla/4.0 (compatible; MSIE 4.01; Windows NT)
- sockwrite -n $sockname Host: classic.wunderground.com
- sockwrite -n $sockname Accept-Language: en-us
- ;sockwrite -n $sockname Accept-Encoding: gzip, deflate
- sockwrite -n $sockname Accept: */*
- sockwrite -n $sockname
- }
- on *:sockopen:historysock: {
- sockwrite -n $sockname get /history/airport/ $+ %forecast.code $+ / $+ $date(yyyy/mm/dd) $+ /DailyHistory.html HTTP/1.0
- sockwrite -n $sockname User-Agent: Mozilla/4.0 (compatible; MSIE 4.01; Windows NT)
- sockwrite -n $sockname Host: classic.wunderground.com
- sockwrite -n $sockname Accept-Language: en-us
- ;sockwrite -n $sockname Accept-Encoding: gzip, deflate
- sockwrite -n $sockname Accept: */*
- sockwrite -n $sockname
- }
- on *:sockread:mysock: {
- if ($sockerr) {
- echo -a Error.
- halt
- }
- else {
- var %temptext
- sockread %temptext
- if (*pwsunit="metric"* iswm %temptext) { set %forcast.cf c }
- if (*<td class="taC" >* iswm %temptext) {
- inc %taC
- if (%taC isnum 6-10) {
- sockread %temptext
- set %forecast.day $+ $calc(%taC - 5) $+ .cond $remove(%temptext,$chr(9))
- }
- }
- if (*<tr class="wHover noBorder"> iswm %temptext) { set %tac 5 }
- if (*<td class="taC" style="width: 20%;">* iswm %temptext) {
- set %forecast.day $+ %daynum $remove($htmlfree(%temptext),$chr(9))
- inc %daynum
- }
- if (*<span style="color: #900;">* iswm %temptext && *C</span> !iswm %temptext) {
- set %forecast.day $+ %daynum2 $+ .temp $gettok($gettok(%temptext,1,38),2,62)
- inc %daynum2
- }
- if (*<span class="b green">* iswm %temptext) {
- set %forecast.day $+ $calc(%taC - 5) $+ .cond %forecast.day [ $+ [ $calc(%taC - 5) ] $+ [ .cond ] ] ( $+ $gettok($gettok(%temptext,2,62),1,60) $+ )
- }
- if (*pwsvariable="tempf"* iswm %temptext && %forecast.temp == N/A) {
- set %forecast.temp $gettok(%temptext,-2,34)
- }
- if (*Windchill:</td> iswm %temptext) {
- sockread %temptext
- sockread %temptext
- set %forecast.wc $gettok($gettok(%temptext,3,62),1,60)
- if (%forecast.cf == c) { set %forecast.wc $calc(%forecast.wc * 9/5 + 32) }
- }
- if (*<td class="full b">*pwsvariable="dewptf"* iswm %temptext) {
- set %forecast.dp $iif($gettok(%temptext,-2,34) isnum,$v1,N/A)
- }
- if (*<td class="full b">*pwsvariable="humidity"* iswm %temptext) {
- set %forecast.humidity $remove($htmlfree(%temptext),$chr(9))
- }
- if (*pwsvariable="baromin"* iswm %temptext && %forecast.psi == N/A) {
- if ($gettok(%temptext,-2,34) isnum && $gettok(%temptext,-2,34) != -9999.00) { set %forecast.psi $v1 in. }
- sockread %temptext
- sockread %temptext
- sockread %temptext
- sockread %temptext
- sockread %temptext
- set %forecast.psi %forecast.psi $remove($htmlfree(%temptext),$chr(9))
- }
- if (*</span> miles</span> iswm %temptext && %forecast.vis == N/A) {
- set %forecast.vis $gettok($gettok(%temptext,3,62),1,60)
- }
- if (*out of 16* iswm %temptext) {
- set %forecast.uv $remove($htmlfree(%temptext),$chr(9))
- }
- if (*Wind:</td> iswm %temptext) {
- set -u5 %forecast.wind.chk On
- }
- if (*</span> mph</span> iswm %temptext && %forecast.wind.chk == On) {
- unset %forecast.wind.chk
- if (*Calm iswm %temptext || $gettok($gettok(%temptext,3,62),1,60) == 0) { set %forecast.wind Calm | goto Records }
- set %forecast.wind $gettok($gettok(%temptext,3,62),1,60) $+ mph
- }
- if (*<span class="nb"> from the </span> iswm %temptext) {
- sockread %temptext
- sockread %temptext
- var %direction = $remove(%temptext,$chr(9))
- if (%direction != Variable && %direction != $null) { var %direction = from the %direction }
- if (%forecast.wind != Calm) { set %forecast.wind %forecast.wind %direction }
- }
- :Records
- if (*<td>Normal * iswm %temptext) {
- sockread %temptext
- sockread %temptext
- set %forecast.avgmax $gettok($gettok(%temptext,3,62),1,60)
- sockread %temptext
- sockread %temptext
- sockread %temptext
- sockread %temptext
- sockread %temptext
- set %forecast.avgmin $gettok($gettok(%temptext,3,62),1,60)
- }
- if (*<td>Record * iswm %temptext) {
- sockread %temptext
- sockread %temptext
- set %forecast.recmax $gettok($gettok(%temptext,3,62),1,60)
- sockread %temptext
- sockread %temptext
- sockread %temptext
- set %forecast.recmaxyear $gettok($htmlfree(%temptext,1,41),1,32)
- sockread %temptext
- sockread %temptext
- set %forecast.recmin $gettok($gettok(%temptext,3,62),1,60)
- sockread %temptext
- sockread %temptext
- sockread %temptext
- set %forecast.recminyear $gettok($htmlfree(%temptext,1,41),1,32)
- }
- if (*<div class="bm10">Updated:* iswm %temptext) {
- set %forecast.time $remove($htmlfree(%temptext),Updated: $+ $chr(32),$chr(9))
- }
- if (*<h1>*</h1> iswm %temptext && *there has been an error* !iswm %temptext) {
- set %forecast.location $remove($htmlfree(%temptext),$chr(9))
- }
- if (*<div class="b" style="font-size:* iswm %temptext) {
- set %forecast.cond $remove($htmlfree(%temptext),$chr(9))
- }
- }
- if (*Click on a column heading to sort this information.* iswm %temptext) {
- set %forecast.location Search Results::
- }
- if (*hidden value* iswm %temptext) {
- set %forecast.code $gettok($gettok(%temptext,3,61),1,32)
- historysock
- }
- if (*<span class="b">Active Advisory:</span>* iswm %temptext) {
- sockread %temptext
- set %forecast.adv $remove($htmlfree(%temptext),$chr(9))
- if ($left(%forecast.adv,1) == $chr(32)) { set %forecast.adv $right(%forecast.adv,-1) }
- }
- if (</BODY> iswm %temptext) {
- if (*Email* iswm %forecast.cond) { set %forecast.cond N/A }
- set %PrimaryC $readini(" $+ $scriptdir\IRCWeather.ini $+ ",Settings,PrimaryColor)
- set %SecondaryC $readini(" $+ $scriptdir\IRCWeather.ini $+ ",Settings,SecondaryColor)
- if (%forecast.type == si) {
- if (%forecast.temp != N/A) { set %forecast.temp $round($calc((%forecast.temp - 32) / 1.8),0) }
- if (%forecast.wc != N/A) { set %forecast.wc $round($calc((%forecast.wc - 32) / 1.8),0) }
- if (%forecast.dp != N/A) { set %forecast.dp $round($calc((%forecast.dp - 32) / 1.8),0) }
- if (%forecast.psi != N/A) { set %forecast.psi $round($calc($gettok(%forecast.psi,1,32) * 33.8653),0) hPA $gettok(%forecast.psi,3-,32) }
- if (%forecast.wind != N/A) { set %forecast.wind $round($calc($gettok(%forecast.wind,1,109) * 1.61),1) $+ km/h $gettok(%forecast.wind,2-,32) }
- if (%forecast.vis != N/A) { set %forecast.vis $round($calc(%forecast.vis * 1.61),1) }
- set %weatherinfo $replace($replace($replace($replace($replace($replace($replace($replace($replace($replace($readini(" $+ $scriptdir\IRCWeather.ini $+ ",Settings,Format),#location, $+ %SecondaryC $+ %forecast.location $+ $+ %PrimaryC),#time, $+ %SecondaryC $+ %forecast.time $+ $+ %PrimaryC),#temp, $+ %SecondaryC $+ %forecast.temp $+ °C $+ $+ %PrimaryC),#wc, $+ %SecondaryC $+ %forecast.wc $+ °C $+ $+ %PrimaryC),#dp, $+ %SecondaryC $+ %forecast.dp $+ °C $+ $+ %PrimaryC),#hum, $+ %SecondaryC $+ %forecast.humidity $+ $+ %PrimaryC),#pressure, $+ %SecondaryC $+ %forecast.psi $+ $+ %PrimaryC),#cond, $+ %SecondaryC $+ %forecast.cond $+ $+ %PrimaryC),#wind, $+ %SecondaryC $+ %forecast.wind $+ $+ %PrimaryC),#vis, $+ %SecondaryC $+ %forecast.vis kilometers)
- }
- else set %weatherinfo $replace($replace($replace($replace($replace($replace($replace($replace($replace($replace($readini(" $+ $scriptdir\IRCWeather.ini $+ ",Settings,Format),#location, $+ %SecondaryC $+ %forecast.location $+ $+ %PrimaryC),#time, $+ %SecondaryC $+ %forecast.time $+ $+ %PrimaryC),#temp, $+ %SecondaryC $+ %forecast.temp $+ °F $+ $+ %PrimaryC),#wc, $+ %SecondaryC $+ %forecast.wc $+ °F $+ $+ %PrimaryC),#dp, $+ %SecondaryC $+ %forecast.dp $+ °F $+ $+ %PrimaryC),#hum, $+ %SecondaryC $+ %forecast.humidity $+ $+ %PrimaryC),#pressure, $+ %SecondaryC $+ %forecast.psi $+ $+ %PrimaryC),#cond, $+ %SecondaryC $+ %forecast.cond $+ $+ %PrimaryC),#wind, $+ %SecondaryC $+ %forecast.wind $+ $+ %PrimaryC),#vis, $+ %SecondaryC $+ %forecast.vis miles)
- if (%weather.ctcp == $null && %weather.forecast == $null) {
- if (%forecast.location == N/A || Search Results: isin %forecast.location) { msg %weather.chan $+ %PrimaryC $+ Invalid location. Please try another location. | resetdata | halt }
- var %line.cnt 1
- ; original token is 69
- while (%line.cnt <= $gettok(%weatherinfo,0,167)) {
- msg %weather.chan $+ %PrimaryC $+ $gettok(%weatherinfo,%line.cnt,167)
- inc %line.cnt
- }
- if (%forecast.adv) {
- msg %weather.chan $+ %PrimaryC $+ Active $iif($chr(44) isin %forecast.adv,Advisories:,Advisory:) $+ %SecondaryC $+ %forecast.adv
- }
- if (!%Weather.Registered) { .notice %weather.nick $+ %PrimaryC $+ Use $+ %SecondaryC $+ !weather help $+ %PrimaryC for commands. }
- resetdata
- }
- elseif (%weather.forecast != $null) {
- if (%forecast.location == N/A || Search Results: isin %forecast.location) { msg %weather.chan $+ %PrimaryC $+ Invalid location. Please try another location. | resetdata | halt }
- if (%forecast.type == si) {
- if (%forecast.day1.temp != N/A) { set %forecast.day1.temp $round($calc((%forecast.day1.temp - 32) / 1.8),0) }
- if (%forecast.day2.temp != N/A) { set %forecast.day2.temp $round($calc((%forecast.day2.temp - 32) / 1.8),0) }
- if (%forecast.day3.temp != N/A) { set %forecast.day3.temp $round($calc((%forecast.day3.temp - 32) / 1.8),0) }
- if (%forecast.day4.temp != N/A) { set %forecast.day4.temp $round($calc((%forecast.day4.temp - 32) / 1.8),0) }
- if (%forecast.day5.temp != N/A) { set %forecast.day5.temp $round($calc((%forecast.day5.temp - 32) / 1.8),0) }
- set %forecastinfo $replace($readini(" $+ $scriptdir\IRCWeather.ini $+ ",Settings,Format.forecast),#location, $+ %SecondaryC $+ %forecast.location $+ $+ %PrimaryC,#time, $+ %SecondaryC $+ %forecast.time $+ $+ %PrimaryC,#day1,%forecast.day1 $+ $+ %PrimaryC,#temp1, $+ %SecondaryC $+ %forecast.day1.temp $+ °C $+ $+ %PrimaryC,#cond1, $+ %SecondaryC $+ %forecast.day1.cond $+ $+ %PrimaryC,#day2,%forecast.day2 $+ $+ %PrimaryC,#temp2, $+ %SecondaryC $+ %forecast.day2.temp $+ °C $+ $+ %PrimaryC,#cond2, $+ %SecondaryC $+ %forecast.day2.cond $+ $+ %PrimaryC,#day3,%forecast.day3 $+ $+ %PrimaryC,#temp3, $+ %SecondaryC $+ %forecast.day3.temp $+ °C $+ $+ %PrimaryC,#cond3, $+ %SecondaryC $+ %forecast.day3.cond $+ $+ %PrimaryC)
- set %forecastinfo $replace(%forecastinfo,#day4,%forecast.day4 $+ $+ %PrimaryC,#temp4, $+ %SecondaryC $+ %forecast.day4.temp $+ °C $+ $+ %PrimaryC,#cond4, $+ %SecondaryC $+ %forecast.day4.cond $+ $+ %PrimaryC,#day5,%forecast.day5 $+ $+ %PrimaryC,#temp5, $+ %SecondaryC $+ %forecast.day5.temp $+ °C $+ $+ %PrimaryC,#cond5, $+ %SecondaryC $+ %forecast.day5.cond $+ $+ %PrimaryC)
- if (%forecast.day2 == N/A) { set %forecastinfo $deltok(%forecastinfo,-4-,44) }
- elseif (%forecast.day3 == N/A) { set %forecastinfo $deltok(%forecastinfo,-3-,44) }
- elseif (%forecast.day4 == N/A) { set %forecastinfo $deltok(%forecastinfo,-2-,44) }
- elseif (%forecast.day5 == N/A) { set %forecastinfo $deltok(%forecastinfo,-1-,44) }
- }
- else {
- set %forecastinfo $replace($readini(" $+ $scriptdir\IRCWeather.ini $+ ",Settings,Format.forecast),#location, $+ %SecondaryC $+ %forecast.location $+ $+ %PrimaryC,#time, $+ %SecondaryC $+ %forecast.time $+ $+ %PrimaryC,#day1,%forecast.day1 $+ $+ %PrimaryC,#temp1, $+ %SecondaryC $+ %forecast.day1.temp $+ °F $+ $+ %PrimaryC,#cond1, $+ %SecondaryC $+ %forecast.day1.cond $+ $+ %PrimaryC,#day2,%forecast.day2 $+ $+ %PrimaryC,#temp2, $+ %SecondaryC $+ %forecast.day2.temp $+ °F $+ $+ %PrimaryC,#cond2, $+ %SecondaryC $+ %forecast.day2.cond $+ $+ %PrimaryC,#day3,%forecast.day3 $+ $+ %PrimaryC,#temp3, $+ %SecondaryC $+ %forecast.day3.temp $+ °F $+ $+ %PrimaryC,#cond3, $+ %SecondaryC $+ %forecast.day3.cond $+ $+ %PrimaryC)
- set %forecastinfo $replace(%forecastinfo,#day4,%forecast.day4 $+ $+ %PrimaryC,#temp4, $+ %SecondaryC $+ %forecast.day4.temp $+ °F $+ $+ %PrimaryC,#cond4, $+ %SecondaryC $+ %forecast.day4.cond $+ $+ %PrimaryC,#day5,%forecast.day5 $+ $+ %PrimaryC,#temp5, $+ %SecondaryC $+ %forecast.day5.temp $+ °F $+ $+ %PrimaryC,#cond5, $+ %SecondaryC $+ %forecast.day5.cond $+ $+ %PrimaryC)
- if (%forecast.day2 == N/A) { set %forecastinfo $deltok(%forecastinfo,-4-,44) }
- elseif (%forecast.day3 == N/A) { set %forecastinfo $deltok(%forecastinfo,-3-,44) }
- elseif (%forecast.day4 == N/A) { set %forecastinfo $deltok(%forecastinfo,-2-,44) }
- elseif (%forecast.day5 == N/A) { set %forecastinfo $deltok(%forecastinfo,-1-,44) }
- }
- var %line.cnt 1
- ; original token is 69
- while (%line.cnt <= $gettok(%forecastinfo,0,167)) {
- msg %weather.chan $+ %PrimaryC $+ $gettok(%forecastinfo,%line.cnt,167)
- inc %line.cnt
- }
- if (%forecast.adv) {
- msg %weather.chan $+ %PrimaryC $+ Active $iif($chr(44) isin %forecast.adv,Advisories:,Advisory:) $+ %SecondaryC $+ %forecast.adv
- }
- if (!%Weather.Registered) { .notice %weather.nick $+ %PrimaryC $+ Use $+ %SecondaryC $+ !weather help $+ %PrimaryC for commands. }
- resetdata
- }
- else {
- .timer 1 4 { sendctcp }
- }
- sockclose mysock
- unset %weather.ctcp
- unset %weather.forecast
- }
- }
- on *:sockread:historysock: {
- if ($sockerr) {
- echo -a Error.
- halt
- }
- else {
- var %temptext
- sockread %temptext2
- if (*<td class="indent"><span>Average Humidity</span></td> iswm %temptext2) {
- set %avghum.cnt 1
- }
- if (*<td>* iswm %temptext2 && %avghum.cnt == 1) {
- set %forecast.avghum $remove($htmlfree(%temptext2),$chr(9)) $+ %
- if (%forecast.avghum == /b%) { set %forecast.avghum N/A }
- unset %avghum.cnt
- }
- if (*<td class="indent"><span>Maximum Humidity</span></td> iswm %temptext2) {
- set %maxhum.cnt 1
- }
- if (*<td>* iswm %temptext2 && %maxhum.cnt == 1) {
- set %forecast.maxhum $remove($htmlfree(%temptext2),$chr(9)) $+ %
- if (%forecast.maxhum == /b%) { set %forecast.maxhum N/A }
- unset %maxhum.cnt
- }
- if (*<td class="indent"><span>Minimum Humidity</span></td> iswm %temptext2) {
- set %minhum.cnt 1
- }
- if (*<td>* iswm %temptext2 && %minhum.cnt == 1) {
- set %forecast.minhum $remove($htmlfree(%temptext2),$chr(9)) $+ %
- if (%forecast.minhum == /b%) { set %forecast.minhum N/A }
- unset %minhum.cnt
- }
- if (*</b> in</nobr> iswm %temptext2 && %precip.cnt == 3) {
- set %forecast.precip.rec $gettok($gettok(%temptext2,3,62),1,60)
- if (%forecast.precip.rec == $null) { set %forecast.precip.rec N/A }
- sockread %temptext2
- sockread %temptext2
- sockread %temptext2
- set %forecast.precip.rec.year $gettok($htmlfree(%temptext2,3,62),1,32)
- if (%forecast.precip.rec == N/A) { unset %forecast.precip.rec.year }
- unset %precip.cnt
- }
- if (*</b> in</nobr> iswm %temptext2 && %precip.cnt == 2) {
- set %forecast.precip.avg $gettok($gettok(%temptext2,3,62),1,60)
- if (%forecast.precip.avg == $null) { set %forecast.precip.avg N/A }
- inc %precip.cnt
- }
- if (*</b> in</nobr> iswm %temptext2 && %precip.cnt == 1) {
- set %forecast.precip.cur $gettok($gettok(%temptext2,3,62),1,60)
- inc %precip.cnt
- }
- if (*<td class="indent"><span>Precipitation</span></td> iswm %temptext2) {
- sockread %temptext2
- sockread %temptext2
- set %forecast.precip.cur $gettok($gettok(%temptext2,3,62),1,60)
- if (%forecast.precip.cur == $null) {
- set %forecast.precip.cur N/A
- sockread %temptext2
- sockread %temptext2
- sockread %temptext2
- }
- else {
- sockread %temptext2
- sockread %temptext2
- sockread %temptext2
- sockread %temptext2
- sockread %temptext2
- }
- set %forecast.precip.avg $gettok($gettok(%temptext2,3,62),1,60)
- if (%forecast.precip.avg == $null) {
- set %forecast.precip.avg N/A
- sockread %temptext2
- sockread %temptext2
- sockread %temptext2
- }
- else {
- sockread %temptext2
- sockread %temptext2
- sockread %temptext2
- sockread %temptext2
- sockread %temptext2
- }
- if (- !isin %temptext2 && %temptext2 != $null) {
- set %forecast.precip.rec $gettok($gettok(%temptext2,3,62),1,60)
- sockread %temptext2
- sockread %temptext2
- sockread %temptext2
- set %forecast.precip.rec.year $gettok($htmlfree(%temptext2,3,62),1,32)
- }
- }
- if (*<td class="indent"><span>Month to date precipitation</span></td> iswm %temptext2) {
- sockread %temptext2
- set %forecast.precip.cur.mtd $gettok($gettok(%temptext2,2,62),1,60)
- if (%forecast.precip.cur.mtd == /td) { set %forecast.precip.cur.mtd N/A }
- sockread %temptext2
- set %forecast.precip.avg.mtd $gettok($gettok(%temptext2,2,62),1,60)
- if (%forecast.precip.avg.mtd == /td) { set %forecast.precip.avg.mtd N/A }
- }
- if (*<td class="indent"><span>Year to date precipitation</span></td> iswm %temptext2) {
- sockread %temptext2
- set %forecast.precip.cur.ytd $gettok($gettok(%temptext2,2,62),1,60)
- if (%forecast.precip.cur.ytd == /td) { set %forecast.precip.cur.ytd N/A }
- sockread %temptext2
- set %forecast.precip.avg.ytd $gettok($gettok(%temptext2,2,62),1,60)
- if (%forecast.precip.avg.ytd == /td) { set %forecast.precip.avg.ytd N/A }
- }
- if (*<td class="indent"><span>Snow</span></td> iswm %temptext2) {
- sockread %temptext2
- sockread %temptext2
- set %forecast.snow.cur $gettok($gettok(%temptext2,3,62),1,60)
- if (%forecast.snow.cur == $null) {
- set %forecast.snow.cur N/A
- sockread %temptext2
- sockread %temptext2
- sockread %temptext2
- }
- else {
- sockread %temptext2
- sockread %temptext2
- sockread %temptext2
- sockread %temptext2
- sockread %temptext2
- }
- set %forecast.snow.avg $gettok($gettok(%temptext2,3,62),1,60)
- if (%forecast.snow.avg == $null) {
- set %forecast.snow.avg N/A
- sockread %temptext2
- sockread %temptext2
- sockread %temptext2
- }
- else {
- sockread %temptext2
- sockread %temptext2
- sockread %temptext2
- sockread %temptext2
- sockread %temptext2
- }
- if (- !isin %temptext2 && %temptext2 != $null) {
- set %forecast.snow.rec $gettok($gettok(%temptext2,3,62),1,60)
- sockread %temptext2
- sockread %temptext2
- sockread %temptext2
- set %forecast.snow.rec.year $gettok($htmlfree(%temptext2,3,62),1,32)
- }
- else { set %forecast.snow.rec N/A | set %forecast.snow.rec.year () }
- }
- if (*<td class="indent"><span>Month to date snowfall</span></td> iswm %temptext2) {
- sockread %temptext2
- set %forecast.snow.cur.mtd $gettok($gettok(%temptext2,2,62),1,60)
- if (%forecast.snow.cur.mtd == /td) { set %forecast.snow.cur.mtd N/A }
- sockread %temptext2
- set %forecast.snow.avg.mtd $gettok($gettok(%temptext2,2,62),1,60)
- if (%forecast.snow.avg.mtd == /td) { set %forecast.snow.avg.mtd N/A }
- }
- if (*<td class="indent"><span>Since 1 July snowfall</span></td> iswm %temptext2) {
- sockread %temptext2
- set %forecast.snow.cur.ytd $gettok($gettok(%temptext2,2,62),1,60)
- if (%forecast.snow.cur.ytd == /td) { set %forecast.snow.cur.ytd N/A }
- sockread %temptext2
- set %forecast.snow.avg.ytd $gettok($gettok(%temptext2,2,62),1,60)
- if (%forecast.snow.avg.ytd == /td) { set %forecast.snow.avg.ytd N/A }
- }
- if (*<td class="indent"><span>Snow Depth</span></td> iswm %temptext2) {
- sockread %temptext2
- sockread %temptext2
- if (- !isin %temptext2) { set %forecast.snow.total $gettok($gettok(%temptext2,3,62),1,60) }
- }
- if (</BODY> iswm %temptext2) {
- sockclose historysock
- }
- }
- }
- on *:text:!weather *:#: {
- if ($readini(" $+ $scriptdir\IRCWeather.ini $+ ",Settings,AllChans) == 1) {
- goto display
- }
- set %cnt 1
- while ($readini(" $+ $scriptdir\IRCWeather.ini $+ ",Channels,Channel $+ %cnt)) {
- if ($chan == $readini(" $+ $scriptdir\IRCWeather.ini $+ ",Channels,Channel $+ %cnt)) {
- goto display
- }
- inc %cnt
- }
- halt
- :display
- set %daynum 1
- set %daynum2 1
- set %daynum3 1
- if ($2 == help) { weatherhelp $nick | halt }
- set %weather.chan $chan
- set %weather.nick $nick
- if ($hget(WeatherRegistrations,$network $+ . $+ $nick)) {
- set %Weather.Registered 1
- set %Registration.Info $hget(WeatherRegistrations,$network $+ . $+ $nick)
- }
- if ($2 == -si) {
- set %forecast.type si
- var %weather.loc = $3-
- if ($hget(WeatherRegistrations,$network $+ . $+ $3) && !$4) {
- var %weather.loc = $gettok($hget(WeatherRegistrations,$network $+ . $+ $3),2-,32)
- set %weather.nick $3
- }
- }
- elseif ($2 == -us) {
- set %forecast.type us
- var %weather.loc = $3-
- if ($hget(WeatherRegistrations,$network $+ . $+ $3) && !$4) {
- var %weather.loc = $gettok($hget(WeatherRegistrations,$network $+ . $+ $3),2-,32)
- set %weather.nick $3
- }
- }
- elseif ($2 == -r) {
- if (!$4) { WeatherRegisterHelp | return }
- WeatherRegister $3-
- }
- else {
- set %forecast.type $iif($gettok(%Registration.Info,1,32),$v1,$readini(" $+ $scriptdir\IRCWeather.ini $+ ",Settings,DefaultType))
- var %weather.loc = $2-
- if ($hget(WeatherRegistrations,$network $+ . $+ $2) && !$3) {
- var %weather.loc = $gettok($hget(WeatherRegistrations,$network $+ . $+ $2),2-,32)
- set %weather.nick $2
- }
- }
- if (($2 == -si || $2 == -us) && !$3) { return }
- if ($2 != -r) { openmysock $replace(%weather.loc,$chr(32),$chr(37) $+ 20) }
- unset %cnt
- }
- on *:text:!weather *:?: {
- if ($readini(" $+ $scriptdir\IRCWeather.ini $+ ",Settings,AllowQuery) == 1) {
- set %daynum 1
- set %daynum2 1
- set %daynum3 1
- if ($2 == help) { weatherhelp $nick | halt }
- set %weather.chan $nick
- set %weather.nick $nick
- if ($hget(WeatherRegistrations,$network $+ . $+ $nick)) {
- set %Weather.Registered 1
- set %Registration.Info $hget(WeatherRegistrations,$network $+ . $+ $nick)
- }
- if ($2 == -si) {
- set %forecast.type si
- var %weather.loc = $3-
- if ($hget(WeatherRegistrations,$network $+ . $+ $3) && !$4) {
- var %weather.loc = $gettok($hget(WeatherRegistrations,$network $+ . $+ $3),2-,32)
- set %weather.nick $3
- }
- }
- elseif ($2 == -us) {
- set %forecast.type us
- var %weather.loc = $3-
- if ($hget(WeatherRegistrations,$network $+ . $+ $3) && !$4) {
- var %weather.loc = $gettok($hget(WeatherRegistrations,$network $+ . $+ $3),2-,32)
- set %weather.nick $3
- }
- }
- elseif ($2 == -r) {
- if (!$4) { WeatherRegisterHelp | return }
- WeatherRegister $3-
- }
- else {
- set %forecast.type $iif($gettok(%Registration.Info,1,32),$v1,$readini(" $+ $scriptdir\IRCWeather.ini $+ ",Settings,DefaultType))
- var %weather.loc = $2-
- if ($hget(WeatherRegistrations,$network $+ . $+ $2) && !$3) {
- var %weather.loc = $gettok($hget(WeatherRegistrations,$network $+ . $+ $2),2-,32)
- set %weather.nick $2
- }
- }
- if (($2 == -si || $2 == -us) && !$3) { return }
- if ($2 != -r) { openmysock $replace(%weather.loc,$chr(32),$chr(37) $+ 20) }
- }
- }
- on *:text:!forecast *:#: {
- if ($readini(" $+ $scriptdir\IRCWeather.ini $+ ",Settings,AllChans) == 1) {
- goto display
- }
- set %cnt 1
- while ($readini(" $+ $scriptdir\IRCWeather.ini $+ ",Channels,Channel $+ %cnt)) {
- if ($chan == $readini(" $+ $scriptdir\IRCWeather.ini $+ ",Channels,Channel $+ %cnt)) {
- goto display
- }
- inc %cnt
- }
- halt
- :display
- set %daynum 1
- set %daynum2 1
- set %daynum3 1
- set %weather.chan $chan
- set %weather.nick $nick
- set %weather.forecast 1
- if ($hget(WeatherRegistrations,$network $+ . $+ $nick)) {
- set %Weather.Registered 1
- set %Registration.Info $hget(WeatherRegistrations,$network $+ . $+ $nick)
- }
- if ($2 == -si) {
- set %forecast.type si
- var %weather.loc = $3-
- if ($hget(WeatherRegistrations,$network $+ . $+ $3) && !$4) {
- var %weather.loc = $gettok($hget(WeatherRegistrations,$network $+ . $+ $3),2-,32)
- set %weather.nick $3
- }
- }
- elseif ($2 == -us) {
- set %forecast.type us
- var %weather.loc = $3-
- if ($hget(WeatherRegistrations,$network $+ . $+ $3) && !$4) {
- var %weather.loc = $gettok($hget(WeatherRegistrations,$network $+ . $+ $3),2-,32)
- set %weather.nick $3
- }
- }
- else {
- set %forecast.type $iif($gettok(%Registration.Info,1,32),$v1,$readini(" $+ $scriptdir\IRCWeather.ini $+ ",Settings,DefaultType))
- var %weather.loc = $2-
- if ($hget(WeatherRegistrations,$network $+ . $+ $2) && !$3) {
- var %weather.loc = $gettok($hget(WeatherRegistrations,$network $+ . $+ $2),2-,32)
- set %weather.nick $2
- }
- }
- if (($2 == -si || $2 == -us) && !$3) { return }
- if ($2 != -r) { openmysock $replace(%weather.loc,$chr(32),$chr(37) $+ 20) }
- unset %cnt
- }
- on *:text:!forecast *:?: {
- if ($readini(" $+ $scriptdir\IRCWeather.ini $+ ",Settings,AllowQuery) == 1) {
- set %daynum 1
- set %daynum2 1
- set %daynum3 1
- set %weather.chan $nick
- set %weather.nick $nick
- set %weather.forecast 1
- if ($hget(WeatherRegistrations,$network $+ . $+ $nick)) {
- set %Weather.Registered 1
- set %Registration.Info $hget(WeatherRegistrations,$network $+ . $+ $nick)
- }
- if ($2 == -si) {
- set %forecast.type si
- var %weather.loc = $3-
- if ($hget(WeatherRegistrations,$network $+ . $+ $3) && !$4) {
- var %weather.loc = $gettok($hget(WeatherRegistrations,$network $+ . $+ $3),2-,32)
- set %weather.nick $3
- }
- }
- elseif ($2 == -us) {
- set %forecast.type us
- var %weather.loc = $3-
- if ($hget(WeatherRegistrations,$network $+ . $+ $3) && !$4) {
- var %weather.loc = $gettok($hget(WeatherRegistrations,$network $+ . $+ $3),2-,32)
- set %weather.nick $3
- }
- }
- else {
- set %forecast.type $iif($gettok(%Registration.Info,1,32),$v1,$readini(" $+ $scriptdir\IRCWeather.ini $+ ",Settings,DefaultType))
- var %weather.loc = $2-
- if ($hget(WeatherRegistrations,$network $+ . $+ $2) && !$3) {
- var %weather.loc = $gettok($hget(WeatherRegistrations,$network $+ . $+ $2),2-,32)
- set %weather.nick $2
- }
- }
- if (($2 == -si || $2 == -us) && !$3) { return }
- if ($2 != -r) { openmysock $replace(%weather.loc,$chr(32),$chr(37) $+ 20) }
- }
- }
- ctcp *:weather *:*: {
- haltdef
- set %daynum 1
- set %daynum2 1
- set %daynum3 1
- set %weather.ctcp 1
- set %weather.chan $nick
- set %forecast.type us
- if ($2- == $null) { .notice $nick Please enter a location for weather | halt }
- openmysock $2-
- }
- alias -l htmlfree {
- var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x, )
- return %x
- }
- alias weatherhelp {
- set %PrimaryC $readini(" $+ $scriptdir\IRCWeather.ini $+ ",Settings,PrimaryColor)
- set %SecondaryC $readini(" $+ $scriptdir\IRCWeather.ini $+ ",Settings,SecondaryColor)
- msg $1 $+ %PrimaryC $+ IRC Weather HELP:
- msg $1 $+ %PrimaryC $+ Use $+ %SecondaryC $+ -si/-us $+ %PrimaryC $+ switches to view weather in International (SI) format (Celsius, kilometers, etc) or US format (Fahrenheit, miles, etc) if the bot doesn't show what you want. Example: $+ %SecondaryC $+ !weather -si Paris, France
- msg $1 $+ %SecondaryC $+ !weather ****** $+ %PrimaryC $+ - Get weather information for the ZIPCODE *or* CITY, STATE *or* CITY, COUNTRY displayed in the channel
- .timer 1 1 msg $1 $+ %SecondaryC $+ /msg $me !weather ****** $+ %PrimaryC $+ - Get weather information for ZIPCODE *or* CITY, STATE *or* CITY, COUNTRY displayed in private message
- .timer 1 1 msg $1 $+ %SecondaryC $+ !forecast ****** $+ %PrimaryC $+ and $+ %SecondaryC /msg $me !forecast ****** $+ %PrimaryC $+ - Same as above, but get the 5-day forecast instead
- .timer 1 2 msg $1 $+ %SecondaryC $+ !weather -r $+ %PrimaryC $+ - Get help on how to register your nick so that you don't have to enter a location and -si/-us every time.
- .timer 1 2 msg $1 $+ %PrimaryC $+ Get the GUI displayer for this script at http://www.KakkoiiTranslations.net/mircscripts/. Trust me, you at least want to try it once!
- }
- alias sendctcp {
- .ctcp %weather.chan WeatherData : %forecast.location ~ %forecast.time ~ %forecast.temp ~ %forecast.wc ~ %forecast.dp ~ %forecast.cond ~ %forecast.humidity ~ %forecast.psi ~ %forecast.wind ~ %forecast.vis miles ~ %forecast.uv ~ %forecast.day1 ~ %forecast.day2 ~ %forecast.day3 ~ %forecast.day4 ~ %forecast.day5 ~ %forecast.day1.temp ~ %forecast.day2.temp ~ %forecast.day3.temp ~ %forecast.day4.temp ~ %forecast.day5.temp ~ %forecast.day1.cond ~ %forecast.day2.cond ~ %forecast.day3.cond ~ %forecast.day4.cond ~ %forecast.day5.cond ~ %forecast.avgmax ~ %forecast.avgmin ~ %forecast.recmax ~ %forecast.recmaxyear ~ %forecast.recmin ~ %forecast.recminyear ~ %forecast.avghum ~ %forecast.maxhum ~ %forecast.minhum
- .ctcp %weather.chan WeatherHistory : %forecast.precip.cur ~ %forecast.precip.avg ~ %forecast.precip.rec ~ %forecast.precip.rec.year ~ %forecast.precip.cur.mtd ~ %forecast.precip.avg.mtd ~ %forecast.precip.cur.ytd ~ %forecast.precip.avg.ytd ~ %forecast.snow.cur ~ %forecast.snow.avg ~ %forecast.snow.rec ~ %forecast.snow.rec.year ~ %forecast.snow.cur.mtd ~ %forecast.snow.avg.mtd ~ %forecast.snow.cur.ytd ~ %forecast.snow.avg.ytd ~ %forecast.snow.total ~ %forecast.adv
- resetdata
- }
- alias resetdata {
- set %forecast.avghum N/A
- set %forecast.maxhum N/A
- set %forecast.minhum N/A
- set %forecast.precip.cur N/A
- set %forecast.precip.avg N/A
- set %forecast.precip.rec N/A
- set %forecast.precip.rec.year ()
- set %forecast.precip.cur.mtd N/A
- set %forecast.precip.avg.mtd N/A
- set %forecast.precip.cur.ytd N/A
- set %forecast.precip.avg.ytd N/A
- set %forecast.snow.cur N/A
- set %forecast.snow.avg N/A
- set %forecast.snow.rec N/A
- set %forecast.snow.rec.year ()
- set %forecast.snow.cur.mtd N/A
- set %forecast.snow.avg.mtd N/A
- set %forecast.snow.cur.ytd N/A
- set %forecast.snow.avg.ytd N/A
- set %forecast.snow.total N/A
- set %forecast.location N/A
- set %forecast.time N/A
- set %forecast.temp N/A
- set %forecast.wc N/A
- set %forecast.dp N/A
- set %forecast.avgmax N/A
- set %forecast.avgmin N/A
- set %forecast.recmax N/A
- set %forecast.recmaxyear ()
- set %forecast.recmin N/A
- set %forecast.recminyear ()
- set %forecast.cond N/A
- set %forecast.humidity N/A
- set %forecast.psi N/A
- set %forecast.wind N/A
- set %forecast.vis N/A
- set %forecast.uv N/A
- set %forecast.day1 N/A
- set %forecast.day2 N/A
- set %forecast.day3 N/A
- set %forecast.day4 N/A
- set %forecast.day5 N/A
- set %forecast.day1.temp N/A
- set %forecast.day2.temp N/A
- set %forecast.day3.temp N/A
- set %forecast.day4.temp N/A
- set %forecast.day5.temp N/A
- set %forecast.day1.cond N/A
- set %forecast.day2.cond N/A
- set %forecast.day3.cond N/A
- set %forecast.day4.cond N/A
- set %forecast.day5.cond N/A
- set %daynum 1
- set %daynum2 1
- set %daynum3 1
- unset %forecast.code
- unset %PrimaryC
- unset %SecondaryC
- unset %forecast.adv
- unset %Weather.Registered
- unset %Registration.Info
- set %taC 0
- }
- on *:text:!weather:#: {
- if ($readini(" $+ $scriptdir\IRCWeather.ini $+ ",Settings,AllChans) == 1) {
- goto display
- }
- set %cnt 1
- while ($readini(" $+ $scriptdir\IRCWeather.ini $+ ",Channels,Channel $+ %cnt)) {
- if ($chan == $readini(" $+ $scriptdir\IRCWeather.ini $+ ",Channels,Channel $+ %cnt)) {
- goto display
- }
- inc %cnt
- }
- halt
- :display
- set %weather.nick $nick
- set %PrimaryC $readini(" $+ $scriptdir\IRCWeather.ini $+ ",Settings,PrimaryColor)
- set %SecondaryC $readini(" $+ $scriptdir\IRCWeather.ini $+ ",Settings,SecondaryColor)
- if (!$hget(WeatherRegistrations,$network $+ . $+ $nick)) {
- .notice %weather.nick $+ %PrimaryC $+ Please enter a location for the weather.
- .notice %weather.nick $+ %PrimaryC $+ Use $+ %SecondaryC $+ !weather help $+ %PrimaryC for commands.
- }
- else {
- set %weather.chan $chan
- var %Registration.Info = $hget(WeatherRegistrations,$network $+ . $+ $nick)
- set %forecast.type $gettok(%Registration.Info,1,32)
- set %Weather.Registered 1
- openmysock $replace($gettok(%Registration.Info,2-,32),$chr(32),$chr(37) $+ 20)
- }
- unset %cnt
- }
- on *:text:!weather:?: {
- set %weather.nick $nick
- if ($readini(" $+ $scriptdir\IRCWeather.ini $+ ",Settings,AllowQuery) == 1) {
- set %PrimaryC $readini(" $+ $scriptdir\IRCWeather.ini $+ ",Settings,PrimaryColor)
- set %SecondaryC $readini(" $+ $scriptdir\IRCWeather.ini $+ ",Settings,SecondaryColor)
- if (!$hget(WeatherRegistrations,$network $+ . $+ $nick)) {
- .notice %weather.nick $+ %PrimaryC $+ Please enter a location for the weather.
- .notice %weather.nick $+ %PrimaryC $+ Use $+ %SecondaryC $+ !weather help $+ %PrimaryC for commands.
- }
- else {
- set %weather.chan $nick
- var %Registration.Info = $hget(WeatherRegistrations,$network $+ . $+ $nick)
- set %forecast.type $gettok(%Registration.Info,1,32)
- set %Weather.Registered 1
- openmysock $replace($gettok(%Registration.Info,2-,32),$chr(32),$chr(37) $+ 20)
- }
- }
- }
- on *:text:!forecast:#: {
- if ($readini(" $+ $scriptdir\IRCWeather.ini $+ ",Settings,AllChans) == 1) {
- goto display
- }
- set %cnt 1
- while ($readini(" $+ $scriptdir\IRCWeather.ini $+ ",Channels,Channel $+ %cnt)) {
- if ($chan == $readini(" $+ $scriptdir\IRCWeather.ini $+ ",Channels,Channel $+ %cnt)) {
- goto display
- }
- inc %cnt
- }
- halt
- :display
- set %weather.nick $nick
- set %PrimaryC $readini(" $+ $scriptdir\IRCWeather.ini $+ ",Settings,PrimaryColor)
- set %SecondaryC $readini(" $+ $scriptdir\IRCWeather.ini $+ ",Settings,SecondaryColor)
- if (!$hget(WeatherRegistrations,$network $+ . $+ $nick)) {
- .notice %weather.nick $+ %PrimaryC $+ Please enter a location for the forecast.
- .notice %weather.nick $+ %PrimaryC $+ Use $+ %SecondaryC $+ !weather help $+ %PrimaryC for commands.
- }
- else {
- set %weather.forecast 1
- set %weather.chan $chan
- var %Registration.Info = $hget(WeatherRegistrations,$network $+ . $+ $nick)
- set %forecast.type $gettok(%Registration.Info,1,32)
- set %Weather.Registered 1
- openmysock $replace($gettok(%Registration.Info,2-,32),$chr(32),$chr(37) $+ 20)
- }
- unset %cnt
- }
- on *:text:!forecast:?: {
- set %weather.nick $nick
- if ($readini(" $+ $scriptdir\IRCWeather.ini $+ ",Settings,AllowQuery) == 1) {
- set %PrimaryC $readini(" $+ $scriptdir\IRCWeather.ini $+ ",Settings,PrimaryColor)
- set %SecondaryC $readini(" $+ $scriptdir\IRCWeather.ini $+ ",Settings,SecondaryColor)
- if (!$hget(WeatherRegistrations,$network $+ . $+ $nick)) {
- .notice %weather.nick $+ %PrimaryC $+ Please enter a location for the forecast.
- .notice %weather.nick $+ %PrimaryC $+ Use $+ %SecondaryC $+ !weather help $+ %PrimaryC for commands.
- }
- else {
- set %weather.forecast 1
- set %weather.chan $nick
- var %Registration.Info = $hget(WeatherRegistrations,$network $+ . $+ $nick)
- set %forecast.type $gettok(%Registration.Info,1,32)
- set %Weather.Registered 1
- openmysock $replace($gettok(%Registration.Info,2-,32),$chr(32),$chr(37) $+ 20)
- }
- }
- }
- alias WeatherRegister {
- if (!$hget(WeatherRegistrations)) { WeatherRegistrationsHash }
- if ($1 != us && $1 != si) { WeatherRegisterHelp | return }
- hadd WeatherRegistrations $network $+ . $+ $nick $1 $2-
- hsave WeatherRegistrations WeatherRegistrations.hsh
- .notice $nick Your nick information has been registered.
- }
- alias WeatherRegisterHelp {
- .notice $nick IRCWeather Registration Help
- .notice $nick To register your nick and location, use the following format: 03!weather -r si/us location - Replace "location" with a valid location and replace si/us with your preference of either si (Celsius) or us (Fahrenheit). This will register the information for your CURRENT nickname only. Note that registrations are not protected and anyone can change them. If someone keeps changing yours, let the bot owner know.
- }
- alias WeatherRegistrationsHash {
- if (!$hget(WeatherRegistrations)) {
- hmake WeatherRegistrations 100
- if ($exists(WeatherRegistrations.hsh)) { hload WeatherRegistrations WeatherRegistrations.hsh }
- }
- }
- menu * {
- IRCWeather
- .Setup:/dialog -m WSetup WSetup
- .Check for Updates:IWUpdate
- .Download Server Version:.run http://www.kakkoiitranslations.net/mircscripts/IRCWeatherServer.rar
- .Help:.run " $+ $scriptdirWeather.CHM $+ "
- }
- ; ***************************** UPDATE SCRIPT ******************************
- alias IWUpdate {
- sockopen Update www.kakkoiitranslations.net 80
- }
- on *:sockopen:Update: {
- sockwrite -n $sockname GET /mircscripts/IRCWeather.html HTTP/1.0
- sockwrite -n $sockname User-Agent: Mozilla/4.0 (compatible; MSIE 4.01; Windows NT)
- sockwrite -n $sockname Host: www.kakkoiitranslations.net $+ $crlf $+ $crlf
- sockwrite -n $sockname Accept-Language: en-us
- sockwrite -n $sockname Accept-Encoding: gzip, deflate
- sockwrite -n $sockname Accept: */*
- }
- on *:sockread:Update: {
- if ($sockerr) {
- echo -a Error.
- halt
- }
- else {
- var %updatetext
- sockread %updatetext
- if (*size:24.0pt'>IRC Weather* iswm %updatetext) {
- if ($gettok($gettok(%updatetext,3,32),1,60) == 1.25) {
- echo -a 10IRCWeather: You have the current version.
- }
- else {
- echo -a 10IRCWeather: An update (v $+ $gettok($gettok(%updatetext,3,32),1,60) $+ ) is available at http://www.KakkoiiTranslations.net/mircscripts/
- }
- }
- if (</BODY> iswm %updatetext) {
- sockclose update
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment