This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

DragnLord's weather script

Support & discussion of released scripts, and announcements of new releases.
Post Reply
User avatar
DragnLord
Owner
Posts: 711
Joined: Sat Jan 24, 2004 4:58 pm
Location: C'ville, Virginia, USA

Post by DragnLord »

Kein wrote:Also, help-string still says "[23:27:09] -Bot- Check your syntax, use .wz -help", but well, you see, I have changed the prefix and cmd... Just make it variable in help-text :P
Yes, that is an error, it should be "$weather help" for you.

Help is activated by using "help" as the location, I'll change the message for the next version.
User avatar
DragnLord
Owner
Posts: 711
Joined: Sat Jan 24, 2004 4:58 pm
Location: C'ville, Virginia, USA

Specifying country code

Post by DragnLord »

The country code is required for all locations outside of the United States of America.
User avatar
DragnLord
Owner
Posts: 711
Joined: Sat Jan 24, 2004 4:58 pm
Location: C'ville, Virginia, USA

Post by DragnLord »

Kein wrote: [country] -> I always thought that the args in [] brackets is optional.
[23:18:01] <Kein> $weather boston
[23:22:34] <Bot> [22:22] Tcl error [pub_wz]: can't read "outtitle": no such variable
Looks like I was wrong all my life.
Specifying the state with a city is not in [] brackets and is required as stated.
Country code for locations within the United States of America used to be optional, and now is not used.
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

Actually, I think what he meant is the reason you require the state is because without it you are presented with a list of possible matches rather than a definite match.
CtrlAltDel wrote:
[23:18:01] <Kein> $weather boston
[23:22:34] <Bot> [22:22] Tcl error [pub_wz]: can't read "outtitle": no such variable
Looks like I was wrong all my life.

Can you just make it... optional? Let it return the first result, c'mon. It will not break anything or destroy the eternity.
He would rather it just take the top suggested result and roll with that than give a tcl error mentioning some non-existant variable, "outtitle". Or, at the very least, present the potential list of matches and ask for refinement. I don't think guy was asking for the moon, or your first born child. That makes damn good sense. You should embrace the ideas coming from people using your script, rather than impose your disdain upon them. And yeah, lighten up. It's only irc, type /clear. Breathe. ;D

Edit:

Code: Select all

find this:	
regexp {<title>(.*?)</title>} $html match outtitle
if {[string first Search $outtitle] !=-1} {puthelp "NOTICE $nick :Check your syntax, use .wz -help";close $wzsock;return 0}
if {[string first Error $outtitle] !=-1} {puthelp "NOTICE $nick :Location not found, please check spelling.";close $wzsock;return 0}

change it to this:
if {![regexp {<title>(.*?)</title>} $html match outtitle]} {
  puthelp "NOTICE $nick :You need to supply more information for that location.."
  close $wzsock;return 0
}
if {[string first Search $outtitle] !=-1} {puthelp "NOTICE $nick :Check your syntax, use .wz -help";close $wzsock;return 0}
if {[string first Error $outtitle] !=-1} {puthelp "NOTICE $nick :Location not found, please check spelling.";close $wzsock;return 0}
That will at least give a proper error message to the user, rather than cause a tcl error.
User avatar
DragnLord
Owner
Posts: 711
Joined: Sat Jan 24, 2004 4:58 pm
Location: C'ville, Virginia, USA

Post by DragnLord »

Earlier versions of the script did return lists of locations, however that was removed due to user requests and complaints. I may include an option for that feature in a future version after 4.2.6, which has already been uploaded to the archives.
User avatar
spithash
Master
Posts: 248
Joined: Thu Jul 12, 2007 9:21 am
Location: Libera
Contact:

Post by spithash »

DragnLord,

If you add some flood protection, like, how many trigger requests per how many seconds.. would be AWESOME! :D

When a user floods a trigger, the bot will post the requests without stopping and even worse, when the script is set to:

Code: Select all

set wz_outmeth putserv
or even worse to:

Code: Select all

set wz_outmeth putquick
then the bot excess flood quits. :?

Even more annoying when you even have that set to "puthelp" and someone trigger floods in the channel and the bot HAS to post EVERYTHING :cry: Takes time!!!
Libera ##rtlsdr & ##re - Nick: spithash
Click here for troll.tcl
C
CtrlAltDel
Halfop
Posts: 49
Joined: Wed Jun 02, 2004 7:58 am

No Report

Post by CtrlAltDel »

All of a sudden this morning I'm getting "No Report" for temperature no matter what location I try.
You just knew it had been too long since they screwed it up.

