Top

Weather Bot

Please Register to submit score.
Average Score  9.3
Scores Submitted  9
Date Added  Dec 14, 2007
Last Updated  May 02, 2008
Tags  socket  weather 

Introduction

This script while retrieve the weather for US zip codes from the website www.weather.com.

Ex:

[11:42] <Goofy|Around> !Weather 29745
[11:42] <WaiterJohn> 04Location: York, SC (29745)
[11:42] <WaiterJohn> 04Current Temp: 73°F / 23°C 04Feels Like: 02 73°F / 23°C
[11:42] <WaiterJohn> 03Current Conditions: Partly Cloudy 03Pressure: 30.14 in. and steady 03Humidity: 60% 03Visibility: 10.0 miles 03UV Index: 6 High 03Wind: From SW at 15 mph gusting to 23 mph
[11:42] <WaiterJohn> 03Dew Point: 58°F ( 14°C ) 03Sunrise: 6:31 AM 03Sunset: 8:11 PM
[11:42] <WaiterJohn> 03Last Updated: Updated May 2 11:25 a.m. ET 03Info From: www.weather.com

Update: Added alias so you can trigger it yourself and message the channel with the response.


Update: Added axtra error checking to the alias ( weatherm ). Thanks to Tokensoup.

Update: Added extra stuff for UV and Preassure. ( help from some one who wishes to remain namelss )


Grab the Code

Comments

  (37)  RSS
EL
Comments: 884
 
mIRC Snippet:  Weather Bot
Posted on Dec 14, 2007 4:55 pm
Ok this is just cool and nice work.I chat with allot of Aussies an ppl from the UK an such is there any way to make is global?....Just outta curiosity cause i cant even modify this Im not that far along with my coding abilities learning by myself.Any way again awesome work.`-.-´
ZiX
Comments: 52
 
mIRC Snippet:  Weather Bot
Posted on Dec 14, 2007 6:26 pm
Nice.
nachodude2
Comments: 3
 
mIRC Snippet:  Weather Bot
Posted on Dec 14, 2007 9:35 pm
This is awesome but the %we.cond so it doesn't display the conditions.
Scakk
Comments: 181
 
mIRC Snippet:  Weather Bot
Posted on Dec 14, 2007 9:43 pm
Removed the " %we.cond " in the output section since it did not output information.
napa182
Comments: 775
 
mIRC Snippet:  Weather Bot
Posted on Dec 14, 2007 11:53 pm
nice work.. how about adding forcast's to it..er just a thought.
Lindrian
Comments: 694
 
mIRC Snippet:  Weather Bot
Posted on Dec 15, 2007 4:23 am
Learn hnow to use REGEX, it'l make you're code alot better. And mst likely, smaller. Nice work anyhow
nachodude2
Comments: 3
 
mIRC Snippet:  Weather Bot
Posted on Dec 15, 2007 8:17 am
Just try fixing the %we.cond that is very important and is what most people look for in a weather forcast
imehul
Comments: 1
 
mIRC Snippet:  Weather Bot
Posted on Dec 31, 2007 5:29 am
HElLo All I wanna use this Globally Can it be done??
Please tell me what changed required
Al_Bundy33
Comments: 13
 
mIRC Snippet:  Weather Bot
Posted on Jan 2, 2008 10:05 am
Will you add a way for me to do /weather and my zip so that i can check it and it show in the room plz?

Thanks :)
Scakk
Comments: 181
 
mIRC Snippet:  Weather Bot
Posted on Jan 2, 2008 10:18 am
@ Al Bundy33

Code:

alias weatherm {
  if ($1 isnum) && ($len($1) == 5) {
  weather $1 | set %we.chan $chan }
  else {
    echo -a Incorrect zip code format.
  }
}
Al_Bundy33
Comments: 13
 
mIRC Snippet:  Weather Bot
Posted on Jan 2, 2008 12:01 pm
ok added the code new but for some reason it is putting it in the status/server window not in the room
Al_Bundy33
Comments: 13
 
mIRC Snippet:  Weather Bot
Posted on Jan 2, 2008 12:04 pm
I'm using mirc 6.31 btw if that helps any.
Al_Bundy33
Comments: 13
 
mIRC Snippet:  Weather Bot
Posted on Jan 2, 2008 12:14 pm
Hope this helps, but this is what i get in the status window....

-=( 12:14 pm )=- -> *Location:* Lewisburg, TN (37091)
-
Location: No such nick/channel
-
-=( 12:15 pm )=- -> *Current* Temp: 23°F / -5°C Feels Like: 10°F / -12°C
-
Current No such nick/channel
-
-=( 12:15 pm )=- -> *Current* Conditions: Pressure: 30.73 in. Humidity: 40% Visibility: 10.0 miles UV Index: 2 Low Wind: From NNW at 15 mph Dew Point: 6°F ( -14°C ) Sunrise: 6:57 AM Sunset: 4:46 PM
-
Current No such nick/channel
-
-=( 12:15 pm )=- -> *Last* Updated: Updated Jan 2 12:00 p.m. CT Info From: www.weather.com
-
Last No such nick/channel
-
EL
Comments: 884
 
mIRC Snippet:  Weather Bot
Posted on Jan 2, 2008 12:21 pm
@ Al_Bundy33 Theres no channel set for it to send to within the alias use this.

alias weather {
set %we.chan $active
sockclose weather- $+ $replace($1-,$chr(32),+)
sockopen weather- $+ $replace($1-,$chr(32),+) www.weather.com 80
}
Should work fine.`-.-´
Al_Bundy33
Comments: 13
 
