egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

incith:weather (2.8p) (Dec. 18th, 2008)
Goto page Previous  1, 2, 3 ... , 19, 20, 21  Next
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases
View previous topic :: View next topic  
Author Message
mtnvortest
Voice


Joined: 04 Mar 2016
Posts: 6

PostPosted: Thu Mar 24, 2016 4:46 pm    Post subject: Reply with quote

Yeah, they switched it back to https.

After taking another look at creasy's previous post, I found that I did not have the third line of code set correctly in the script...the SSL settings under the browser.

Thanks, creasy.
Back to top
View user's profile Send private message
simboy1234
Voice


Joined: 16 May 2015
Posts: 5

PostPosted: Tue Mar 29, 2016 4:07 pm    Post subject: Reply with quote

after installing tcltls-devel package : input from mtnvortest

changing http to https : input from shadrach

adding SSL settings under browser : input from creasy

and adding the below 2 lines to the begining of the scripts

package require http
package require tls

it works fine now.
Back to top
View user's profile Send private message
mtnvortest
Voice


Joined: 04 Mar 2016
Posts: 6

PostPosted: Sat Apr 09, 2016 11:59 pm    Post subject: Reply with quote

creasy wrote:
There is also the issue of no results or multiple results found. In the 1st case the bot doesn't respond at all, while in the 2nd instead of a list of possible hits it returns
Code:
High/Low: Unavailable; Wind: Calm

Any ideas on how to fix this?


Hmm...
Sorry creasy, I don't seem to be experiencing this same issue. If I do, and think of something to fix it, I will surely let you know.
Back to top
View user's profile Send private message
creasy
Voice


Joined: 05 Mar 2016
Posts: 19

PostPosted: Sun Apr 10, 2016 3:39 am    Post subject: Reply with quote

What responses do you get in those cases?
Back to top
View user's profile Send private message
rjpearce
Voice


Joined: 27 Mar 2006
Posts: 5

PostPosted: Mon Apr 11, 2016 6:57 pm    Post subject: Reply with quote

A big thank you to everyone who is contributing to keeping this script going.

To try and help the community I have setup a Github repository so we can track changes and get patches much more easily. It might also be helpful for tracking issues: https://github.com/rjpearce/incith-weather

I have rolled up the recent patches and added them under a new release 2.9e. https://github.com/rjpearce/incith-weather/releases/tag/2.9e

The original 2.9d can be found here:
https://github.com/rjpearce/incith-weather/releases/tag/2.9d

I will be contacting incith directly and asking for his blessing.

More than happy to give anyone direct push access, just ping me on Github.
Back to top
View user's profile Send private message
daffodil
Voice


Joined: 29 May 2016
Posts: 3
Location: Cleveland, Ohio, USA

PostPosted: Sun May 29, 2016 1:55 pm    Post subject: Thanks!!! First weather script that works :) Reply with quote

Congrats on making (or updating as the case may be) the first weather script for eggdrops that I've gotten to work in the last few days!

I am not sure if these are current bugs or not but thought I would share anyway:

1. Current weather returns a number showing as degrees Fahrenheit but looks like it is actually degrees Celsius, then because that number thought to be F is converted to C, it ends up even lower, thus showing a cold forecast when there isn't. I'm trying to locate the problem in the script but I don't know TCL. Humidity is correct.

2. Forecast doesn't work for USA locations but seems to work fine for others. Showing accurate temperatures and units.

I am excited to have finally found a weather script that works. Hope we can make it even better!

daffodil
Back to top
View user's profile Send private message
caesar
Ass Kicker


Joined: 14 Oct 2001
Posts: 3401
Location: Area 51

PostPosted: Sun May 29, 2016 2:25 pm    Post subject: Reply with quote

In DCC Chat/Telnet with the bot when issuing a forecast is should show you there a line like 'got temperature x C/F' or something similar. What's the x value compared to the output in the channel?
_________________
You may say anything about me, but don't misspell my name.
Back to top
View user's profile Send private message
daffodil
Voice


Joined: 29 May 2016
Posts: 3
Location: Cleveland, Ohio, USA

PostPosted: Sun May 29, 2016 2:26 pm    Post subject: Reply with quote

They are the same. It said 26.2 F in telnet and 26.2 F on IRC but it is more like 26.2 C here (or it was this morning).
Back to top
View user's profile Send private message
SignZ
Voice


Joined: 17 Jun 2010
Posts: 18

PostPosted: Mon May 30, 2016 3:51 pm    Post subject: Reply with quote

