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

	<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>2010-12-27T01:08:29-04:00</updated>

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

		<entry>
		<author><name><![CDATA[adi2247]]></name></author>
		<updated>2010-12-27T01:08:29-04:00</updated>

		<published>2010-12-27T01:08:29-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=95490#p95490</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=95490#p95490"/>
		<title type="html"><![CDATA[Re: Run a proc between specific times/days]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=95490#p95490"><![CDATA[
strftime seems to be working great for the most part. Sometimes i have to restart the bot completely vs a .rehash but that may or may not be related to the code below, and more related to numerous mysql connections, not sure yet. But if anyone sees anything glaringly wrong w the below please let me know<br><br>the two instances im using for this are:<br><div class="codebox"><p>Code: </p><pre><code>if { [strftime %u] &gt;= 1 &amp;&amp; [strftime %u] &lt;= 6 &amp;&amp; [strftime %H%M] &gt;= 930 &amp;&amp; [strftime %H%M] &lt;= 1700 &amp;&amp;    [scan $min %d] % 5 == 0} {</code></pre></div>and<br><div class="codebox"><p>Code: </p><pre><code>if { [strftime %u] == 7 &amp;&amp; [strftime %H] &gt;= 18 &amp;&amp; [scan $min %d] % 15 == 0 ||     [strftime %u] &gt;= 1 &amp;&amp; [strftime %u] &lt;= 5 &amp;&amp; [scan $min %d] % 15 == 0} {</code></pre></div>also what nml375 posted that strftime %H before noon will report back "01" or "02" for example vs just "1" or "2". However if you try to evaluate:<br><br>if { [strftime %H] &gt;= 08 }<br><br>the bot will error and say this looks like an octal number just as nml375 mentioned.<br><br>** and i just realized that the first block of code i posted was NOT running before 10am today so the times will HAVE to be evaluated in the manner that nml375 posted as tcl/eggdrop aparently does not view 01 to == 1<br>thats a good finding<br><br>but the cron method if probably the the best way to run this proc m-f and ill look at the times seperately as mentioned in his post for simplicity<br><br>the second block of code i posted works fine since it only evaluates the hour if its greater than 2 digits anyway. cron may not work for this because it needs to look at different times if its a sunday<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11437">adi2247</a> — Mon Dec 27, 2010 1:08 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[adi2247]]></name></author>
		<updated>2010-12-23T15:15:22-04:00</updated>

		<published>2010-12-23T15:15:22-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=95451#p95451</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=95451#p95451"/>
		<title type="html"><![CDATA[Run a proc between specific times/days]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=95451#p95451"><![CDATA[
ty all for the sugestions! i will try some of these and report back!<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11437">adi2247</a> — Thu Dec 23, 2010 3:15 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[pseudo]]></name></author>
		<updated>2010-12-22T16:40:04-04:00</updated>

		<published>2010-12-22T16:40:04-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=95448#p95448</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=95448#p95448"/>
		<title type="html"><![CDATA[Run a proc between specific times/days]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=95448#p95448"><![CDATA[
Yeah, this was a mistake indeed. It's fixed in 1.8 cvs: <a href="http://cvs.eggheads.org/viewvc/eggdrop1.8/doc/html/tcl-commands.html?r1=1.2&amp;r2=1.3" class="postlink">http://cvs.eggheads.org/viewvc/eggdrop1 ... 1.2&amp;r2=1.3</a><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10974">pseudo</a> — Wed Dec 22, 2010 4:40 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2010-12-22T14:25:04-04:00</updated>

		<published>2010-12-22T14:25:04-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=95445#p95445</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=95445#p95445"/>
		<title type="html"><![CDATA[Run a proc between specific times/days]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=95445#p95445"><![CDATA[
username:<br>If you instead open the tcl-commands.doc that's included with the source, you'll read &lt;weekday&gt; instead of &lt;year&gt;, so it's my best guess they've made a typo with the html-docs.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Wed Dec 22, 2010 2:25 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[username]]></name></author>
		<updated>2010-12-22T04:28:56-04:00</updated>

		<published>2010-12-22T04:28:56-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=95441#p95441</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=95441#p95441"/>
		<title type="html"><![CDATA[Run a proc between specific times/days]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=95441#p95441"><![CDATA[
nml375, but in <a href="http://www.eggheads.org/support/egghtml/1.6.20/tcl-commands.html#binda" class="postlink">http://www.eggheads.org/support/egghtml ... html#binda</a> there is other arguments.<br><br><strong class="text-strong">bind cron &lt;flags&gt; &lt;mask&gt; &lt;proc&gt;<br>proc-name &lt;minute&gt; &lt;hour&gt; &lt;day&gt; &lt;weekday&gt; &lt;year&gt;</strong><br><br>And in bind description I read: <blockquote class="uncited"><div>...It can contain up to five fields: minute, hour, day, month, weekday; delimited by whitespace....</div></blockquote>So, this is mistake in this line <strong class="text-strong">proc-name &lt;minute&gt; &lt;hour&gt; &lt;day&gt; &lt;weekday&gt; &lt;year&gt;</strong>?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6813">username</a> — Wed Dec 22, 2010 4:28 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2010-12-21T15:45:44-04:00</updated>

		<published>2010-12-21T15:45:44-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=95434#p95434</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=95434#p95434"/>
		<title type="html"><![CDATA[Run a proc between specific times/days]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=95434#p95434"><![CDATA[
If you've got the 1.6.20 version of eggdrop, then you could use the new "CRON" binding rather than the "TIME" binding. In that case, the code would look like this:<div class="codebox"><p>Code: </p><pre><code>bind cron - {*/5 * * * 1-5} timerproc timer {minute hour day month weekday} {  #code goes here}</code></pre></div>If you'd rather use the "TIME" binding, and parse the various arguments passed to the proc as integers, you'll have to remember that single-digit numbers are zero-prefixed, causing 08 and 09 to be treated as invalid octal numbers. This is fairly easy to solve though, using something like this:<div class="codebox"><p>Code: </p><pre><code>bind time - * someproc {min hour day month year} {  set min [string trimleft $min 0]  set hour [string trimleft $hour 0]  if {$min % 5 == 0 &amp;&amp; $hour &gt;= 9 &amp;&amp; $hour &lt;= 17} {...</code></pre></div>This won't solve the issue of weekdays though, so you'll have to resort to strftime for this, as suggested by willyw<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Tue Dec 21, 2010 3:45 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[willyw]]></name></author>
		<updated>2010-12-21T13:08:29-04:00</updated>

		<published>2010-12-21T13:08:29-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=95433#p95433</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=95433#p95433"/>
		<title type="html"><![CDATA[Re: Run a proc between specific times/days]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=95433#p95433"><![CDATA[
<blockquote class="uncited"><div>...<br> im not sure how to equate day of the week to a numeric value to check against either. <br></div></blockquote><br>How about    strftime   ?<br>Try  strftime %u<br><br>Ref: <br><a href="http://www.eggheads.org/support/egghtml/1.6.20/tcl-commands.html" class="postlink">http://www.eggheads.org/support/egghtml ... mands.html</a><br>and find   strftime<br><br>Also:<br><a href="http://linux.about.com/library/cmd/blcmdl3_strftime.htm" class="postlink">http://linux.about.com/library/cmd/blcmdl3_strftime.htm</a><br><br><br>Is the .tcl command enabled on your bot?   If so, you can do some quick experiments with the strftime command.<br>Example:<div class="codebox"><p>Code: </p><pre><code>&lt;mynick&gt; .tcl strftime %u&lt;botnick&gt; Tcl: 2</code></pre></div>(Today is Tuesday, and with strftime Monday =1)<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10420">willyw</a> — Tue Dec 21, 2010 1:08 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[adi2247]]></name></author>
		<updated>2010-12-21T05:41:12-04:00</updated>

		<published>2010-12-21T05:41:12-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=95432#p95432</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=95432#p95432"/>
		<title type="html"><![CDATA[Run a proc between specific times/days]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=95432#p95432"><![CDATA[
currently i have a proc similar to this:<br><div class="codebox"><p>Code: </p><pre><code>proc timer {min args} {  if {[scan $min %d] % 5 == 0} {   #Code goes here    } } </code></pre></div>which runs a proc every 5 min, but i would also like to have it check to see if the system time is between 9am-5pm mon-fri before running. <br><br>i think it may be somthing similar to <div class="codebox"><p>Code: </p><pre><code>proc timer {min args} { set systemTime [clock seconds] if { [clock format $systemTime -format %H] &gt;= 9 &amp;&amp; [clock format $systemTime -format %H] &lt;= 17 &amp;&amp; [scan $min %d] % 5 == 0} {   #code goes here    } } </code></pre></div>which i would think would work but doesnt seem to be, inaddition im not sure how to equate day of the week to a numeric value to check against either. Anyhelp is greatly apreciated. <br><br>using this for reference <a href="http://www.tcl.tk/man/tcl/tutorial/Tcl41.html" class="postlink">http://www.tcl.tk/man/tcl/tutorial/Tcl41.html</a><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11437">adi2247</a> — Tue Dec 21, 2010 5:41 am</p><hr />
]]></content>
	</entry>
	</feed>