mIRC Snippet:  Weather Bot
Posted on Jan 2, 2008 12:28 pm
Ok Thank You, I like the script, good job :)
EL
Comments: 884
 
mIRC Snippet:  Weather Bot
Posted on Jan 2, 2008 12:36 pm
Also suggest that be implemented within the main script If the author feels fit to do so.Just a suggestion to fix the bug,still a cool snipp i use it in my multi serv bot good work Scakk.`-.-´
Scakk
Comments: 181
 
mIRC Snippet:  Weather Bot
Posted on Jan 2, 2008 7:27 pm
The alias I added was written for use in the channel and does work as I tested it multiple times. The alias I added was named " weatherm ". I added the "m" to it since there was aready an alias in the script named " weather". The one I added has to be triggered in a channel to work.

@ EL - The one you change did not really need changing as the alias I added and the on text event both set a channel " set %we.chan $chan" within itself.

Either way I am glad it works for you and you enjoy it.
Tokensoup
Comments: 4
 
mIRC Snippet:  Weather Bot
Posted on Jan 2, 2008 10:17 pm
@ Scakk, with the alias you just added, it would be much more sufficient to include error checking; or, alternatively, echo it to the active window. Just to solve that problem.
Scakk
Comments: 181
 
mIRC Snippet:  Weather Bot
Posted on Jan 2, 2008 10:34 pm
@ Tokensoup - The newest alias will echo an error message if you do not enter the right format of a zip code. If it is done correctly it will then trigger the socket part of the script the same as the on text part does. If you are finding errors then please post them here.
Tokensoup
Comments: 4
 
mIRC Snippet:  Weather Bot
Posted on Jan 2, 2008 10:51 pm
Oh, what I meant by my previous comment was, a user will receive errors if they don't send this to the active channel. What I would do for /weatherm is something like this:

Code:
alias weatherm {
  if ($1 isnum) && ($len($1) == 5) && ($active ischan) {
  weather $1 | set %we.chan $chan }
  elseif ($active !ischan) { echo -a Invalid window. (Use a channel window) }
  else {
    echo -a Incorrect zip code format.
  }
}


Giving the user information on the proper use of the alias. Or you can have your socket echo the information into the active window instead of msging to %we.chan if the active window isn't a channel.
Scakk
Comments: 181
 
mIRC Snippet:  Weather Bot
Posted on Jan 2, 2008 11:04 pm
I see what you mean now. I did not think of that. Thanks. I will update the code accordingly.
EL
Comments: 884
 
mIRC Snippet:  Weather Bot
Posted on Jan 3, 2008 12:47 am
Wow yeah my bad on that i ws using the /weather <zip code> cause I deleted teh /weatherm alias on top.All my snippet tests are done with the same file musta deleted that cause i thought it was a comment.I was missin the whole: ;Usage /weatherm zipcode
alias weatherm {
if ($1 isnum) && ($len($1) == 5) && ($active ischan) {
weather $1 | set %we.chan $chan }
elseif ($active !ischan) { echo -a Invalid window. (Use a channel window) }
else {
echo -a Incorrect zip code format.
}
}
But the weather <zip code> worked dispite so yeah i added the alias /weatherm even tho the bot doesnt use it just cause i want the whole code.So now she works like a charm.`-.-´
Al_Bundy33
Comments: 13
 
