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

	<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>2009-07-04T15:04:13-04:00</updated>

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

		<entry>
		<author><name><![CDATA[arfer]]></name></author>
		<updated>2009-07-04T15:04:13-04:00</updated>

		<published>2009-07-04T15:04:13-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=89440#p89440</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=89440#p89440"/>
		<title type="html"><![CDATA[auto voice between 11pm and 8am]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=89440#p89440"><![CDATA[
For additional flexibility, I was trying to allow use of a secondary GMT offset in case a time zone was required within an IRC community that was not the same as the bot's GMT offset time.<br><br>Using nml375's hour checking statement, I think the following is now the correct logic.<br><div class="codebox"><p>Code: </p><pre><code>set vStartHour 23set vEndHour 8set vGmtOffset +1set vVoiceDelay 10bind JOIN - * pTimedVoiceJoinproc pTimedVoiceJoin {nick uhost hand chan} {    global vGmtOffset vStartHour vEndHour vVoiceDelay    set hour [clock format [expr {[clock seconds] + ($vGmtOffset * 3600)}] -format %k -gmt 1]    if {$hour &gt;= $vStartHour &amp;&amp; $hour &lt; $vEndHour || ($hour &gt;= $vStartHour || $hour &lt; $vEndHour) &amp;&amp; $vStartHour &gt; $vEndHour} {        utimer $vVoiceDelay [list pTimedVoiceDelay $nick $chan]    }    return 0}proc pTimedVoiceDelay {nick chan} {    if {[botisop $chan]} {        if {[onchan $nick $chan]} {            if {(![isop $nick $chan]) &amp;&amp; (![isvoice $nick $chan])} {                pushmode $chan +v $nick                flushmode $chan            }        }    }    return 0}# eof</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5705">arfer</a> — Sat Jul 04, 2009 3:04 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[speechles]]></name></author>
		<updated>2009-07-04T13:56:01-04:00</updated>

		<published>2009-07-04T13:56:01-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=89437#p89437</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=89437#p89437"/>
		<title type="html"><![CDATA[auto voice between 11pm and 8am]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=89437#p89437"><![CDATA[
<blockquote class="uncited"><div>speechles,<br>lappend will work just fine, if you know how to use it.. Such as below:<div class="codebox"><p>Code: </p><pre><code>lappend ::voicelist $nick $uhost $handle $channel</code></pre></div>This is the recommended way of doing it, as it yields significant performance boost with large lists (see the lappend manpage for further details).</div></blockquote>Corrected the prior script to properly use lappend. For some reason every time I've tried to use it this way it has failed me but might be because I've always tried it using [list $elements $go $here] rather than just list the elements singularly after the lappend.<br><br>Also, corrected the code advice you gave and incorporated it into the script along with mention to you. If this is done poorly shout it out. If you'd rather not participate then I'll change the "maybe this is" back into a "this is not".. haw <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8138">speechles</a> — Sat Jul 04, 2009 1:56 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2009-07-04T13:55:52-04:00</updated>

		<published>2009-07-04T13:55:52-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=89436#p89436</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=89436#p89436"/>
		<title type="html"><![CDATA[auto voice between 11pm and 8am]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=89436#p89436"><![CDATA[
speechles,<br>The code I proposed is this:<div class="codebox"><p>Code: </p><pre><code>if {$hour &gt;= $start &amp;&amp; $hour &lt; $end || ($hour &gt;= $start || $hour &lt; $end) &amp;&amp; $start &gt; $end} {</code></pre></div>That's not even remotely close to the code you pinned my signature.. "minor tweak" does not cut it. What you wrote in your script is not my code, as such - do not attribute it to me, correct or faulty.<br><br>Your code does not work, as it makes the assumption $vStartHour is always less than $vEndHour. This is not the case in the original request.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Sat Jul 04, 2009 1:55 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2009-07-04T13:47:43-04:00</updated>

		<published>2009-07-04T13:47:43-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=89435#p89435</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=89435#p89435"/>
		<title type="html"><![CDATA[auto voice between 11pm and 8am]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=89435#p89435"><![CDATA[
speechles,<br>lappend will work just fine, if you know how to use it.. Such as below:<div class="codebox"><p>Code: </p><pre><code>lappend ::voicelist $nick $uhost $handle $channel</code></pre></div>This is the recommended way of doing it, as it yields significant performance boost with large lists (see the lappend manpage for further details).<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Sat Jul 04, 2009 1:47 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[speechles]]></name></author>
		<updated>2009-07-04T13:42:17-04:00</updated>

		<published>2009-07-04T13:42:17-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=89434#p89434</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=89434#p89434"/>
		<title type="html"><![CDATA[auto voice between 11pm and 8am]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=89434#p89434"><![CDATA[
<blockquote class="uncited"><div>speechles,<br>I did not make any comments as to your flood protection, neither anyone else's. You might also like to keep in mind that the original request did not come with flood protection, neither did the initial code example by the requester have one.<br><br>That, however, does not change the case that you've attached my signature to code I've not written, and which is non-functional. <strong class="text-strong">At best, I consider that slander.</strong></div></blockquote>Which part isn't functional, and notice after your nick says minor tweaks.. why are you so offended that your participation in a script has been noted in some regard, do you wish that removed, just say so? maybe you already have in this case just say so without being sarcastic about it or just "mod edit" it out. You do have this power. I remember the incident when you attained it precisely.<br><blockquote class="uncited"><div>On a side note, you could improve performance in your script by using the lappend command rather than resetting the variable with a concat'd value...</div></blockquote>Lappand won't behave the same when using the foreach constructed below. I wanted a single inline list. Not a series of lists within lists. With those I would need to run a series of sets with lindexes on them to get the contents of each element. With an inline list, which concat gives back, is the only way the foreach constructed on the timer:onjoin can work. This is done to keep the code short and remove all those sets and lindexes otherwise required.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8138">speechles</a> — Sat Jul 04, 2009 1:42 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2009-07-04T13:37:51-04:00</updated>

		<published>2009-07-04T13:37:51-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=89433#p89433</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=89433#p89433"/>
		<title type="html"><![CDATA[auto voice between 11pm and 8am]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=89433#p89433"><![CDATA[
speechles,<br>I did not make any comments as to your flood protection, neither anyone else's. You might also like to keep in mind that the original request did not come with flood protection, neither did the initial code example by the requester have one.<br><br>That, however, does not change the case that you've attached my signature to code I've not written, and which is non-functional. <strong class="text-strong">At best, I consider that slander.</strong><br><br>On a side note, you could improve performance in your script by using the lappend command rather than resetting the variable with a concat'd value...<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Sat Jul 04, 2009 1:37 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[speechles]]></name></author>
		<updated>2009-07-04T13:22:39-04:00</updated>

		<published>2009-07-04T13:22:39-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=89432#p89432</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=89432#p89432"/>
		<title type="html"><![CDATA[auto voice between 11pm and 8am]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=89432#p89432"><![CDATA[
<blockquote class="uncited"><div>Speechles,<br>Not to be rude, but the expression you've entered is not even remotely close to what I've suggested! Also, it is severely flawed.<br>Please do not attach my signature with some random piece of code.</div></blockquote>Not to be rude sir, but your code will flood a channel in the event of a flood of joins. Be this a netsplit, rogue users, etc. I would rather think you at your caliber of this field you would be more caring. But i digress.... <br><br>Also corrected that silly concat I did above to keep all elements available to allow the timer to keep the contents intact. The foreach seemed simplest and the only way to do it without using a series of sets with lindexes on them. concat is the answer. This is not to criticize your help to the user as all he asked was for a direction to go in accomplishing it. He probably could have figured out the rest. This was just for the sake of debate which clearly we are having. Bravo. <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8138">speechles</a> — Sat Jul 04, 2009 1:22 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2009-07-04T13:20:18-04:00</updated>

		<published>2009-07-04T13:20:18-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=89431#p89431</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=89431#p89431"/>
		<title type="html"><![CDATA[auto voice between 11pm and 8am]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=89431#p89431"><![CDATA[
Speechles,<br>Not to be rude, but the expression you've entered is not even remotely close to what I've suggested! Also, it is severely flawed.<br>Please do not attach my signature with some random piece of code.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Sat Jul 04, 2009 1:20 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[speechles]]></name></author>
		<updated>2009-07-04T14:24:52-04:00</updated>

		<published>2009-07-04T13:16:13-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=89430#p89430</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=89430#p89430"/>
		<title type="html"><![CDATA[auto voice between 11pm and 8am]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=89430#p89430"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code># set some global vars up with contents# voice delay (in minutes) this is to prevent a# flood of voices during a netsplit rejoin, or# rogue users flooding your channel.variable vVoiceDelay 10# hour to start voice (24 hour) variable vStartHour 23# hour to stop voicing (24 hour)variable vEndHour 8# init voicelistvariable voicelist [list]# init timer to check list, so if a flood of joins occurs# in that period, we can stuff as many modes on one line# as possible in as many channels as possible.timer $vVoiceDelay timer:onjoinproc pub:onjoin {nick uhost handle channel} {  # maybe this is nml375's code :)  set hour [clock format [clock seconds] -format "%k"]  if {$hour &gt;= $::vStartHour &amp;&amp; $hour &lt; $::vEndHour || ($hour &gt;= $::vStartHour || $hour &lt; $::vEndHour) &amp;&amp; $::vStartHour &gt; $::vEndHour} {    # create a single in-line voicelist, checking that    # a rotating nickname gets added only once.    if {[lsearch -exact $::voicelist [string tolower $nick]] == -1} {      lappend ::voicelist [string tolower $nick] $uhost $handle $channel     }  }}proc timer:onjoin { } {  set channellist [list]  # iterate through the in-line voicelist  foreach {nick uhost handle channel} $::voicelist {    # conditionals    if {[botisop $channel] &amp;&amp; [onchan $nick $channel] &amp;&amp; ![isvoice $nick $channel]} {      pushmode $channel +v $nick      # for the flushmode below to work we need to track every chan      # we've done any mode changes through. to keep this list short      # and no channels repeated, i propose an lsearch. i know this      # would be executed at the end of the proc anyways. this is      # for style points.. :P      if {[lsearch -exact $channellist $channel] == -1} {        lappend $channellist $channel      }    }  }  # STYLE POINTS! this is totally unnecessary, but it looks cool.  foreach $chan $channelist {    flushmode $chan  }  # clear voicelist for next flush  set ::voicelist [list]  # recall timer to check next joiners  timer $::vVoiceDelay timer:onjoin }</code></pre></div>If I may throw my 2cents worth into this debate. This is probably where arfer was going with his script. The idea is to keep mode changes to a minimum in case a flood of joins occurs and this keeps it global for every channel the bot resides in just like the rest of your scripts did..<br><br>Edit: Corrected many stupid mistakes and obvious over sights mentioned further down in this thread. This should now be something useful to the poster rather than something to be looked down upon as a poor example of poster's request. <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=8138">speechles</a> — Sat Jul 04, 2009 1:16 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2009-07-04T12:25:25-04:00</updated>

		<published>2009-07-04T12:25:25-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=89429#p89429</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=89429#p89429"/>
		<title type="html"><![CDATA[auto voice between 11pm and 8am]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=89429#p89429"><![CDATA[
arfer,<br>Just use the modulus operator, and you won't have to bother with testing..<br>Or, as I suggested, simply make use of the already existing time zone settings.. Seems rather overkill to add a second time zone setting that only affects one function...<br><br>Next, you have three cases with start- and end-hour:<ul><li>start is less than end<br>We should only voice if $hour is greater than or equal to start and less than end.</li><li>start is greater than end<br>We should only voice if $hour is greater than or equal to start or less than end.</li><li>start is equal to end<br>This is really not a valid range. We should not voice at all.</li></ul>If we choose to ignore the last case, as it is not valid, we can compile the following expression (in it's most simplified form, be aware that this expression is designed with operator priority in mind).:<div class="codebox"><p>Code: </p><pre><code>if {$hour &gt;= $start &amp;&amp; $hour &lt; $end || ($hour &gt;= $start || $hour &lt; $end) &amp;&amp; $start &gt; $end} {</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Sat Jul 04, 2009 12:25 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[arfer]]></name></author>
		<updated>2009-07-04T12:15:12-04:00</updated>

		<published>2009-07-04T12:15:12-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=89428#p89428</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=89428#p89428"/>
		<title type="html"><![CDATA[auto voice between 11pm and 8am]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=89428#p89428"><![CDATA[
Hmm, I also see what you mean regarding the gmt code. This could erroneously generate hour 24<br><br>This is not easy to accomplish<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5705">arfer</a> — Sat Jul 04, 2009 12:15 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[arfer]]></name></author>
		<updated>2009-07-04T12:12:53-04:00</updated>

		<published>2009-07-04T12:12:53-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=89427#p89427</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=89427#p89427"/>
		<title type="html"><![CDATA[auto voice between 11pm and 8am]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=89427#p89427"><![CDATA[
sorry nml375, I realised was taking nonsense before you replied and deleted my post <br><br>However, I was interested to develop a more flexible script and cant seem to find the math to calculate whether a particular hour is between two others, as follows :-<br><br>I think your mod maths is needed to check if a number is in bounds. <br><br>Could you take a look and advise please<br><div class="codebox"><p>Code: </p><pre><code>set vStartHour 23set vEndHour 8set vGmtOffset +1set vVoiceDelay 10bind JOIN - * pTimedVoiceJoinproc pTimedVoiceJoin {nick uhost hand chan} {    global vGmtOffset vStartHour vEndHour vVoiceDelay    set hour [expr {[clock format [clock seconds] -format %k -gmt 1] + $vGmtOffset}]    # {if statement needed here for checking if within bound} {        utimer $vVoiceDelay [list pTimedVoiceDelay $nick $chan]    # }    return 0}proc pTimedVoiceDelay {nick chan} {    if {[botisop $chan]} {        if {[onchan $nick $chan]} {            if {(![isop $nick $chan]) &amp;&amp; (![isvoice $nick $chan])} {                pushmode $chan +v $nick                flushmode $chan            }        }    }    return 0}# eof</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5705">arfer</a> — Sat Jul 04, 2009 12:12 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2009-07-04T12:05:32-04:00</updated>

		<published>2009-07-04T12:05:32-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=89426#p89426</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=89426#p89426"/>
		<title type="html"><![CDATA[auto voice between 11pm and 8am]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=89426#p89426"><![CDATA[
arfer,<br>24 would actually be 0, not 24, and would thus be covered by the "less than 8" part. The logic is not flawed...<br><br>Of course, if we'd rather have a different limit than 11pm such as 10pm, you'd simply change "$hour == 23" into "$hour &gt;= 22". As for your logics in your script, I'm quite confident to say that it is flawed:<br><div class="codebox"><p>Code: </p><pre><code>.. ($h &gt;= $vStartHour) &amp;&amp; ($h &gt;= $vEndHour) ..</code></pre></div>Tests whether we've passed both the start and end hour. If we've passed both, we really should'nt voice.<div class="codebox"><p>Code: </p><pre><code>.. ($h &lt;= $vStartHour) &amp;&amp; ($h &lt;= $vEndHour) ..</code></pre></div>Tests whether we've yet to reach both the start and end hour. Hence, we've yet to reach the time when we should start voicing.<br><br>So you are actually voicing when you should not voice...<br><br>The gmt-offset is also flawed, as this code could generate hours out of bounds. You'd atleast need to use the modulus operator to make certain the result is in bounds. In my honest opinion, this is overworked though, as the clock command honours time zone settings, and will always use the same time as your eggdrop.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Sat Jul 04, 2009 12:05 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[jeroen_005]]></name></author>
		<updated>2009-07-04T11:30:15-04:00</updated>

		<published>2009-07-04T11:30:15-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=89423#p89423</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=89423#p89423"/>
		<title type="html"><![CDATA[auto voice between 11pm and 8am]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=89423#p89423"><![CDATA[
thanks for helping nml375 <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_biggrin.gif" width="15" height="15" alt=":D" title="Very Happy"> you are great <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=10007">jeroen_005</a> — Sat Jul 04, 2009 11:30 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2009-07-04T11:16:01-04:00</updated>

		<published>2009-07-04T11:16:01-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=89422#p89422</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=89422#p89422"/>
		<title type="html"><![CDATA[auto voice between 11pm and 8am]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=89422#p89422"><![CDATA[
username,<br>%k does not prefix single-digit values with 0, %H does..<br>For further explanations, see the man-pages.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Sat Jul 04, 2009 11:16 am</p><hr />
]]></content>
	</entry>
	</feed>