Still the best weather script available. Thanks
p
planetb
Voice
Posts: 6
Joined: Fri Jan 21, 2011 7:10 pm

Re: No Report

Post by planetb »

CtrlAltDel wrote:All of a sudden this morning I'm getting "No Report" for temperature no matter what location I try.
You just knew it had been too long since they screwed it up.

Still the best weather script available. Thanks

I'm also seeing the same issue :

New York, New York -- 11:17 AM EST Updated: 11:16 AM EST on January 22, 2011
Conditions: Temp: No report
Humidity: 32% Dew Point: 3°F / -16°C
Pressure: 30.01in / 1016.1hPa (Steady) Wind: 3.0mph / 4.8km/h / 1.3m/s Variable
p
planetb
Voice
Posts: 6
Joined: Fri Jan 21, 2011 7:10 pm

Re: No Report

Post by planetb »

Not sure if DragnLord is still around. So I learned a little about tcl and started looking into the issue a little. made a couple changes and now the script is working again. Looks like they changed the website format a little.

Changes I made :

Code: Select all

Line 782 : changed "&#176" to "&deg"

         if {[regexp {Temperature} $conditions]} {regexp {Temperature (.*?)°F / (.*?)°C} $conditions match temp mtemp} else {regexp {[[:blank:]](.{1,5}?)°F} $conditions match temp; regexp {F /[[:blank:]]*?(.*?)°C (.*?) [[:alpha:]]*?:} $conditions match mtemp cond}

Code: Select all

Line 792 and 793 : Changed "&#176" to "&deg" also.

         if {[regexp {Windchill} $conditions]} {regexp {Windchill: (.*?)°F / (.*?)°C [[:alpha:]]*:} $conditions match ichill mchill}
         if {[regexp {Heat Index} $conditions]} {regexp {Heat Index: (.*?)°F / (.*?)°C [[:alpha:]]*:} $conditions match ihindex mhindex}
Found this by putting "putlog $conditions" right above line 782 and then looking in the log file "eggdrop.log" after I had someone run a .wz . Dew point was also already set as &deg

Log file entry :
[16:14] Updated: 4:07 PM EST on January 23, 2011 26.1°F / -3.3°C Clear Windchill: 17°F / -8°C Humidity: 19% Dew Point: -13°F / -25°C Wind: 9.0mph / 14.5km/h / 4.0m/s from the NW Wind Gust: 13.0mph / 20.9km/h / 9.3m/s Pressure: 30.14in / 1020.5hPa (Rising) Visibility: 10.0miles / 16.1kilometers UV: 1 out of 16 Pollen: .10 out of 12Pollen Forecast new! Clouds: Clear - (Above Ground Level) Elevation: 52ft / 15m
New York, New York -- 4:07 PM EST Updated: 4:07 PM EST on January 23, 2011
Conditions: 26.1°F / -3.3°C | Clear
Humidity: 19% Windchill: 17°F / -8°C Dew Point: -13°F / -25°C
Pressure: 30.14in / 1020.5hPa (Rising) Wind: 9.0mph / 14.5km/h / 4.0m/s from the NW
V
Vasago
Voice
Posts: 3
Joined: Sun Jan 23, 2011 6:10 pm

Post by Vasago »

Thank you Planetb for the fix you came up with. My husband usally fixes things but he couldn't figure this one out.
C
CtrlAltDel
Halfop
Posts: 49
Joined: Wed Jun 02, 2004 7:58 am

Post by CtrlAltDel »

planetb: Many thanks
b
bluzman
Voice
Posts: 4
Joined: Sat Jan 22, 2011 1:22 pm

Post by bluzman »

Thanks planetb, your fix worked perfectly.

Cheers!
w
webmastir
Voice
Posts: 6
Joined: Fri Jan 28, 2011 12:25 am

Post by webmastir »

can anyone upload a working tcl somewhere w/ planetb's fixes integrated?

thx :)
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Can't you edit the tcl file in a text editor and replace all instances of "&#176" with "&deg"? Basically this is what he did.
Once the game is over, the king and the pawn go back in the same box.
w
webmastir
Voice
Posts: 6
Joined: Fri Jan 28, 2011 12:25 am

Post by webmastir »

caesar wrote:Can't you edit the tcl file in a text editor and replace all instances of "&#176" with "&deg"? Basically this is what he did.
lol. well ya, i suppose i could :oops: . i swore when i looked at his post last night it was quite a bit more tweaking. seems easy enough. will try it out. thx

edit: worked...thx
Post Reply