<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/21101" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2022-02-21T18:55:06-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/21101</id>

		<entry>
		<author><name><![CDATA[SpiKe^^]]></name></author>
		<updated>2022-02-21T18:55:06-04:00</updated>

		<published>2022-02-21T18:55:06-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=110935#p110935</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=110935#p110935"/>
		<title type="html"><![CDATA[Pasted code looks fine.]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=110935#p110935"><![CDATA[
Maybe this is the code it's bitching about:<div class="codebox"><p>Code: </p><pre><code>?[http::formatQuery unitGroup metric key $::Visualcrossing::key]</code></pre></div>...but to me that chunk seems ok, though I might call http::formatQuery more correctly<div class="codebox"><p>Code: </p><pre><code>?[::http::formatQuery unitGroup metric key $::Visualcrossing::key]</code></pre></div>It does fit the syntax from the manual<blockquote class="uncited"><div>::http::formatQuery key value ?key value ...?</div></blockquote>as it seems to have an equal number of keys and values.<br><br><br><br>If that doesn't work, try:<div class="codebox"><p>Code: </p><pre><code>set forecast_data [::Visualcrossing::download_weather https://weather.visualcrossing.com/VisualCrossingWebServices/rest/services/timeline/${arg}/next3days?unitGroup=metric&amp;key=$::Visualcrossing::key]</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7749">SpiKe^^</a> — Mon Feb 21, 2022 6:55 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[CrazyCat]]></name></author>
		<updated>2022-02-21T18:44:28-04:00</updated>

		<published>2022-02-21T18:44:28-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=110934#p110934</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=110934#p110934"/>
		<title type="html"><![CDATA[Sun and Moon script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=110934#p110934"><![CDATA[
When error occures, use .set errorInfo to let us know if the trouble is with formatQuery or with json2dict.<br>I guess it's json2dict, so dump forecast_data then we can understand the trouble<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=691">CrazyCat</a> — Mon Feb 21, 2022 6:44 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[bayo]]></name></author>
		<updated>2022-02-21T16:43:18-04:00</updated>

		<published>2022-02-21T16:43:18-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=110933#p110933</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=110933#p110933"/>
		<title type="html"><![CDATA[Sun and Moon script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=110933#p110933"><![CDATA[
Hi. It doesn't work. Says<br><br>Tcl error [::Visualcrossing::forecast_weather]: missing value to go with key<br><div class="codebox"><p>Code: </p><pre><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" }</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12958">bayo</a> — Mon Feb 21, 2022 4:43 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[SpiKe^^]]></name></author>
		<updated>2022-02-20T14:51:17-04:00</updated>

		<published>2022-02-20T14:51:17-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=110932#p110932</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=110932#p110932"/>
		<title type="html"><![CDATA[Sun and Moon script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=110932#p110932"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>https://weather.visualcrossing.com/VisualCrossingWebServices/rest/services/timeline/${arg}/next5days?key=YOUR_API_KEY</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7749">SpiKe^^</a> — Sun Feb 20, 2022 2:51 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[bayo]]></name></author>
		<updated>2022-02-20T13:55:41-04:00</updated>

		<published>2022-02-20T13:55:41-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=110931#p110931</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=110931#p110931"/>
		<title type="html"><![CDATA[Sun and Moon script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=110931#p110931"><![CDATA[
So be it. Bear in mind the script is translated and when I release it will be much shorter version. Still Alpha version <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_redface.gif" width="15" height="15" alt=":oops:" title="Embarassed"> <br><div class="codebox"><p>Code: </p><pre><code>####################################### @UniBG irc.chatpat.bg ## @FreeUniBG irc.interbg.org  ## Credits: MeMoreX &amp; SpiKe^^ ## Est: 01\2022 #######################################namespace eval Visualcrossing {### Requirementspackage require jsonpackage require tlspackage require http### Bindingbind PUB -|- !g ::Visualcrossing::group_weatherbind PUB -|- !w ::Visualcrossing::pub_weather  ### The API Keysset appid "Openweather api website"set apiKey "ipgeoinfo website"set key "visualcrossing website"}### Procedures start hereproc ::Visualcrossing::download_weather {url} {    ::http::register https 443 [list ::tls::socket -tls1 1]::http::config -useragent "Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)"set socket [http::geturl $url -timeout 5000]set items_data [http::data $socket]if {[http::status $socket] ne "ok" || [http::ncode $socket] != 200} {set code [http::code $socket]putlog "\00304***\003 Weather HTTP error: $code"putlog "\00304***\003 Request url is: $url"http::cleanup $socketreturn 0    }http::cleanup $socketreturn $items_data}### The Main Procproc ::Visualcrossing::pub_weather {nick uhost hand chan arg} {set items_data [::Visualcrossing::download_weather https://weather.visualcrossing.com/VisualCrossingWebServices/rest/services/weatherdata/forecast?[::http::formatQuery location $arg aggregateHours 24 forecastdays 3 includeAstronomy true locationMode lookup unitGroup metric shortColumnNames false contentType json alertLevel event lang en nonulls true key $::Visualcrossing::key]]if {$arg == ""} { putserv "PRIVMSG $chan :Правилно: !w града/локацията" ; return }### The Main Dictset connect[::json::json2dict $items_data]### The First Stack set locations [dict get $connect locations]set cityname [lindex $locations 0]set citydata [lindex $locations 1]set tz [dict get $citydata tz]set long [dict get $citydata longitude]set lat [dict get $citydata latitude]### The Second Stackset current [dict get $citydata currentConditions]if {$current != "null"} { set conditions $current }if {$current == "null" || $current == "" || $current == " "} { set currCond "Няма информация. Моля опитайте по-късно." } else { set currCond $current }set wdir [join [::Visualcrossing::deg_to_dir [dict get $current wdir]]]set wspd [dict get $current wspd]if {$wdir == "null" || $wdir == "" || $wdir == " "} { set windir "Няма информация. Моля опитайте по-късно." } else { set windir $wdir }if {$wspd == "null" || $wspd == "" || $wspd == " "} { set wspeed "Нe се усеща" } else { set wspeed [expr round($wspd)]км/ч}if {$wspd != "null"} {set wspd [expr round($wspd)]} set wgust [dict get $current wgust]if {$wgust == "null" || $wgust == "" || $wgust == " "} { set wgustmsg "Нe се усеща" } else { set wgustmsg [expr round($wgust)]км/ч}if {$wgust != "null"} {set wgust [expr round($wgust)]}set temp [dict get $current temp]set temp [expr round($temp)]### The Third Stackset values [dict get $citydata values]set alert [dict get [lindex $values 0] alerts]if {$alert == "null"} { set alertmsg "Няма!" } else { set alertmsg $alert }set mint [dict get [lindex $values 0] mint]set mint [expr round($mint)]set maxt [dict get [lindex $values 0] maxt]set maxt [expr round($maxt)]set humi [dict get [lindex $values 0] humidity]set humi [expr round($humi)]set cond [dict get [lindex $values 0] conditions]if {$cond == "Rain, Overcast"} {set condmsg "\u2614 Дъжд"}elseif {$cond == "Snow"} { set condmsg "\u2744 Сняг"}elseif {$cond == "Rain, Partially cloudy"} { set condmsg "Дъжд, превалява на моменти" }elseif {$cond == "Snow, Overcast"} { set condmsg "Сняг, сиво, мрачно"}elseif {$cond == "Overcast"} { set condmsg "Облачно, сиво, мрачно"}elseif {$cond == "Clear"} { set condmsg "Ясно"}elseif {$cond == "Partially cloudy"} { set condmsg "Частична облачност"} else { set condmsg $cond }set cloud [dict get [lindex $values 0] cloudcover]### The Fourth Stackset sun_moon_data [::Visualcrossing::download_weather https://api.ipgeolocation.io/astronomy?[http::formatQuery apiKey $::Visualcrossing::apiKey location $arg]]if {$sun_moon_data == 0} { return }set sunmoon_dict [::json::json2dict $sun_moon_data]set sunrise [dict get $sunmoon_dict sunrise]set sunset [dict get $sunmoon_dict sunset]set current_time [string range [dict get $sunmoon_dict current_time] 0 4]if {$current_time &gt; $sunset} { set currtime "Нощ" } { set currtime "Ден" }if {$cloud &lt; 10} {if {$currtime eq "Ден"} { set sky "Слънчево" } else { set sky "Ясно" }} elseif {$cloud &lt; 20} {if {$currtime eq "Ден"} { set sky "Приятно" } else { set sky "Меко" }} elseif {$cloud &lt; 30} {if {$currtime eq "Ден"} { set sky "Предимно слънчево" } else { set sky "Предимно ясно" }} elseif {$cloud &lt; 60} {if {$currtime eq "Ден"} { set sky "\u26c5 Слънчево на моменти" } else { set sky "Облачно на моменти" }} elseif {$cloud &lt; 90} { set sky "Предимно облачно" } else { set sky "Облачно" }#putlog "Day\Night -&gt; $currtime | CloudCover% -&gt; $cloud | Conditions -&gt; $cond | Sunset time: $sunset and Current time is $current_time ?"### The Fifth Stackset weather_data [::Visualcrossing::download_weather https://api.openweathermap.org/data/2.5/weather?[http::formatQuery q $arg appid $::Visualcrossing::appid lang bg units metric]]if {$weather_data == 0} { return }set weather_dict [::json::json2dict $weather_data]set city [dict get $weather_dict name]set country [join [dict get $weather_dict sys country]]putserv "PRIVMSG $chan :\00307\002$city, $country\003\002 \00314в момента: \00307$condmsg\003  \002\00307$temp°C\002\003 \00314Влажност \00307$humi\%\003 \00314Вятър\003 \00307$wspeed \00314от \00307$wdir\003 \00314Скорост на поривите\003 \00307$wgustmsg\003 \00314Облачна покривка\003 \00307$sky\003 \00314Утре: Мин/Макс (\003\00307↓$mint\°C\003\00314/\00307↑$maxt\C°\003\00314)\003"putserv "PRIVMSG $chan :\00314Сигнали за опасност:\003 \00304$alertmsg\003"set alerts [dict get $citydata alerts]if {$alerts != "null"} { set alert $alerts }set head [dict get [lindex $alerts 0] headline]set onsetEpoch [dict get [lindex $alerts 0] onsetEpoch]set endsEpoch [dict get [lindex $alerts 0] endsEpoch]set ondate [clock format $onsetEpoch -format "%a, %e %b %Y %H:%M"]set offdate [clock format $endsEpoch -format "%a, %e %b %Y %H:%M"]putserv "PRIVMSG $chan :\[\00304!\003\00314Опасност\00304!\003]\ \00304$head \003\[\00314FROM:\003]\00304 $ondate \003\[\00314TO:\003]\00304 $offdate\003"}### The Second proc for the group cities by IDproc ::Visualcrossing::group_weather {nick uhost hand chan arg} {set group_data [::Visualcrossing::download_weather https://api.openweathermap.org/data/2.5/group?[http::formatQuery id 727447,726051,727011,2643743,7839805 appid $::Visualcrossing::appid lang bg units metric]]if {$group_data == 0} { return }set group_dict [::json::json2dict $group_data]set cities [dict get $group_dict list]set cities_info ""foreach city $cities { set temp [dict get $city main temp]set temp [expr round($temp)]if {$temp &gt;=0} {set temp "$temp"}set name [dict get $city name]set des [dict get [lindex [dict get $city weather] 0] description]lappend cities_info "\00307$name \00304$temp°C\003 /\00314$des\003/" }putserv "PRIVMSG $chan :\00314Времето в момента:\003 [join $cities_info " "]" }### Calculates the degrees from the API and converts them to words expresion like the string below### Attached to the Second Stack of the Main proc proc ::Visualcrossing::deg_to_dir {value} {set calc [expr ($value / 22.5) + 0.5]set dirs "Север Север-Североизток Североизток Изток-Североизток Изток Изток-Югоизток Югоизток Юг-Югоизток Юг Юг-Югозапад Югозапад Запад-Югозапад Запад Запад-Северозапад Северозапад Север-Североизток"return [lindex $dirs [expr int($calc) % 16]]}### Sets the crontab expresion like the string belowproc ::Visualcrossing::auto_say {min hour day month week} {::Visualcrossing::group_weather "-" "-" "-" "#Forbidden"}### Timer for making the weather posted in a channel, depends on the preference (refer to https://crontab.guru/)bind cron -|- "0 */6 * * *" ::Visualcrossing::auto_say### The Third Proc for 3 days Forecast #proc ::Visualcrossing::forecast_weather {nick uhost hand chan arg} {#set group_data [::Visualcrossing::download_weather https://weather.visualcrossing.com/VisualCrossingWebServices/rest/services/timeline/#namespace eval SunMoon {### Requirements package require jsonpackage require httppackage require tlspackage require Trf### Binding bind PUB - !a ::SunMoon::pub_sun_moon### The API Keys set appid "a12c83435763f3cc1342eecb4de4d48e"set apiKey "388be6b288bd45b8966c90dcf40517b0"set key "Z3UDHRSCXQHNDZRQXT2PDDGW4"### The Main Astro Proc proc ::SunMoon::download_data {url} {::http::register https 443 [list ::tls::socket -tls1 1]::http::config -useragent "Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)"set sun_moon [http::geturl $url -timeout 5000]set sun_moon_data [http::data $sun_moon]if {[http::status $sun_moon] ne "ok" || [http::ncode $sun_moon] != 200} {set code [http::code $sun_moon]putlog "\00304***\003 SunMoon HTTP error: $code"putlog "\00304***\003 Requested url is: $url"http::cleanup $sun_moonreturn 0}http::cleanup $sun_moon  return $sun_moon_data}proc ::SunMoon::pub_sun_moon {nick uhost hand chan arg} {if {$arg == ""} { putserv "PRIVMSG $chan :Правилно: !a &lt;Град/Локация&gt;" ; return }set sun_moon_data [::SunMoon::download_data https://api.ipgeolocation.io/astronomy?[http::formatQuery apiKey $::SunMoon::apiKey location $arg]]if {$sun_moon_data == 0} { return }set sunmoon_dict [::json::json2dict $sun_moon_data]set current_time [string range [dict get $sunmoon_dict current_time] 0 4]set sunrise [dict get $sunmoon_dict sunrise]set sunset [dict get $sunmoon_dict sunset]set daylength [dict get $sunmoon_dict day_length]set moonrise [dict get $sunmoon_dict moonrise]set moonset [dict get $sunmoon_dict moonset]set moon_status [dict get $sunmoon_dict moon_status]if {$current_time &lt; $sunset} { set currtime "Ден" } { set currtime "Вечер" }set items_data [::SunMoon::download_data https://weather.visualcrossing.com/VisualCrossingWebServices/rest/services/weatherdata/forecast?[::http::formatQuery location $arg aggregateHours 24 forecastDays 3 includeAstronomy true locationMode lookup unitGroup metric shortColumnNames false contentType json alertLevel event lang en nonulls true key $::SunMoon::key]]### The Main Astro Dictset connect[::json::json2dict $items_data]###The First Astro Stack set locations [dict get $connect locations]set cityname [lindex $locations 0]set citydata [lindex $locations 1]set tz [dict get $citydata tz]## The Second Astro Stackset current [dict get $citydata currentConditions]set moon [dict get $current moonphase]if {$moon==0 || $moon== 1} {  set phase "Новолуние"} elseif {$moon&lt;0.25} {  set phase "Изгряващ полумесец"} elseif {$moon==0.25} {  set phase "Първа четвърт"} elseif {$moon&lt;0.5} {  set phase "Растяща луна"} elseif {$moon==0.5} {  set phase "Пълнолуние"} elseif {$moon&lt;0.75} {  set phase "Намаляваща луна"} elseif {$moon==0.75} {  set phase "Последна четвърт"} elseif {$moon&lt;1} {  set phase "Залязващ полумесец"} else {  set phase "Грешка. Опитайте пак."}### The Third Astro Stackset values [dict get $citydata values]set uv [dict get [lindex $values 0] uvindex]if {$uv==0} {set index "Нисък"}elseif {$uv&lt;5 || $uv==6}  {set index "Умерен"}elseif {$uv&lt;7 || $uv==8}  {set index "Висок"}elseif {$uv&lt;9 || $uv==10} {set index "Много висок"}elseif {$uv&gt;11} {set index "Екстремен"}else {set index "Грешка. Няма данни."}set radiation [dict get [lindex $values 0] solarradiation]set energy [dict get [lindex $values 0] solarenergy]### The Fourth Astro Stackset weather_data [::SunMoon::download_data https://api.openweathermap.org/data/2.5/weather?[http::formatQuery q $arg appid $::SunMoon::appid lang bg units metric]]if {$weather_data == 0} { return }set weather_dict [::json::json2dict $weather_data]set city [dict get $weather_dict name]set country [join [dict get $weather_dict sys country]]putserv "PRIVMSG $chan :\002\00314 ---=== Астрономическа информация ===---\003\002"putserv "PRIVMSG $chan :\00314Часът в \00307\002$city, $country\003\002 \00314е \00307$current_time\ч.\003 \00314Часова зона\003 \00307$tz ($currtime) \003\00314Продължителност на деня\003 \00304$daylength\ч."putserv "PRIVMSG $chan :\00314Слънцето: \00307Изгрев в\003 \00304$sunrise\ч\003 \00314и\003 \00307Залез в\003 \00304$sunset\ч.\003 \00307УВ индекс: \00304$index\003 ☀️ \00314радиация \00304$radiation\W/m2\003 ☀️\u26a1 \00314енергия \00304$energy\kWh/m2\003"putserv "PRIVMSG $chan :\00314Луната: \00307Ще изгрее в\003 \00304$moonrise\ч\003 \00314и\003 \00307ще залезе в\003 \00304$moonset\ч.\00307 Лунна фаза: \00304$phase\003"}}### Lastly, help section on NOTICE for a bit more information### Bindingbind pub -|- !weather pub:helpproc pub:help {nick uhost hand chan text} {global botnickset text [cleanarg $text]if {[llength $text]&lt;1} {putserv "NOTICE $nick :----------==========\002Weather Commands\002==========--------------"putserv "NOTICE $nick :!w града/локация - показва времето в момента."putserv "NOTICE $nick :!a града/локация - показва астрономическа информация"putserv "NOTICE $nick :!3 града/локация показва времето за три дни напред."putserv "NOTICE $nick :!g - показва информация за предварително зададени градове в една група"}}putlog "The complete Weather Tcl ...Loaded"</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12958">bayo</a> — Sun Feb 20, 2022 1:55 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[SpiKe^^]]></name></author>
		<updated>2022-02-20T12:42:48-04:00</updated>

		<published>2022-02-20T12:42:48-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=110930#p110930</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=110930#p110930"/>
		<title type="html"><![CDATA[Try to be more helpful to the helpers]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=110930#p110930"><![CDATA[
Sure would be easier to help with a script if you posted that entire script?!<br><br>Guessing at context and variable names is challenging for others.<br><br>Every API is different, you can't just copy and reuse that ?[::http::formatQuery string from your earlier api query and expect it to work with this new API.<br><br>According to the new api docs...<br><a href="https://weather.visualcrossing.com/VisualCrossingWebServices/rest/services/timeline/London,UK/next5days?unitGroup=us&amp;key=YOUR_API_KEY" class="postlink">https://weather.visualcrossing.com/Visu ... UR_API_KEY</a><br><br>Try replacing "London,UK" with the variable that contains your location info???<br><br>AGAIN, post the script here for more context correct help...<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7749">SpiKe^^</a> — Sun Feb 20, 2022 12:42 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[bayo]]></name></author>
		<updated>2022-02-20T09:13:01-04:00</updated>

		<published>2022-02-20T09:13:01-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=110929#p110929</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=110929#p110929"/>
		<title type="html"><![CDATA[Sun and Moon script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=110929#p110929"><![CDATA[
Hello all, I'm trying to figure out how to create the API so I can replace (in this case LONDON,UK) with any location by search. The API link at the bottom:<br><br>I was thinking to do something like that:<br><br><a href="https://weather.visualcrossing.com/VisualCrossingWebServices/rest/services/timeline" class="postlink">https://weather.visualcrossing.com/Visu ... s/timeline</a>?[::http::formatQuery location $arg next5days $systemTime key $apikey]<br><br>where $arg is is the searched location, $systemTime is the local machine time and the key is the $apikey.<br><div class="codebox"><p>Code: </p><pre><code>https://weather.visualcrossing.com/VisualCrossingWebServices/rest/services/timeline/London,UK/next5days?key=YOUR_API_KEY</code></pre></div><br>Thank you in advance  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_biggrin.gif" width="15" height="15" alt=":D" title="Very Happy"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12958">bayo</a> — Sun Feb 20, 2022 9:13 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[bayo]]></name></author>
		<updated>2022-02-14T17:57:57-04:00</updated>

		<published>2022-02-14T17:57:57-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=110928#p110928</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=110928#p110928"/>
		<title type="html"><![CDATA[Sun and Moon script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=110928#p110928"><![CDATA[
Thank you, SpiKe^^ I promice when I finish it to post it in the forum. Thanks.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12958">bayo</a> — Mon Feb 14, 2022 5:57 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[SpiKe^^]]></name></author>
		<updated>2022-02-14T17:17:26-04:00</updated>

		<published>2022-02-14T17:17:26-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=110927#p110927</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=110927#p110927"/>
		<title type="html"><![CDATA[Basic if/elseif/else logic...]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=110927#p110927"><![CDATA[
You didn't bother to "Post the entire code you are currently running."<br>But here is some basic if/elseif/else logic and layout again...<br><div class="codebox"><p>Code: </p><pre><code>if {$cloudcover &lt; 10} {  if {$currtime eq "Day"} {  set sky "Sunny"  } else {  set sky "Clear"  }} elseif {$cloudcover &lt; 20} {  if {$currtime eq "Day"} {  set sky "Sunny to Mostly Sunny"  } else {  set sky "Fair"  }} elseif {$cloudcover &lt; 30} {  if {$currtime eq "Day"} {  set sky "Mostly Sunny"  } else {  set sky "Mostly Fair"  }} elseif {$cloudcover &lt; 60} {  if {$currtime eq "Day"} {  set sky "Partly Sunny"  } else {  set sky "Partly Cloudy"  }} elseif {$cloudcover &lt; 90} {  set sky "Mostly Cloudy"} else {  set sky "Cloudy"  }</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7749">SpiKe^^</a> — Mon Feb 14, 2022 5:17 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[bayo]]></name></author>
		<updated>2022-02-14T15:15:26-04:00</updated>

		<published>2022-02-14T15:15:26-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=110926#p110926</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=110926#p110926"/>
		<title type="html"><![CDATA[Sun and Moon script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=110926#p110926"><![CDATA[
Well, this is it, not much different of what I posted earlier:<br><br>I'm trying to identify from the "sunset" if it's day or night. Then based on this, I'm trying to make the bot tell me the cloudcover info from the api (returns in percents) and post this: <a href="https://ibb.co/xJTTDBK" class="postlink">https://ibb.co/xJTTDBK</a><br><br>If it's Day -&gt; The text from the column for the Day<br>If it's Night -&gt; The text from the column for the Night<br>Cloudcover from the api shows (example) - 74.1 <br>Info from Api Docs: cloudcover – how much of the sky is covered in cloud ranging from 0-100%<br><div class="codebox"><p>Code: </p><pre><code>### The Fourth Stackset sun_moon_data [::Visualcrossing::download_weather https://api.ipgeolocation.io/astronomy?[http::formatQuery apiKey $::Visualcrossing::apikey location $arg]]if {$sun_moon_data == 0} { return }set sunmoon_dict [::json::json2dict $sun_moon_data]set current_time [string range [dict get $sunmoon_dict current_time] 0 4]set sunset [dict get $sunmoon_dict sunset]set sunrise [dict get $sunmoon_dict sunrise]if {$current_time &lt;= $sunset} { set currtime "Day" } else { set currtime "Night" } </code></pre></div>Hope this helps  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_neutral.gif" width="15" height="15" alt=":|" title="Neutral"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12958">bayo</a> — Mon Feb 14, 2022 3:15 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[SpiKe^^]]></name></author>
		<updated>2022-02-14T13:11:10-04:00</updated>

		<published>2022-02-14T13:11:10-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=110925#p110925</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=110925#p110925"/>
		<title type="html"><![CDATA[Post the code]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=110925#p110925"><![CDATA[
Post the entire code you are currently running.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7749">SpiKe^^</a> — Mon Feb 14, 2022 1:11 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[bayo]]></name></author>
		<updated>2022-02-14T13:07:27-04:00</updated>

		<published>2022-02-14T13:07:27-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=110924#p110924</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=110924#p110924"/>
		<title type="html"><![CDATA[Sun and Moon script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=110924#p110924"><![CDATA[
Hello again. Can someone explain this to me please?  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_lol.gif" width="15" height="15" alt=":lol:" title="Laughing"> <br><br>[16:58] &lt;BAYO&gt; (bin) 39 % set current_time "aa"<br>[16:58] &lt;BAYO&gt; (bin) 40 % set sunset "18:27"<br>[16:58] &lt;BAYO&gt; (bin) 41 % if {$current_time &lt;= $sunset} { set currtime "day" } else { set currtime "night" }<br>[16:58] &lt;BAYO&gt; night<br>[16:58] &lt;BAYO&gt; HOW!?!?!?<br><br> <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_confused.gif" width="15" height="15" alt=":?" title="Confused"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12958">bayo</a> — Mon Feb 14, 2022 1:07 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[CrazyCat]]></name></author>
		<updated>2022-02-09T06:07:12-04:00</updated>

		<published>2022-02-09T06:07:12-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=110884#p110884</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=110884#p110884"/>
		<title type="html"><![CDATA[Sun and Moon script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=110884#p110884"><![CDATA[
You can use a string map to replace days sentences with the night ones:<div class="codebox"><p>Code: </p><pre><code>set day2night {"Sunny to Mostly sunny" "Fair" "Mostly sunny" "Mostly fair" "Partly sunny" "Partly cloudy" "Sunny" "Clear"}set night [string map $day2night $day]</code></pre></div>($day is the text for day conditions)<br><br>Note that the order of sentences in day2night is important, because the replacement will be done using this order.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=691">CrazyCat</a> — Wed Feb 09, 2022 6:07 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[bayo]]></name></author>
		<updated>2022-02-08T15:19:10-04:00</updated>

		<published>2022-02-08T15:19:10-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=110881#p110881</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=110881#p110881"/>
		<title type="html"><![CDATA[Sun and Moon script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=110881#p110881"><![CDATA[
Hi again  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_lol.gif" width="15" height="15" alt=":lol:" title="Laughing"> I've been puzzling around something I'm trying to achieve, but don't know where to start from. I'm trying to implement the table below and change the words depending on the type of the day "Day" or "Night"<br><br><a href="https://ibb.co/xJTTDBK" class="postlink">https://ibb.co/xJTTDBK</a><br><br>Where during the <strong class="text-strong">day </strong>if the sky is clear will say "Sunny" but if its <strong class="text-strong">night </strong>will say "Clear"<br><br>So far this is my code but don't know how to continue. Pardon the two dicts. I'm using two different APIs <br><div class="codebox"><p>Code: </p><pre><code>set cloudcover [dict get [lindex $values 0] cloudcover]if {$cloudcover == 0} { set skymsg "Sunny"}elseif {$cloudcover == 10} { set skymsg "Mostly Sunny" }elseif {$cloudcover == 20} { set skymsg "Mostly Sunny Spells"}elseif {$cloudcover &lt; 50} { set skymsg "Partly Sunny"}elseif {$cloudcover &lt; 70} { set skymsg "Mostly Cloudy"}elseif {$cloudcover &lt; 99 || $cloudcover == 100 } { set skymsg "Cloudy"} else { set skymsg $cloudcover}set current_time [string range [dict get $sunmoon_dict current_time] 0 4]if {$current_time &lt;= 18} { set currtime "Day"    } elseif {$current_time &gt; 18} { set currtime "Night"} else { set currtime $current_time}</code></pre></div>Any suggestions?   <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_rolleyes.gif" width="15" height="15" alt=":roll:" title="Rolling Eyes">  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_redface.gif" width="15" height="15" alt=":oops:" title="Embarassed">  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_idea.gif" width="15" height="15" alt=":idea:" title="Idea"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12958">bayo</a> — Tue Feb 08, 2022 3:19 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[bayo]]></name></author>
		<updated>2022-02-02T15:09:52-04:00</updated>

		<published>2022-02-02T15:09:52-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=110850#p110850</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=110850#p110850"/>
		<title type="html"><![CDATA[Sun and Moon script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=110850#p110850"><![CDATA[
It worked. Thanks man!<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12958">bayo</a> — Wed Feb 02, 2022 3:09 pm</p><hr />
]]></content>
	</entry>
	</feed>
