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 

Sun and Moon script
Goto page Previous  1, 2
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
SpiKe^^
Owner


Joined: 12 May 2006
Posts: 792
Location: Tennessee, USA

PostPosted: Sun Feb 20, 2022 2:51 pm    Post subject: Reply with quote

Code:
https://weather.visualcrossing.com/VisualCrossingWebServices/rest/services/timeline/${arg}/next5days?key=YOUR_API_KEY

_________________
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
Back to top
View user's profile Send private message Visit poster's website
bayo
Voice


Joined: 25 Jan 2022
Posts: 13

PostPosted: Mon Feb 21, 2022 4:43 pm    Post subject: Reply with quote

Hi. It doesn't work. Says

Tcl error [::Visualcrossing::forecast_weather]: missing value to go with key

Code:
### The Third Proc for 3 days Forecast
proc ::Visualcrossing::forecast_weather {nick uhost hand chan arg} {
   set forecast_data [::Visualcrossing::download_weather https://weather.visualcrossing.com/VisualCrossingWebServices/rest/services/timeline/${arg}/next3days?[http::formatQuery unitGroup metric key $::Visualcrossing::key]]
   if {$arg == ""} { putserv "PRIVMSG $chan :Sintax: !3 location" ; return }
   set forecast_dict [::json::json2dict $forecast_data]
   
   set desc [dict get $forecast_data description]
   
   putserv "PRIVMSG $chan :TEST $desc"
}
Back to top
View user's profile Send private message
CrazyCat
Revered One


Joined: 13 Jan 2002
Posts: 1032
Location: France

PostPosted: Mon Feb 21, 2022 6:44 pm    Post subject: Reply with quote

When error occures, use .set errorInfo to let us know if the trouble is with formatQuery or with json2dict.
I guess it's json2dict, so dump forecast_data then we can understand the trouble
_________________
https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community.
Back to top
View user's profile Send private message Visit poster's website
SpiKe^^
Owner


Joined: 12 May 2006
Posts: 792
Location: Tennessee, USA

PostPosted: Mon Feb 21, 2022 6:55 pm    Post subject: Pasted code looks fine. Reply with quote

Maybe this is the code it's bitching about:
Code:
?[http::formatQuery unitGroup metric key $::Visualcrossing::key]


...but to me that chunk seems ok, though I might call http::formatQuery more correctly
Code:
?[::http::formatQuery unitGroup metric key $::Visualcrossing::key]

It does fit the syntax from the manual
Quote:
::http::formatQuery key value ?key value ...?
as it seems to have an equal number of keys and values.



If that doesn't work, try:
Code:
set forecast_data [::Visualcrossing::download_weather https://weather.visualcrossing.com/VisualCrossingWebServices/rest/services/timeline/${arg}/next3days?unitGroup=metric&key=$::Visualcrossing::key]

_________________
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Goto page Previous  1, 2
Page 2 of 2

 
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