Just had the same problem, simply fixed it by changing something in this part:
Code:

if {[info exists html(tempf)] && [info exists html(tempc)]} {
          set input [string map "{%w3%} {${alternate_sep}[ibold "Temperature:"] [i2fac $html(tempf) $html(tempc)]}" $input]
        } else {
          set input [string map "{%w3%} {}" $input]
        }

to:
Code:

if {[info exists html(tempf)] && [info exists html(tempc)]} {
          set input [string map "{%w3%} {${alternate_sep}[ibold "Temperature:"] [i2fac $html(tempc) $html(tempf)]}" $input]
        } else {
          set input [string map "{%w3%} {}" $input]
        }
Back to top
View user's profile Send private message
daffodil
Voice


Joined: 29 May 2016
Posts: 3
Location: Cleveland, Ohio, USA

PostPosted: Mon May 30, 2016 6:19 pm    Post subject: Reply with quote

SignZ,

Tried that but no dice. Got this output:

daffodil !weather 44118
daffy-bot daffodil's weather request; Cleveland, Ohio (41.50445938/-81.54995728); Local Time: 6:16 PM (May 30, 2016); Updated: 17 seconds ago; Conditions: cld; Temperature: -2.8F (26.9C); Feels-like: 27F (-2.8C); High/Low: Unavailable; Humidity: 43%; Wind: East at 0.9 MPH (1.4 KPH)

All it did was swap location of the numbers and while 26.9 C is the real temp at the moment, the F number is WAY off. So it fixed one thing but made the other even more off than it was.

I wonder why current weather doesn't work but forecast is spot on.
Back to top
View user's profile Send private message
caesar
Ass Kicker


Joined: 14 Oct 2001
Posts: 3401
Location: Area 51

PostPosted: Tue May 31, 2016 1:12 am    Post subject: Reply with quote

Actually no. If you want to change from default xxF (xxC) to xxC (xxF) then just change the variable celcius_first to 1.

The culprit for your problem is:
Code:

regexp -nocase {"°(.*?)"} $html - deg

cos the site serves me temperature is in C:
Quote:

<span class="wx-data" data-station="KOHCLEVE26" data-variable="temperature">
<span class="wx-value">17.5</span>
<span class="wx-unit">&deg;C</span>
</span>

but the regexp doesn't match the correct line so you get that error.
Quote:

<bot> [07:06:56] incith:weather-2.9e: <cez/#foo> !weather 44118
<bot> [07:06:58] got temperature 17.5 F

So the best way to fix this is to replace:
Code:

regexp -nocase {"temperature": (.*?),} $html - temp
regexp -nocase {<span class="wx-unit">&deg;(.*?)</span>} $html - deg

with:
Code:

regexp -nocase {data-variable="temperature"><span class="wx-value">(.*?)</span><span class="wx-unit">&deg;(.*?)</span>} $html - temp deg

I honestly don't understand what the author wanted to achieve here:
Code:

      # TEMPERATURE
      if {[regexp -nocase {data-variable="temperature">} $html]} {
      regexp -nocase {"temperature": (.*?),} $html - temp
      regexp -nocase {"&deg;(.*?)"} $html - deg
         putlog "got temperature $temp $deg"
         if {[string match "*F*" $deg)]} {
            set output(tempf) $temp
            set output(tempc) [format "%.${incith::weather::granularity}f" [expr {5.0/9.0*($output(tempf) - 32.0)}]]
            if {[string match *\.* $output(tempc)]} {
          set c [split $output(tempc) .]
      set ot1 [lindex $c 0]
      set ot2 [string trim [lindex $c 1] " 0"]
      if {[string length $ot2]} { set output(tempc) "${ot1}.${ot2}" } { set output(tempc) $ot1 }
          }
        } else {
          set output(tempc) $temp
          set output(tempf) [format "%.${incith::weather::granularity}f" [expr {9.0/5.0*$output(tempc) + 32.0}]]
          if {[string match *\.* $output(tempf)]} {
      set c [split $output(tempf) .]
      set ot1 [lindex $c 0]
      set ot2 [string trim [lindex $c 1] " 0"]
      if {[string length $ot2]} { set output(tempf) "${ot1}.${ot2}" } { set output(tempf) $ot1 }
          }
        }
      }
      if {[info exists output(tempf)]} {
        set templength [string length $output(tempf)]
        if {$templength > 20} {
          putlog "length fubar"
          set output(error) "Something is fubar! :)"
          return [array get output]
        }
      }

