Advertisement
Xzempt

Untitled

Apr 22nd, 2012
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 21.76 KB | None | 0 0
  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ;;;;;; weather underground for mIRC ;;;;;;;;;;;;;;;;
  3. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;by eqrunner ;;v4.0;;
  4.  
  5. /*
  6. -- COMMANDS --
  7. !w or !weather [zipcode|city,state|city,country|airport] = will return weather current conditions.
  8. !current [zipcode|city,state|city,country|airport] = will return current conditions.
  9. !forecast [zipcode|city,state|city,country|airport] = will give detailed 3 day forecast (for us)
  10. !forecast5 [zipcode|city,state|city,country|airport] = will send 5 day forecast to $nick that requested. (to prevent chan flooding)
  11. !alerts [zipcode|city,state|city,country|airport] = will tell you if there are any weather alerts in your area.
  12. !alertinfo [zipcode|city,state|city,country|airport] = will send $nick the detailed report of alerts in said area
  13. !time [zipcode|city,state|city,country|airport] = will return current time.
  14.  
  15. -- REGISTER --
  16. Register - Each user can assign a default location with themself. So in the future they can use just the command ( !weather, or !forecast, or !alerts, etc)
  17. ![w|forecast|forecast5|alerts|alertinfo|time|current] REGISTER [zipcode|city,state|city,country|airport] = will link user to said default location
  18. ![w|forecast|forecast5|alerts|alertinfo|time|current] REGISTER [zipcode|city,state|city,country|airport] = will CHANGE users default if they already have registured.
  19. ![w|forecast|forecast5|alerts|alertinfo|time|current] REMOVE = will remove the users default location
  20. User can use any of the !commands to registure. !weather register 90210, will work just as well as !time register 90210
  21.  
  22. -- HELP --
  23. ![w|forecast|forecast5|alerts|alertinfo|time|current] [?|help] = Will message user the list of above commands just as they are written.
  24.  
  25. -- Switch --
  26. ![w|forecast|forecast5|alerts|alertinfo|time|current] [ON|OFF} = Will turn the script ON or OFF. Currently only set for Ops only.
  27.  
  28.  
  29. -- NOTES- -
  30. Notes from wunderground:
  31. We don't support old style abbreviations like Conn. for Connecticut, use CT
  32. If you are searching for an international city, try the name of the country or province
  33. Don't use provinces for non-us cities (ie: Vancouver, BC)
  34. Zipcodes only work in Canada, UK and the US
  35. */
  36.  
  37.  
  38. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  39. on *:CONNECT: {
  40. if ($hget(wu_reg) == $null) { hmake wu_reg 100 }
  41. if ($isfile(wu_reg.dat)) { hload wu_reg wu_reg.dat }
  42. }
  43. ON *:DISCONNECT: {
  44. if ($hget(wu_reg)) { hsave -o wu_reg wu_reg.dat }
  45. }
  46.  
  47. on $*:INPUT:#: {
  48. if ($regex($1,/^[!](w |weather|forecast|forecast5|alert|alerts|alertinfo|alertsinfo|time|current)/Si)) wunderground $1-
  49. }
  50.  
  51. on $*:text:/^[!](w |weather|forecast|forecast5|alert|alerts|alertinfo|alertsinfo|time|current)/Si:#: {
  52. wunderground $1-
  53. }
  54.  
  55. alias wunderground {
  56. ;botabuse
  57. unset %wu_*
  58.  
  59. ;--- Preperation. Sets up all the variables needed for the script ---
  60. set %wu_command $1
  61. set %wu_2 $2
  62. set %wu_location $2-
  63. set %wu_3 $3
  64. set %wu_3_long $3-
  65. set %wu_nick $nick
  66. set %wu_network $network
  67. set %wu_chan $chan
  68. ;set %wu_onoff $+(%,wunderground_,%wu_chan)
  69.  
  70. ;--- Registration Check. Checks to see if the $nick already has a 'default' location on file ---
  71. if ($2 == $null) {
  72. if ($hget(wu_reg,%wu_nick) != $null) {
  73. set %wu_location $hget(wu_reg,%wu_nick)
  74. }
  75. if ($hget(wu_reg,%wu_nick) == $null) {
  76. .notice $nick Please specify a location $1 [zipcode|city,state|city,country|airport]
  77. wu_cleanup
  78. }
  79. }
  80. ;--- Modify Registration and Help and ON/OFF Switch ---
  81. if ($2 != $null) {
  82. if (%wu_2 == register) && (%wu_3 != $null) {
  83. hadd -m wu_reg %wu_nick %wu_3_long
  84. .notice %wu_nick You are now linked to %wu_3_long
  85. set %wu_location $hget(wu_reg,%wu_nick)
  86. ;echo -s %wu_location
  87. }
  88. if (%wu_2 == remove) {
  89. hdel wu_reg %wu_nick
  90. .notice %wu_nick Your location association has been removed.
  91. wu_cleanup
  92. }
  93. if (%wu_2 == ?) || (%wu_2 == help) {
  94. wu_help
  95. }
  96.  
  97. ;;;---Below is used to turn the script on or off, but only if user is an op of a channel ---
  98.  
  99. $(%wu_onoff,2)
  100.  
  101. if (%wu_2 == on) || (%wu_2 == off) && (%wu_nick isop %wu_chan) {
  102. if (%wu_2 == on) {
  103. set $+(%,wunderground_,%wu_chan) ON
  104. .notice %wu_nick !weather script is now ON
  105. wu_cleanup
  106. halt
  107. }
  108. if (%wu_2 == off) {
  109. set $+(%,wunderground_,%wu_chan) OFF
  110. .notice %wu_nick !weather script is now OFF
  111. wu_cleanup
  112. halt
  113. }
  114. } ;end of %wu_on/off
  115. } ;end of ($2 != $null)
  116.  
  117.  
  118. ;--- Checks if wunderground is suppost to be OFF for the channel --
  119. if ($($+(%,wunderground_,%wu_chan),2) == OFF) {
  120. wu_cleanup
  121. halt
  122. }
  123.  
  124. ;---Command Prep. Checks command to see which data file it will be pulling from depending on command entered ---
  125. set %wu_address $replace(%wu_location,$chr(32),$chr(43))
  126.  
  127. if (%wu_command == !w) set %wu_command !weather
  128. if (%wu_command == !weather) || (%wu_command == !current) || (%wu_command == !time) {
  129. set %wu_link $+(/auto/wui/geo/WXCurrentObXML/index.xml?query=,%wu_address)
  130. set %wu_host api.wunderground.com
  131. sockopen wunderground %wu_host 80
  132. }
  133. if (%wu_command == !forecast) || (%wu_command == !forecast5) {
  134. set %wu_link $+(/auto/wui/geo/ForecastXML/index.xml?query=,%wu_address)
  135. set %wu_host www.wunderground.com
  136. sockopen wunderground %wu_host 80
  137.  
  138. }
  139. if (%wu_command == !alert) set %wu_command !alerts
  140. if (%wu_command == !alertsinfo) set %wu_command !alertinfo
  141. if (%wu_command == !alerts) || (%wu_command == !alertinfo) {
  142. set %wu_link $+(/auto/wui/geo/AlertsXML/index.xml?query=,%wu_address)
  143. set %wu_host www.wunderground.com
  144. sockopen wunderground %wu_host 80
  145. }
  146.  
  147. ;echo -s LINK: %wu_link
  148. }
  149.  
  150.  
  151. on *:sockopen:wunderground: {
  152.  
  153. ;sockwrite -n $sockname GET %wu_link XML/1.0
  154. sockwrite -n $sockname GET %wu_link
  155. sockwrite -n $sockname Host: %wu_host
  156. sockwrite -n $sockname $crlf
  157. }
  158.  
  159. on *:sockread:wunderground: {
  160. sockread %wu_temp
  161. if ($regex(%wu_temp,/([[:xdigit:]]{2});/)) {
  162. set %wu_temp $replace(%wu_temp,$+(&#x,$regml(1),;),$chr($base($regml(1),16,10)))
  163. }
  164. set %wu_temp $regsubex(%wu_temp,/[\46\43](\d+)\73/g,$chr(\1))
  165. set %wu_temp $replacex(%wu_temp,",",&lt;,<,&rt;,>,&deg;,°,&,&)
  166. ;set %wu_temp $regsubex(%wu_temp,/&#(\d+)\;/g,$chr(\1))
  167. ;echo -s %wu_temp
  168.  
  169. ;--- Variables for Weather, Current and Time Command ---
  170. if (%wu_command == !weather) || (%wu_command == !current) || (%wu_command == !time) {
  171. ; local info
  172. if (<full> isin %wu_temp) && (%wu_full == $null) %wu_full = $remove(%wu_temp,<full>,</full>,$chr(9))
  173. if (<city> isin %wu_temp) && (%wu_city == $null) %wu_city = $remove(%wu_temp,<city>,</city>,$chr(9))
  174. if (<state> isin %wu_temp) && (%wu_state == $null) %wu_state = $remove(%wu_temp,<state>,</state>,$chr(9))
  175. if (<state_name> isin %wu_temp) && (%wu_state_name == $null) %wu_state_name = $remove(%wu_temp,<state_name>,</state_name>,$chr(9))
  176. if (<country> isin %wu_temp) && (%wu_country == $null) %wu_country = $remove(%wu_temp,<country>,</country>,$chr(9))
  177. if (<country_iso3166> isin %wu_temp) && (%wu_country_iso3166 == $null) %wu_country_iso3166 = $remove(%wu_temp,<country_iso3166>,</country_iso3166>,$chr(9))
  178. if (<zip> isin %wu_temp) && (%wu_zip == $null) %wu_zip = $remove(%wu_temp,<zip>,</zip>,$chr(9))
  179. if (<latitude> isin %wu_temp) && (%wu_latitude == $null) %wu_latitude = $remove(%wu_temp,<latitude>,</latitude>,$chr(9))
  180. if (<longitude> isin %wu_temp) && (%wu_longitude == $null) %wu_longitude = $remove(%wu_temp,<longitude>,</longitude>,$chr(9))
  181. if (<elevation> isin %wu_temp) && (%wu_elevation == $null) %wu_elevation = $remove(%wu_temp,<elevation>,</elevation>,$chr(9))
  182.  
  183. if (<local_time> isin %wu_temp) %wu_local_time = $remove(%wu_temp,<local_time>,</local_time>,$chr(9))
  184. if (<local_time_rfc822> isin %wu_temp) %wu_local_time_rfc822 = $remove(%wu_temp,<local_time_rfc822>,</local_time_rfc822>,$chr(9))
  185.  
  186. ; current weather
  187. if (<weather> isin %wu_temp) %wu_weather = $remove(%wu_temp,<weather>,</weather>,$chr(9))
  188. if (<temperature_string> isin %wu_temp) %wu_temperature_string = $remove(%wu_temp,<temperature_string>,</temperature_string>,$chr(9))
  189. if (<temp_f> isin %wu_temp) %wu_temp_f = $remove(%wu_temp,<temp_f>,</temp_f>,$chr(9))
  190. if (<temp_c> isin %wu_temp) %wu_temp_c = $remove(%wu_temp,<temp_c>,</temp_c>,$chr(9))
  191. if (<relative_humidity> isin %wu_temp) %wu_relative_humidity = $remove(%wu_temp,<relative_humidity>,</relative_humidity>,$chr(9))
  192.  
  193. ; wind
  194. if (<wind_string> isin %wu_temp) %wu_wind_string = $remove(%wu_temp,<wind_string>,</wind_string>,$chr(9))
  195. if (<wind_dir> isin %wu_temp) %wu_wind_dir = $remove(%wu_temp,<wind_dir>,</wind_dir>,$chr(9))
  196. if (<wind_degrees> isin %wu_temp) %wu_wind_degrees = $remove(%wu_temp,<wind_degrees>,</wind_degrees>,$chr(9))
  197. if (<wind_mph> isin %wu_temp) %wu_wind_mph = $remove(%wu_temp,<wind_mph>,</wind_mph>,$chr(9))
  198. if (<wind_gust_mph> isin %wu_temp) %wu_wind_gust_mph = $remove(%wu_temp,<wind_gust_mph>,</wind_gust_mph>,$chr(9))
  199.  
  200. if (<pressure_string> isin %wu_temp) %wu_pressure_string = $remove(%wu_temp,<pressure_string>,</pressure_string>,$chr(9))
  201. if (<pressure_mb> isin %wu_temp) %wu_pressure_mb = $remove(%wu_temp,<pressure_mb>,</pressure_mb>,$chr(9))
  202. if (<pressure_in> isin %wu_temp) %wu_pressure_in = $remove(%wu_temp,<pressure_in>,</pressure_in>,$chr(9))
  203. if (<dewpoint_string> isin %wu_temp) %wu_dewpoint_string = $remove(%wu_temp,<dewpoint_string>,</dewpoint_string>,$chr(9))
  204. if (<dewpoint_f> isin %wu_temp) %wu_dewpoint_f = $remove(%wu_temp,<dewpoint_f>,</dewpoint_f>,$chr(9))
  205. if (<dewpoint_c> isin %wu_temp) %wu_dewpoint_c = $remove(%wu_temp,<dewpoint_c>,</dewpoint_c>,$chr(9))
  206.  
  207. if (<heat_index_string> isin %wu_temp) %wu_heat_index_string = $remove(%wu_temp,<heat_index_string>,</heat_index_string>,$chr(9))
  208. if (<heat_index_f> isin %wu_temp) %wu_heat_index_f = $remove(%wu_temp,<heat_index_f>,</heat_index_f>,$chr(9))
  209. if (<heat_index_c> isin %wu_temp) %wu_heat_index_c = $remove(%wu_temp,<heat_index_c>,</heat_index_c>,$chr(9))
  210. if (<windchill_string> isin %wu_temp) %wu_windchill_string = $remove(%wu_temp,<windchill_string>,</windchill_string>,$chr(9))
  211. if (<windchill_f> isin %wu_temp) %wu_windchill_f = $remove(%wu_temp,<windchill_f>,</windchill_f>,$chr(9))
  212. if (<windchill_c> isin %wu_temp) %wu_windchill_c = $remove(%wu_temp,<windchill_c>,</windchill_c>,$chr(9))
  213.  
  214. if (<visibility_mi> isin %wu_temp) %wu_visibility_mi = $remove(%wu_temp,<visibility_mi>,</visibility_mi>,$chr(9))
  215. if (<visibility_km> isin %wu_temp) %wu_visibility_km = $remove(%wu_temp,<visibility_km>,</visibility_km>,$chr(9))
  216. }
  217.  
  218. ;--- Variables for Forecast Command ---
  219. if (%wu_command == !forecast) || (%wu_command == !forecast5) {
  220. if (<period> isin %wu_temp) set %wu_period $remove(%wu_temp,<period>,</period>,$chr(9),$chr(32))
  221. if (<high> isin %wu_temp) set %wu_xtemp 1
  222. if (<low> isin %wu_temp) set %wu_xtemp 2
  223. if (<simpleforecast> isin %wu_temp) set %wu_simpleforecast 1
  224.  
  225. if (<title> isin %wu_temp) && (%wu_period == 1) %wu_f1_title = $remove(%wu_temp,<title>,</title>,$chr(9))
  226. if (<fcttext> isin %wu_temp) && (%wu_period == 1) %wu_f1_fcttext = $remove(%wu_temp,<fcttext>,</fcttext>,$chr(9))
  227. if (<title> isin %wu_temp) && (%wu_period == 2) %wu_f2_title = $remove(%wu_temp,<title>,</title>,$chr(9))
  228. if (<fcttext> isin %wu_temp) && (%wu_period == 2) %wu_f2_fcttext = $remove(%wu_temp,<fcttext>,</fcttext>,$chr(9))
  229.  
  230. if (%wu_simpleforecast == 1) {
  231. if (<weekday> isin %wu_temp) set $+(%,wu_P,%wu_period,_weekday) $remove(%wu_temp,<weekday>,</weekday>,$chr(9),$chr(32))
  232. if (<conditions> isin %wu_temp) set $+(%,wu_P,%wu_period,_conditions) $remove(%wu_temp,<conditions>,</conditions>,$chr(9))
  233. if (%wu_xtemp == 1) {
  234. if (<fahrenheit> isin %wu_temp) set $+(%,wu_P,%wu_period,_highf) $remove(%wu_temp,<fahrenheit>,</fahrenheit>,$chr(9),$chr(32))
  235. if (<celsius> isin %wu_temp) set $+(%,wu_P,%wu_period,_highc) $remove(%wu_temp,<celsius>,</celsius>,$chr(9),$chr(32))
  236. }
  237. if (%wu_xtemp == 2) {
  238. if (<fahrenheit> isin %wu_temp) set $+(%,wu_P,%wu_period,_lowf) $remove(%wu_temp,<fahrenheit>,</fahrenheit>,$chr(9),$chr(32))
  239. if (<celsius> isin %wu_temp) set $+(%,wu_P,%wu_period,_lowc) $remove(%wu_temp,<celsius>,</celsius>,$chr(9),$chr(32))
  240. }
  241. }
  242. }
  243. ;--- Variables for Alerts Command ---
  244. if (%wu_command == !alerts) || (%wu_command == !alertinfo) {
  245. ;echo -s %wu_temp
  246. set -n %wu_ac <alert count="
  247. if (%wu_ac isin %wu_temp) set -n %wu_a_count $remove(%wu_temp,<termsofservice link="http://www.wunderground.com/weather/api/d/terms.html">This feed will be deprecated. Please switch to http://www.wunderground.com/weather/api/</termsofservice>,<alert count=",">,$chr(32),$chr(9))
  248. if (<AlertItem> isin %wu_temp) inc %wu_a_i
  249. if (<type> isin %wu_temp) set $+(%,wu_a,%wu_a_i,_type) $remove(%wu_temp,<type>,</type>,$chr(9))
  250. if (<description> isin %wu_temp) set $+(%,wu_a,%wu_a_i,_description) $remove(%wu_temp,<description>,</description>,$chr(9))
  251. if (<date epoch isin %wu_temp) set $+(%,wu_a,%wu_a_i,_date) $right($remove(%wu_temp,<date epoch=",">,</date>,$chr(9)),-12)
  252. if (<expires epoch isin %wu_temp) set $+(%,wu_a,%wu_a_i,_expires) $right($remove(%wu_temp,<expires epoch=",">,</expires>,$chr(9)),-10)
  253. if (</message> isin %wu_temp) { set %wu_msg OFF | set $+(%,wu_a,%wu_a_i,_count) $(%wu_msg_c,2) | set %wu_msg_c 0 }
  254. if (%wu_msg == ON) {
  255. inc %wu_msg_gc
  256. inc %wu_msg_c
  257. set $+(%,wu_a,%wu_a_i,_message,%wu_msg_c) %wu_temp
  258. }
  259. if (<message> isin %wu_temp) { set %wu_msg ON }
  260. }
  261. }
  262.  
  263.  
  264.  
  265. on *:sockclose:wunderground: {
  266. ;--- Spacers. Such as -|- | and -|
  267. var %wu_space = $+($chr(45),$chr(124),$chr(45))
  268. var %wu_space2 = $+($chr(32),$chr(124),$chr(32))
  269. var %wu_spaceend = $+($chr(45),$chr(124))
  270.  
  271. ;--- Removes + sign from address variable
  272. set %wu_address $replace(%wu_address,$chr(43),$chr(32))
  273.  
  274. if (%wu_command == !weather) {
  275. set %wu_present $remove(%wu_full,$chr(9),$chr(32),$chr(44))
  276. if (%wu_present == $null) msg %wu_chan Location not found
  277. if (%wu_present != $null) msg %wu_chan %wu_full $+ : %wu_weather and $+(%wu_temp_f,$chr(176),F,$chr(47),%wu_temp_c,$chr(176),C)
  278. }
  279. if (%wu_command == !current) {
  280. set %wu_present $remove(%wu_full,$chr(9),$chr(32),$chr(44))
  281. if (%wu_present == $null) msg %wu_chan Location not found
  282. if (%wu_present != $null) msg %wu_chan %wu_full $+ : %wu_weather and $+(%wu_temp_f,$chr(176),F,$chr(47),%wu_temp_c,$chr(176),C) $&
  283. $+ %wu_space2 Heat Index: $+(%wu_heat_index_f,$chr(176),F,$chr(47),%wu_heat_index_c,$chr(176),C)$&
  284. $+ %wu_space2 Winds %wu_wind_string $&
  285. $+ %wu_space2 Windchill: $+(%wu_windchill_f,$chr(176),F,$chr(47),%wu_windchill_c,$chr(176),C) $&
  286. $+ %wu_space2 Pressure: $+(%wu_pressure_in,in,$chr(47),%wu_pressure_mb,mb) $&
  287. $+ %wu_space2 Humidity: %wu_relative_humidity $&
  288. $+ %wu_space2 Dew: $+(%wu_dewpoint_f,$chr(176),F,$chr(47),%wu_dewpoint_c,$chr(176),C) $&
  289. $+ %wu_space2 Visiblity: $+(%wu_visibility_mi,mi,$chr(47),%wu_visibility_km,km)
  290. }
  291.  
  292. if (%wu_command == !time) {
  293. msg %wu_chan %wu_full $+ : %wu_local_time
  294. }
  295. if (%wu_command == !forecast) || (%wu_command == !forecast5) {
  296. if (%wu_f1_title != $null) {
  297. var %wu_forecast1 $(%wu_f1_title $+ : %wu_f1_fcttext)
  298. var %wu_forecast2 $(%wu_f2_title $+ : %wu_f2_fcttext)
  299. if (%wu_f2_title != %wu_P2_weekday ) var %wu_forecast3 $(%wu_P2_weekday $+ : %wu_P2_conditions $+ . High: $+(%wu_P2_highf,$chr(176),F) $chr(47) $+(%wu_P2_highc,$chr(176),C) Low: $+(%wu_P2_lowf,$chr(176),F) $chr(47) $+(%wu_P2_lowc,$chr(176),C))
  300. ;if (%wu_f2_title != %wu_P2_weekday ) var %wu_forecast3 $(%wu_P4_weekday $+ : %wu_P4_conditions $+ . High: $+(%wu_P4_highf,$chr(176),F) $chr(47) $+(%wu_P4_highc,$chr(176),C) Low: $+(%wu_P4_lowf,$chr(176),F) $chr(47) $+(%wu_P4_lowc,$chr(176),C))
  301.  
  302. if (%wu_f2_title == %wu_P2_weekday ) var %wu_forecast3 $(%wu_P3_weekday $+ : %wu_P3_conditions $+ . High: $+(%wu_P3_highf,$chr(176),F) $chr(47) $+(%wu_P3_highc,$chr(176),C) Low: $+(%wu_P3_lowf,$chr(176),F) $chr(47) $+(%wu_P3_lowc,$chr(176),C))
  303. .timer 1 0 msg %wu_chan %wu_address $+ : %wu_forecast1
  304. .timer 1 1 msg %wu_chan %wu_forecast2 %wu_space %wu_forecast3 %wu_spaceend
  305. }
  306. if (%wu_f1_title == $null) {
  307. var %wu_forecast1 $(%wu_P1_weekday $+ : %wu_P1_conditions $+ . High: $+(%wu_P1_highf,$chr(176),F,$chr(40),%wu_P1_highc,$chr(176),C,$chr(41)) Low: $+(%wu_P1_lowf,$chr(176),F,$chr(40),%wu_P1_lowc,$chr(176),C,$chr(41)))
  308. var %wu_forecast2 $(%wu_P2_weekday $+ : %wu_P2_conditions $+ . High: $+(%wu_P2_highf,$chr(176),F,$chr(40),%wu_P2_highc,$chr(176),C,$chr(41)) Low: $+(%wu_P2_lowf,$chr(176),F,$chr(40),%wu_P2_lowc,$chr(176),C,$chr(41)))
  309. var %wu_forecast3 $(%wu_P3_weekday $+ : %wu_P3_conditions $+ . High: $+(%wu_P3_highf,$chr(176),F,$chr(40),%wu_P3_highc,$chr(176),C,$chr(41)) Low: $+(%wu_P3_lowf,$chr(176),F,$chr(40),%wu_P3_lowc,$chr(176),C,$chr(41)))
  310. .timer 1 0 msg %wu_chan %wu_address $+ : %wu_forecast1
  311. .timer 1 1 msg %wu_chan %wu_forecast2 %wu_space %wu_forecast3
  312. }
  313. }
  314.  
  315. if (%wu_command == !forecast5) {
  316. ;.timer 1 0 .msg %wu_chan %wu_P1_weekday $+ : %wu_P1_conditions $+ . High: $+(%wu_P1_highf,$chr(176),F,$chr(40),%wu_P1_highc,$chr(176),C,$chr(41)) - Low: $+(%wu_P1_lowf,$chr(176),F,$chr(40),%wu_P1_lowc,$chr(176),C,$chr(41))
  317. .timer 1 1 .msg %wu_nick Your forcast for %wu_address
  318. .timer 1 2 .msg %wu_nick %wu_P1_weekday $+ : %wu_P1_conditions $+ . High: $+(%wu_P1_highf,$chr(176),F,$chr(40),%wu_P1_highc,$chr(176),C,$chr(41)) - Low: $+(%wu_P1_lowf,$chr(176),F,$chr(40),%wu_P1_lowc,$chr(176),C,$chr(41))
  319. .timer 1 3 .msg %wu_nick %wu_P2_weekday $+ : %wu_P2_conditions $+ . High: $+(%wu_P2_highf,$chr(176),F,$chr(40),%wu_P2_highc,$chr(176),C,$chr(41)) - Low: $+(%wu_P2_lowf,$chr(176),F,$chr(40),%wu_P2_lowc,$chr(176),C,$chr(41))
  320. .timer 1 4 .msg %wu_nick %wu_P3_weekday $+ : %wu_P3_conditions $+ . High: $+(%wu_P3_highf,$chr(176),F,$chr(40),%wu_P3_highc,$chr(176),C,$chr(41)) - Low: $+(%wu_P3_lowf,$chr(176),F,$chr(40),%wu_P3_lowc,$chr(176),C,$chr(41))
  321. .timer 1 5 .msg %wu_nick %wu_P4_weekday $+ : %wu_P4_conditions $+ . High: $+(%wu_P4_highf,$chr(176),F,$chr(40),%wu_P4_highc,$chr(176),C,$chr(41)) - Low: $+(%wu_P4_lowf,$chr(176),F,$chr(40),%wu_P4_lowc,$chr(176),C,$chr(41))
  322. .timer 1 6 .msg %wu_nick %wu_P5_weekday $+ : %wu_P5_conditions $+ . High: $+(%wu_P5_highf,$chr(176),F,$chr(40),%wu_P5_highc,$chr(176),C,$chr(41)) - Low: $+(%wu_P5_lowf,$chr(176),F,$chr(40),%wu_P5_lowc,$chr(176),C,$chr(41))
  323. .timer 1 7 .msg %wu_nick %wu_P6_weekday $+ : %wu_P6_conditions $+ . High: $+(%wu_P6_highf,$chr(176),F,$chr(40),%wu_P6_highc,$chr(176),C,$chr(41)) - Low: $+(%wu_P6_lowf,$chr(176),F,$chr(40),%wu_P6_lowc,$chr(176),C,$chr(41))
  324. }
  325.  
  326. if (%wu_command == !alerts) {
  327. if (%wu_a_count == 0) msg %wu_chan %wu_address $+ : No Alerts
  328. if (%wu_a_count > 0) {
  329. msg %wu_chan %wu_address $+ : %wu_a_count Alerts
  330. var %i 1
  331. while (%i <= %wu_a_count) {
  332. .timer 1 %i msg %wu_chan %wu_a_start $($+(%,wu_a,%i,_description),2) till $($+(%,wu_a,%i,_expires),2) %wu_a_end
  333. inc %i
  334. }
  335. .timer 1 %i .notice %wu_nick use $chr(2) !alertinfo $chr(2) [zipcode|city,state|city,country|airport] for alert details
  336. }
  337. }
  338. if (%wu_command == !alertinfo) {
  339. if (%wu_a_count == 0) msg %wu_chan %wu_address $+ : No Alerts
  340. if (%wu_a_count > 0) {
  341. ;msg %wu_chan %wu_address $+ : %wu_a_count Alerts - See PM for details
  342. .msg %wu_nick %wu_address $+ : %wu_a_count Alerts
  343. var %i 1 , %i_gc 1
  344. while (%i <= %wu_a_count) {
  345. .timer 1 %i_gc .msg %wu_nick $chr(2) $($+(%,wu_a,%i,_description),2) $chr(2) from $($+(%,wu_a,%i,_date),2) till $($+(%,wu_a,%i,_expires),2)
  346. var %i_msg 1
  347. while (%i_msg <= $($+(%,wu_a,%i,_count),2)) {
  348. .timer 1 %i_gc .msg %wu_nick $($+(%,wu_a,%i,_message,%i_msg),2)
  349. inc %i_gc
  350. inc %i_msg
  351. }
  352. inc %i
  353. }
  354. .timer 1 %i_gc .msg %wu_nick --------- End of Alerts -------
  355. }
  356. }
  357.  
  358.  
  359.  
  360. ;echo -s End-------- of WU $time --------
  361. wu_cleanup
  362. }
  363.  
  364. alias wu_help {
  365. .timer 1 0 .msg %wu_nick $me $+ ' Weather Commands: (16 lines)
  366. .timer 1 1 .msg %wu_nick !weather !current !forecast !forecast5 !alerts !alertinfo !time
  367. .timer 1 2 .msg %wu_nick Use above commands with your desired location.
  368. .timer 1 3 .msg %wu_nick !weather [zipcode|city,state|city,country|airport]
  369. .timer 1 4 .msg %wu_nick Examples: !weather 90210 - !weather Beverly Hills, CA - !weather LAX - !weather E2J4C7
  370. .timer 1 5 .msg %wu_nick You can also set a default location for yourself. Just type: !weather REGISTER [location]
  371. .timer 1 6 .msg %wu_nick To remove from the list, simply type !weather REMOVE
  372. .timer 1 7 .msg %wu_nick After you have registure, You can simply use !weather and it will bring up your default
  373. .timer 1 8 .msg %wu_nick -----END OF WEATHER HELP -----
  374. wu_cleanup
  375. }
  376.  
  377. alias wu_cleanup {
  378. unset %wu_*
  379. }
  380.  
  381.  
  382. /*
  383. ---- VERSION HISTORY -----
  384. 1.0
  385. - Original creation
  386.  
  387. 2.0
  388. - Added !current command
  389. - Unknown modifications
  390.  
  391. 3.0
  392. - Added REGISTER and HELP functions
  393. - Fixed !forecast, !forecast5, !alerts !alertinfo Address still including + sign error.
  394.  
  395. 3.1
  396. - Added !weather ON and OFF command to turn the script on or off. (set for OPS ONLY)
  397.  
  398. 3.2
  399. - Modified !weather ON/OFF command. Now the ON and OFF commands are Per #channel basis. (allowing it to be on in one chan, but off in another
  400.  
  401. 3.3
  402. - Line 238, TOS line had changed. Updated $remove() to reflect new text.
  403.  
  404. 4.0
  405. - Local Support. Now Local user (mIRC client hosting the script) can also activate and use the script.
  406. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement