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

	<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>2003-01-03T12:18:01-04:00</updated>

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

		<entry>
		<author><name><![CDATA[Weirdo]]></name></author>
		<updated>2003-01-03T12:18:01-04:00</updated>

		<published>2003-01-03T12:18:01-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=14848#p14848</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=14848#p14848"/>
		<title type="html"><![CDATA[figuring out a loop]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=14848#p14848"><![CDATA[
Ok, that is something i wold never thought of myself. Thank you very much slim. It works wonderfully, at 16:15 it did the notice in channel. thanks very much<br><br>In an hour and 45 mins, we do the switchover <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=1195">Weirdo</a> — Fri Jan 03, 2003 12:18 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ppslim]]></name></author>
		<updated>2003-01-03T12:13:49-04:00</updated>

		<published>2003-01-03T12:13:49-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=14847#p14847</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=14847#p14847"/>
		<title type="html"><![CDATA[figuring out a loop]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=14847#p14847"><![CDATA[
OK - lets inspect the 2 lines of code in use.<br><br>The first, looks to see what the first character in the $min variable is. If it's a 0 (In most languages, 0 is seen as false), it will set the value of $min, to the second digit in the variable, leaving it only 1 character in length.<br><br>This means, that $min will no longer have it's 2 digit length, that has me so hot an bothered, and causing all these issues with errors.<br><br>The second line, does some simple math, to figure out what time throughout the hour it is.<br><br>If the time is 30 mins past the hour, the following happens.<br><br>Devide 20 by 15, and you get 1, with 5 remaining (remember, we are working with decimal whole numbers, and not floating points, so we don't get the 1.33333 crap).<br><br>If it is 30 min past, we get 2 and 0 remaining.<br><br>As you should see, the possible values that can be used as a remainder are<blockquote class="uncited"><div><strong class="text-strong">0</strong>, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14</div></blockquote>So when there is 0 remaining, it must either be 0, 15, 30 or 45 mins past the hour.<br><br>Again, remember that the if command works by true and false values, with 0 being flase, and any other being true.<br><br>As such, if the remainder is 1 or upwards, that the code "return" is run, thus stopping the script, if it is 0, then it is skipped, causing the script to complete it's journey.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2">ppslim</a> — Fri Jan 03, 2003 12:13 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Weirdo]]></name></author>
		<updated>2003-01-03T12:05:11-04:00</updated>

		<published>2003-01-03T12:05:11-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=14846#p14846</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=14846#p14846"/>
		<title type="html"><![CDATA[figuring out a loop]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=14846#p14846"><![CDATA[
FREEDOM FOR STRINGS <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>[16:00:00] &lt;Natsuki-Chan&gt; [16:00] Notice sent to #weirdo<br><br>with the code<br><br>if {![string index $min 0]} { set min [string index $min 1] }<br>if {$min % 15} { return } <br><br>Cause of a typo, it didnt do anything in channel. Should do next time <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>So this should happen every 15 mins? Or is it every hour?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=1195">Weirdo</a> — Fri Jan 03, 2003 12:05 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ppslim]]></name></author>
		<updated>2003-01-03T11:56:19-04:00</updated>

		<published>2003-01-03T11:56:19-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=14845#p14845</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=14845#p14845"/>
		<title type="html"><![CDATA[figuring out a loop]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=14845#p14845"><![CDATA[
Just quickly, yes, that code should work. Though you might as well prod the [expr]<div class="codebox"><p>Code: </p><pre><code>if {$min % 15} { return }and notif {[expr $min % 15]} {</code></pre></div>I also seem to have located why these are required.<br><br>This is a quote from the tcl man pages<blockquote class="uncited"><div>* / %<br>Multiply, divide, remainder. None of these operands may be applied to string operands, and remainder may be applied only to integers. The remainder will always have the same sign as the divisor and an absolute value smaller than the divisor. </div></blockquote>This would imply, that the min value, is infact a string, and not an integer, and would explain why my head was saying no while typing the previous post.<br><br>If working in Tcl script (the type we create for eggdrop, or command line processing), it seems that all variables are stored in some form of mixed form, where they are neither string or integers.<br><br>When working in C however (as eggdrop does), passing the string accross, stores it as a physical string, wihtout the ability to be loose in it's actions.<br><br>When I get my ass home tomorow, I am gonna write a letter of complaint to the government, for not allowing string there freedom <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_razz.gif" width="15" height="15" alt=":P" title="Razz"><br><br>however, I do want it to be free like the rest of Tcl code, as it hampers normal calulations as noted by the errors.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2">ppslim</a> — Fri Jan 03, 2003 11:56 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ppslim]]></name></author>
		<updated>2003-01-03T11:46:49-04:00</updated>

		<published>2003-01-03T11:46:49-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=14844#p14844</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=14844#p14844"/>
		<title type="html"><![CDATA[figuring out a loop]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=14844#p14844"><![CDATA[
I have just noticed somthing rather strange, or rather, more anoying, and it requires work-arounds.<br><br>The time bind, has the current min, hour, day month and year passed as arguments to any trigger proc. Each argument is 2 digits long (year I aint sure about, I aint looked), no matter what it's value is overall.<br><br>When representing numbers in other languages like C, the number 02 is octal/hex (memory aludes me without my books), and 2 is decimal. As such, at 2 mins past the hour, odd things can happen.<br><br>When trying to reproduce this, on the only tclsh shell I could access, I found it impossible.<blockquote class="uncited"><div>% set min 02<br>02<br>% expr $min % 5<br>2<br>% set min 00<br>00<br>% expr $min % 5<br>0</div></blockquote>This leads me to suspect, that Tcl is interpreting the number being passed in the bind, as a actual number, and not a string. From what I can see, in the tests above, simply using<br><div class="codebox"><p>Code: </p><pre><code>if {$min % 5} { return }</code></pre></div>Would do the trick, and as further unshown tests prooved, it did so. However, eggdrop (Tcl) still creates error out of this, during certain parts of the hour.<br><br>Wihtout being able to spend some time looking into the source, running some actual eggdrop tests and so on, the workarounds posted above, will have to be used, however, I have one final sugestion, should anyone want to test it. Try using<br><div class="codebox"><p>Code: </p><pre><code>set min [expr $min]</code></pre></div>Instead of the "string" based commands. This may force Tcl to think different, but no gurentees.<br><br>The way things currently work, are part correct, but also seem part wrong too. I hope to find some longer term solution to the overall issue, of having to convert the mins value, so that basic math can be performed on it.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2">ppslim</a> — Fri Jan 03, 2003 11:46 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Weirdo]]></name></author>
		<updated>2003-01-03T11:34:02-04:00</updated>

		<published>2003-01-03T11:34:02-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=14842#p14842</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=14842#p14842"/>
		<title type="html"><![CDATA[figuring out a loop]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=14842#p14842"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>bind time - * time:pubnotice proc time:pubnotice {min hour day moth year} { global chanl network notice activeif {![string index $min 0]} { set min [string index $min 1] }if {[expr $min ^ 15]} { return }if {$active == 1} {puthelp "Notice %chanl(main) :$notice(public)"putlog "Notice sent to $chanl(main)" }}</code></pre></div>Like this slim?[/code]<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=1195">Weirdo</a> — Fri Jan 03, 2003 11:34 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ppslim]]></name></author>
		<updated>2003-01-03T11:30:31-04:00</updated>

		<published>2003-01-03T11:30:31-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=14841#p14841</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=14841#p14841"/>
		<title type="html"><![CDATA[figuring out a loop]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=14841#p14841"><![CDATA[
Stupid old me.<br><br>Go back to the plain $min version.<br><br>The string trim, is removing both 00's when the hour strikes.<br><div class="codebox"><p>Code: </p><pre><code>if {![string index $min 0]} { set min [string index $min 1] }</code></pre></div>Use this line, before it checks the reaminder.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2">ppslim</a> — Fri Jan 03, 2003 11:30 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Weirdo]]></name></author>
		<updated>2003-01-03T08:12:56-04:00</updated>

		<published>2003-01-03T08:12:56-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=14832#p14832</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=14832#p14832"/>
		<title type="html"><![CDATA[figuring out a loop]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=14832#p14832"><![CDATA[
[12:00:00] &lt;Natsuki-Chan&gt; [12:00] Tcl error [time:pubnotice]: syntax error in expression " ^ 3": unexpected operator ^<br><br>[12:03:00] &lt;Natsuki-Chan&gt; [12:03] Tcl error [time:pubnotice]: can't read "nick": no such variable &lt;&lt; I fixed this one <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=1195">Weirdo</a> — Fri Jan 03, 2003 8:12 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Weirdo]]></name></author>
		<updated>2003-01-03T07:12:13-04:00</updated>

		<published>2003-01-03T07:12:13-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=14829#p14829</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=14829#p14829"/>
		<title type="html"><![CDATA[figuring out a loop]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=14829#p14829"><![CDATA[
ok, changed, ill see how it goes <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=1195">Weirdo</a> — Fri Jan 03, 2003 7:12 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ppslim]]></name></author>
		<updated>2003-01-03T07:09:50-04:00</updated>

		<published>2003-01-03T07:09:50-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=14828#p14828</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=14828#p14828"/>
		<title type="html"><![CDATA[figuring out a loop]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=14828#p14828"><![CDATA[
Never post when you are very tired. I forgot about thboth of these.<br><br>99% of the time, I am on a system, where I can make small tests using tclsh.<br><br>Change $min in the if statement to<div class="codebox"><p>Code: </p><pre><code>[string trimleft $min 0]</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2">ppslim</a> — Fri Jan 03, 2003 7:09 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Weirdo]]></name></author>
		<updated>2003-01-03T07:09:46-04:00</updated>

		<published>2003-01-03T07:09:46-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=14827#p14827</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=14827#p14827"/>
		<title type="html"><![CDATA[figuring out a loop]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=14827#p14827"><![CDATA[
[11:08:00] &lt;Natsuki-Chan&gt; [11:08] Tcl error [time:pubnotice]: can't use invalid octal number as operand of "%"<br>[11:09:00] &lt;Natsuki-Chan&gt; [11:09] Tcl error [time:pubnotice]: can't use invalid octal number as operand of "%"<br><br>now getting these <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_sad.gif" width="15" height="15" alt=":(" title="Sad"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=1195">Weirdo</a> — Fri Jan 03, 2003 7:09 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Weirdo]]></name></author>
		<updated>2003-01-03T06:05:58-04:00</updated>

		<published>2003-01-03T06:05:58-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=14824#p14824</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=14824#p14824"/>
		<title type="html"><![CDATA[figuring out a loop]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=14824#p14824"><![CDATA[
#Ill give it a go, at the moment, i getting<br><br> [04:08:00] &lt;Natsuki-Chan&gt; [04:08] Tcl error [time:pubnotice]: expected integer but got "08" (looks like invalid octal number)<br>[04:09:00] &lt;Natsuki-Chan&gt; [04:09] Tcl error [time:pubnotice]: expected integer but got "09" (looks like invalid octal number)<br><br>those<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=1195">Weirdo</a> — Fri Jan 03, 2003 6:05 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[strikelight]]></name></author>
		<updated>2003-01-02T23:06:27-04:00</updated>

		<published>2003-01-02T23:06:27-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=14818#p14818</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=14818#p14818"/>
		<title type="html"><![CDATA[figuring out a loop]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=14818#p14818"><![CDATA[
<blockquote class="uncited"><div>make the line after the global line the following<br><div class="codebox"><p>Code: </p><pre><code>if {[expr $min ^ 15]} { return }</code></pre></div>This works, by dividing the current mins by 15. If there is a remainder in the division, then don't operate.</div></blockquote>I believe ppslim meant:<br><div class="codebox"><p>Code: </p><pre><code>if {[expr $min % 15]} { return }</code></pre></div>But the expr isn't really needed, if you wanted to, you could save space by just using: (atleast in tcl7.6 and above)<br><div class="codebox"><p>Code: </p><pre><code>if {$min%15} { return }</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2005">strikelight</a> — Thu Jan 02, 2003 11:06 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Weirdo]]></name></author>
		<updated>2003-01-02T21:52:35-04:00</updated>

		<published>2003-01-02T21:52:35-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=14813#p14813</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=14813#p14813"/>
		<title type="html"><![CDATA[figuring out a loop]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=14813#p14813"><![CDATA[
thank you, give it a try. Wish me luck on the move <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=1195">Weirdo</a> — Thu Jan 02, 2003 9:52 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ppslim]]></name></author>
		<updated>2003-01-02T21:23:49-04:00</updated>

		<published>2003-01-02T21:23:49-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=14806#p14806</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=14806#p14806"/>
		<title type="html"><![CDATA[figuring out a loop]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=14806#p14806"><![CDATA[
make the line after the global line the following<br><div class="codebox"><p>Code: </p><pre><code>if {[expr $min ^ 15]} { return }</code></pre></div>This works, by dividing the current mins by 15. If there is a remainder in the division, then don't operate.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2">ppslim</a> — Thu Jan 02, 2003 9:23 pm</p><hr />
]]></content>
	</entry>
	</feed>