mIRC Snippet:  Weather Bot
Posted on Jan 8, 2008 12:15 pm
i dunno if it would be possible or not but could you add an optional feature that will add any weather watch or warnings , that is, if the place that it gets the weather from supports that? Just wondering.
Scakk
Comments: 181
 
mIRC Snippet:  Weather Bot
Posted on Jan 8, 2008 12:21 pm
I do not see that feature on the website so unfortunately I can not add it. If you see it on the site let me know and I will see what I can do about adding it in.
Al_Bundy33
Comments: 13
 
mIRC Snippet:  Weather Bot
Posted on Jan 8, 2008 12:49 pm
well there is tornado watches out for memphis, dunno if this helps but see if this page helps ya out any

http://www.weather.com/weather/local/USTN0325?from=search_city#
Teh Kittie
Comments: 2
 
mIRC Snippet:  Weather Bot
Posted on Jan 31, 2008 6:07 pm
the command !weather is not working for me or anyone else. i don't know anything about this kinda thing but i have to type in /weatherm zipcode to get it to work
Scakk
Comments: 181
 
mIRC Snippet:  Weather Bot
Posted on Jan 31, 2008 6:40 pm
Teh Kittie -- Did you use " !weather " or " !weather zipcode "? Using !weather alone will trigger the response " msg $chan Incorrect zip code format. "
tracetraceau
Comments: 4
 
mIRC Snippet:  Weather Bot
Posted on Jan 31, 2008 7:02 pm
Oh the command !weather zipcode whatever it is works perfectly for me , Thanks - one thing any way to make it global? I have alot of users from all around the world in my channel, just thought it would be nice

But great work :))
Scakk
Comments: 181
 
mIRC Snippet:  Weather Bot
Posted on Jan 31, 2008 7:05 pm
Glad it works for you now.

I am still working on a global version.
Teh Kittie
Comments: 2
 
mIRC Snippet:  Weather Bot
Posted on Feb 1, 2008 3:11 pm
!weather zipcode
ISM
Comments: 22
 
mIRC Snippet:  Weather Bot
Posted on Feb 11, 2008 8:55 pm
i paste this code in my pnplus in rmote but does seen like is working for me thx for ur help. i type !weather 06066 in chat room but doesnt seen like to work for me.
Scakk
Comments: 181
 
mIRC Snippet:  Weather Bot
Posted on Feb 11, 2008 9:10 pm
You can not trigger an " on TEXT " event your self. If you wish to check for yorself then use /weatherm zipcode
SuPeRFlY
Comments: 2
 
mIRC Snippet:  Weather Bot
Posted on May 2, 2008 10:24 am
i just wanted to say Scakk i use your weather snippet all the time. It is a 9 out of 10. The only thing that would make it a solid 10 is if it did a !forecast (zipcode). I hope this post isn't taken out of context because i realy do like this code. :)
knoeki
Comments: 6
 
mIRC Snippet:  Weather Bot
Posted on May 6, 2008 7:57 am
A pity that this doesn't work worldwide, then it would have been awesome.
^Neptune
Comments: 155
 
mIRC Snippet:  Weather Bot
Posted on May 6, 2008 8:28 am
Weather bots are a bit useless imo... you can just look outside and see what the weather is :P

Unless it can forecast, then it's not really useful imo :)
Eugenio
Comments: 518
 
mIRC Snippet:  Weather Bot
Posted on May 6, 2008 8:58 am
I agree its completely pointless, whats the point in knowing the weather if your sitting at your computer.
EL
Comments: 884
 
mIRC Snippet:  Weather Bot
Posted on May 6, 2008 12:48 pm
/me slaps you both ..look out side the box fellas you can hardly tell the weather accuratly nuff by lookin out side=/ plus thats like comparing java with mirc cause you can still chat with java so wats the point of mirc? well the point is to have a better look at chat use more commands do more ETC the weather code he has does the same in comparison it gives you more shows more then you could just see by lookin out the window.Don't be dip #$% look at the code its a exellent code and very useful.`-.-´

Please Register or Login to start posting comments.
Bottom