but, if the end result was to have xx.xC and xx.xxF then this can be simplified a lot with:
Code:

# TEMPERATURE
if {[regexp -nocase {data-variable="temperature">} $html]} {
   regexp -nocase {"temperature": (.*?),} $html - temp
   regexp -nocase {"&deg;(.*?)"} $html - deg
   putlog "got temperature $temp $deg"

   # temperature is in Fahrenheit
   if {[string equal $deg "C"]} {
      set output(tempf) $temp
      set output(tempc) [format "%.1f" [expr {($temp - 32) / 1.8}]]

      } else {
      # temperature is in Celsius
      set output(tempc) $temp
      set output(tempf) [format "%.2f" [expr {$temp * 1.8 + 32 }]]
      }
   }

and so on with the others (feels like, dew point and so on). The only downside is that I didn't take granularity into consideration, but seems to be a useless variable anyway since I wanted anyway to see xx.xC and xx.xxF.
_________________
You may say anything about me, but don't misspell my name.
Back to top
View user's profile Send private message
SignZ
Voice


Joined: 17 Jun 2010
Posts: 18

PostPosted: Sun Jun 26, 2016 6:10 pm    Post subject: Reply with quote

Really weird things happening..
First (100% related), whenever I try using the script (the modified one by rjpearce), I get a "Failed to connect" error, as can be seen here:
Code:
[00:04:00] <~signz> !w
[00:04:02] <+Trump> Failed to connect.

There's absolutely nothing in my logs though, so I'm not really sure what's happening (or rather not happening).
Secondly (about 50% related to this script and 50% to speechy's twitter script):
Code:
[00:02:26] <~signz> !tweet sorry4spam
[00:02:27] <%Trump>  OAuth failed: (???) protocol not supported ( internal error )
[00:02:31] <~signz> !tweet sorry4spam
[00:02:31] <%Trump>  OAuth failed: (???) protocol not supported ( internal error )
<insert rehash from partyline>
[00:03:11] <~signz> !tweet sorry4spam
[00:03:12] <%Trump>  Tweet created: http://twitter.com/newdsrp ( 747188448499474433@newdsrp - 1s ago via #level )
[00:04:00] <~signz> !w
[00:04:02] <+Trump> Failed to connect.
[00:04:06] <~signz> !tweet sorry4spam!
[00:04:07] <%Trump>  OAuth failed: (???) protocol not supported ( internal error )
[00:04:19] <~signz> .crehash
[00:04:19] -Trump- Rehashing ... -= DONE =-
[00:04:21] <~signz> !tweet sorry4spam!
[00:04:23] <%Trump>  Tweet created: http://twitter.com/newdsrp ( 747188743669485570@newdsrp - 0s ago via #level )

Not only does the weather script not seem to work, it also kinda breaks speechy's twitter script (at least for me, for some reason).
Back to top
View user's profile Send private message
mtnvortest
Voice


Joined: 04 Mar 2016
Posts: 6

PostPosted: Tue Aug 16, 2016 5:27 pm    Post subject: Reply with quote

creasy wrote:
There is also the issue of no results or multiple results found. In the 1st case the bot doesn't respond at all, while in the 2nd instead of a list of possible hits it returns
Code:
High/Low: Unavailable; Wind: Calm

Any ideas on how to fix this?


Sorry, creasy. I'm just now getting back to this. Yes, it turns out that I really am having the same issue with the 'High/Low' field. Unavailable. I'm not sure what I was looking at when I first responded to this. I'm surprised that nobody else mentioned this.
Back to top
View user's profile Send private message
planetb
Voice


Joined: 21 Jan 2011
Posts: 6

PostPosted: Sun May 21, 2017 11:29 am    Post subject: Reply with quote

Looks like the last released version broke sometime recently. I have not done any troubleshooting yet, but maybe this afternoon If I get some time.
Back to top
View user's profile Send private message
simboy1234
Voice


Joined: 16 May 2015
Posts: 5

PostPosted: Tue May 23, 2017 5:22 am    Post subject: Reply with quote

Yes seems to be broken

.[12:17:20] incith:weather-2.9c: <Simboy/#pwn> !weather doha, qatar
[12:17:22] got temperature 37.6 F
[12:17:22] Tcl error [incith::weather::weather_handler]: can't read "cond": no such variable
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases All times are GMT - 4 Hours
Goto page Previous  1, 2, 3 ... , 19, 20, 21  Next
Page 20 of 21

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber