<?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/10783" />

	<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>2005-11-08T20:53:11-04:00</updated>

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

		<entry>
		<author><name><![CDATA[Alchera]]></name></author>
		<updated>2005-11-08T20:53:11-04:00</updated>

		<published>2005-11-08T20:53:11-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=57192#p57192</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=57192#p57192"/>
		<title type="html"><![CDATA[[SOLVED] Determining the time]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=57192#p57192"><![CDATA[
I'm glad at least one person read the sticky topics.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3646">Alchera</a> — Tue Nov 08, 2005 8:53 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[iNFERiON]]></name></author>
		<updated>2005-11-08T12:47:50-04:00</updated>

		<published>2005-11-08T12:47:50-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=57187#p57187</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=57187#p57187"/>
		<title type="html"><![CDATA[[SOLVED] Determining the time]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=57187#p57187"><![CDATA[
<strong class="text-strong"> This problem has been solved on IRC, see the bottom of this post for the final WORKING code.</strong><br><br>I am writing a greet script that will determine the time first and then will respond "Good Morning/Afternoon/Evening/Night" depending on the time.<br><br>I got this code and this works:<br><div class="codebox"><p>Code: </p><pre><code>proc gen_test {nick host handle chan text} {putmsg $chan "Botmaster requested a channel test, nothing to worry about, probably just maintenance ;)"putmsg $nick "Channel report for: $chan"if {[botisop $chan]} {putmsg $nick "I \002\0033AM\003\002 an operator on $chan"} else {putmsg $nick "I \002\0034AM NOT\003\002 an operator on $chan"}set timetest [clock format [clock seconds] -format "%H:%M"]putmsg $nick "The time is: $timetest"}</code></pre></div>This sends me the time in a PM. The time shown is correct. However, when I want the bot to say hi upon someone joining, I got this code:<br><div class="codebox"><p>Code: </p><pre><code>bind join - * gen_greetbind pub - "hi Bot" gen_greet(...)proc gen_greet {nick host handle chan text} {set time [clock format [clock seconds] -format "%H:%M"]if {$time &gt;= 00:00 AND &lt; 06:00} {putmsg $chan "Goedenacht $nick"} elseif {$time &gt;= 06:00 AND &lt; 12:00} {putmsg $chan "Goedemorgen $nick"} elseif {$time &gt;= 12:00 AND &lt; 18:00} {putmsg $chan "Goedemiddag $nick"} elseif {$time &gt;= 18:00 AND &lt; 00:00} {putmsg $chan "Goedeavond $nick"} else {putmsg $chan "Hallo $nick"}}</code></pre></div>Whenever someone joins the channel or types "hi bot" the bot says nothing. I get this from the console:<br><div class="codebox"><p>Code: </p><pre><code>[17:46] Tcl error [gen_greet]: syntax error in expression "$time &gt;= 00:00 AND &lt; 06:00": extra tokens at end of expression</code></pre></div>What am I doing wrong ?<br><br>---<br><br>Edit: After some help on the IRC Channel, the code is now this, but it just spits out the else { message "Hello $nick"...<br><div class="codebox"><p>Code: </p><pre><code>set time [clock format [clock seconds] -format "%H"]if {$time &lt; 06} {putmsg $chan "Good night $nick"} elseif {$time &lt; 12} {putmsg $chan "Good morning $nick"} elseif {$time &lt; 18} {putmsg $chan "Good afternoon $nick"} elseif {$time &gt; 18} {putmsg $chan "Good evening $nick"} else {putmsg $chan "Hello $nick"}</code></pre></div>----<br><br>Last edit: Problem has been solved, this is the final <strong class="text-strong">WORKING</strong> code:<br><div class="codebox"><p>Code: </p><pre><code>bind join - * gen_greet(...)proc gen_greet {nick host handle chan} {# Store the current hour (e.g. at 17:15, the hour is 17) as $timeset time [clock format [clock seconds] -format "%H"]# If it's earlier then 06:00, greet with good nightif {$time &lt; 06} {putmsg $chan "Good night $nick"# If it is somewhere in 11:00 or earlier, greet with good morning} elseif {$time &lt;= 11} {putmsg $chan "Good morning $nick"# If it is somewhere in 17:00 or earlier, greet with good afternoon} elseif {$time &lt;= 17} {putmsg $chan "Good afternoon $nick"# If it is 18:00 or later, greet with good evening} elseif {$time &gt;= 18} {putmsg $chan "Good evening $nick"# If for some reason unable to determine time, greet with a general hello.} else {putmsg $chan "Hello $nick, welcome to $chan"}}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5656">iNFERiON</a> — Tue Nov 08, 2005 12:47 pm</p><hr />
]]></content>
	</entry>
	</feed>
