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

	<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>2015-05-20T03:22:11-04:00</updated>

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

		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2015-05-20T03:22:11-04:00</updated>

		<published>2015-05-20T03:22:11-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=104124#p104124</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=104124#p104124"/>
		<title type="html"><![CDATA[Unbind bind time and bind cron ?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=104124#p104124"><![CDATA[
<blockquote class="uncited"><div><blockquote class="uncited"><div><div class="codebox"><p>Code: </p><pre><code>foreach ele [binds cron] {if {[scan $ele {%s%s%s%d%s} type flags cmd hits ] != 5} continueif {$func ne "warns"} continueputlog "unbind cron - $flags $func"}</code></pre></div></div></blockquote></div></blockquote><div class="codebox"><p>Code: </p><pre><code>if {[scan $ele {%s%s%s%d%s} type flags cmd hits func] != 5} continue</code></pre></div>Please notice the missing of 5th element <strong class="text-strong">func</strong> in your code. I posted 5 and somehow you ate one. <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>As for foreach, here's a better way to do it:<div class="codebox"><p>Code: </p><pre><code>foreach {type flags cmd hits func} [join [binds]] {if {$func eq "warns"} {unbind $type $flags $cmd $funcbreak}}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Wed May 20, 2015 3:22 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[juanamores]]></name></author>
		<updated>2015-05-19T18:34:34-04:00</updated>

		<published>2015-05-19T18:34:34-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=104123#p104123</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=104123#p104123"/>
		<title type="html"><![CDATA[Unbind bind time and bind cron ?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=104123#p104123"><![CDATA[
<blockquote class="uncited"><div><div class="codebox"><p>Code: </p><pre><code>foreach ele [binds cron] {if {[scan $ele {%s%s%s%d%s} type flags cmd hits ] != 5} continueif {$func ne "warns"} continueputlog "unbind cron - $flags $func"}</code></pre></div>Give this a try and if shows the stuff you want to be removed correctly then drop the <em class="text-italics">putlog</em> and the <em class="text-italics">""</em></div></blockquote><strong class="text-strong">caesar</strong> it not worked.<br>The condition that <em class="text-italics">control </em>variable is &gt;=4 was fulfilled, but not the <em class="text-italics">unbind</em> was run.<br>What means the number 5 in this expression?<div class="codebox"><p>Code: </p><pre><code> if {[scan $ele {%s%s%s%d%s} type flags cmd hits func] != 5} continue </code></pre></div>Because, if the number of item in the list I pasted above, will not work, since the list is dynamically sorted by the number of hits occurred.<br><br>In this moment I put the party line: <div class="codebox"><p>Code: </p><pre><code>.tcl binds cron</code></pre></div>and  returned:<br><blockquote class="uncited"><div>Tcl: {cron -|- {*/30 * * * *} 4 warns} {cron -|- {*/30 * * * *} 4 advertise3} {cron -|- {*/1 * * * *} 109 entrada} {cron -|- {* * * * *} 109 envivo} {cron -|- {*/20 * * * *} 5 advertise2} {cron -|- {*/10 * * * *} 11 notify} {cron -|- {*/10 * * * *} 11 advertise}</div></blockquote>And  about 5 minutes ago before was:<blockquote class="uncited"><div>Tcl: {cron -|- {* * * * *} 81 envivo} {cron -|- {*/1 * * * *} 81 warns} {cron -|- {*/20 * * * *} 4 advertise2} {cron -|- {*/10 * * * *} 8 notify} {cron -|- {*/10 * * * *} 8 advertise} {cron -|- {*/30 * * * *} 3 warns} {cron -|- {*/30 * * * *} 3 advertise3}</div></blockquote><strong class="text-strong">EDIT:</strong><br>I have tried for debbugin purpose (7 is number of elements in the <em class="text-italics">binds cron</em> list actually):<blockquote class="uncited"><div>foreach ele [binds cron] {<br>   if {[scan $ele {%s%s%s%d%s} type flags cmd hits func] <span style="color:red">&gt; 7</span>} break <br>   <span style="color:red">putmsg $canal_admin "FUNC: $func"</span><br>   if {$func ne "warns"} continue<br>   putlog "unbind cron - $flags $func"<br> } </div></blockquote><strong class="text-strong">Tcl error [warns]: can't read "func": no such variable</strong><br><span style="color:red"><strong class="text-strong">FINAL EDIT: Fixed! <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_biggrin.gif" width="15" height="15" alt=":D" title="Very Happy"> </strong></span><br>In the Eggdrop Documentation I found this:<blockquote class="uncited"><div>binds [type/mask]<br>Returns: a list of Tcl binds, each item in the list is a sublist of five elements: {&lt;type&gt; &lt;flags&gt; &lt;name&gt; &lt;hits&gt; &lt;proc&gt;}</div></blockquote><div class="codebox"><p>Code: </p><pre><code>foreach ele [binds] {        foreach {type flags name hits proc} $ele {                if {[string match "warns" $proc]} {                  unbind $type $flags $name $procbreak                }}}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12499">juanamores</a> — Tue May 19, 2015 6:34 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2015-05-19T00:35:36-04:00</updated>

		<published>2015-05-19T00:35:36-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=104120#p104120</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=104120#p104120"/>
		<title type="html"><![CDATA[Unbind bind time and bind cron ?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=104120#p104120"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>foreach ele [binds cron] {if {[scan $ele {%s%s%s%d%s} type flags cmd hits func] != 5} continueif {$func ne "warns"} continueputlog "unbind cron - $flags $func"}</code></pre></div>Give this a try and if shows the stuff you want to be removed correctly then drop the <em class="text-italics">putlog</em> and the <em class="text-italics">""</em><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Tue May 19, 2015 12:35 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[juanamores]]></name></author>
		<updated>2015-05-18T21:59:44-04:00</updated>

		<published>2015-05-18T21:59:44-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=104119#p104119</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=104119#p104119"/>
		<title type="html"><![CDATA[Unbind bind time and bind cron ?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=104119#p104119"><![CDATA[
Now I found a way to fix it, but how could it be otherwise, I have problems with strings and lists.  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_redface.gif" width="15" height="15" alt=":oops:" title="Embarassed"> <br><em class="text-italics">[binds cron]</em> returns a list of all cron  binded (In this case has 8 elements):<blockquote class="uncited"><div><span style="color:blue"><strong class="text-strong">{</strong></span>cron -|- {*/10 * * * *} 14 notify<span style="color:blue"><strong class="text-strong">}</strong></span> <span style="color:blue"><strong class="text-strong">{</strong></span>cron -|- {*/10 * * * *} 14 advertise<span style="color:blue"><strong class="text-strong">}</strong></span> <span style="color:blue"><strong class="text-strong">{</strong></span>cron -|- {* * * * *} 140 tiempos<span style="color:blue"><strong class="text-strong">}</strong></span> <span style="color:blue"><strong class="text-strong">{</strong></span>cron -|- {* * * * *} 140 envivo<span style="color:blue"><strong class="text-strong">}</strong></span> <span style="color:blue"><strong class="text-strong">{</strong></span>cron -|- {*/1 * * * *} 23 <span style="color:red">warns</span><span style="color:blue"><strong class="text-strong">}</strong></span> <span style="color:blue"><strong class="text-strong">{</strong></span>cron -|- {*/30 * * * *} 4 status<span style="color:blue"><strong class="text-strong">}</strong></span><span style="color:blue"> <strong class="text-strong">{</strong></span>cron -|- {*/30 * * * *} 4 advertise3<span style="color:blue"><strong class="text-strong">}</strong></span> <span style="color:blue"><strong class="text-strong">{</strong></span>cron -|- {*/20 * * * *} 7 advertise2<span style="color:blue"><strong class="text-strong">}</strong></span></div></blockquote>The ease that I have to find the name of the <em class="text-italics">proc</em> (<em class="text-italics">warns</em>), is that all elements of the list, beginning with cron, and ending with the name of the process.<br>My idea was to compare the last word of each item on the list, with the name of the process warns.<br><br>First, I store each item the list to the compare variable.<div class="codebox"><p>Code: </p><pre><code>foreach bin [binds cron] {set compare [lindex [split $bin] $x]</code></pre></div>If the <em class="text-italics">proc warns</em> is in the list, means that is not unbinded. When is matched, sets Ok variable value to 1 and use <em class="text-italics">break</em> to cut the loop.<div class="codebox"><p>Code: </p><pre><code>if {[string index $compare end] == "warns"} {set ok 1;break }</code></pre></div>Then, if there is Ok variable it has a value of 1, unbind the proc.<div class="codebox"><p>Code: </p><pre><code>if {([info exist ok]) &amp;&amp; ($ok == "1") } { unbind cron - {*/5 * * * *} warns</code></pre></div>If not, increase the <em class="text-italics">control</em> counter and stores it in the <em class="text-italics">avisos</em> file<div class="codebox"><p>Code: </p><pre><code>set control [expr {$control + 1}]set temp [open "avisos" w]puts $temp $controlclose $tempreturn </code></pre></div>But I have changed several times code and continues to the following error:<br><strong class="text-strong">Tcl error [warns]: wrong # args: should be "for start test next command"</strong><br><div class="codebox"><p>Code: </p><pre><code>bind cron - {*/5 * * * *} warns proc warns {nick uhost hand chan text} {global canal_admin canal_djs control if {$control &gt;= 4} { for x 0foreach bin [binds cron] {set compare [lindex [split $bin] $x]if {[string index $compare $x] == "warns"} {set ok 1;break }set x [expr {$x + 1}]}if {([info exist ok]) &amp;&amp; ($ok == "1") } { unbind cron - {*/5 * * * *} warns; return} else {set control [expr {$control + 1}]set temp [open "avisos" w]puts $temp $controlclose $tempreturn }} #### more stuff### }</code></pre></div><span style="color:red"><strong class="text-strong">EDIT:</strong></span>  The error is given by:<div class="codebox"><p>Code: </p><pre><code>foreach bin [binds cron]</code></pre></div>I tried to put all the value in a variable, but the error continues:<div class="codebox"><p>Code: </p><pre><code>set compare [binds cron]</code></pre></div>If I put:<div class="codebox"><p>Code: </p><pre><code>putmsg $chan "[binds cron]"</code></pre></div>Return:  <blockquote class="uncited"><div><span style="color:blue"><strong class="text-strong">{</strong></span>cron -|- {*/10 * * * *} 14 notify<span style="color:blue"><strong class="text-strong">}</strong></span> <span style="color:blue"><strong class="text-strong">{</strong></span>cron -|- {*/10 * * * *} 14 advertise<span style="color:blue"><strong class="text-strong">}</strong></span> <span style="color:blue"><strong class="text-strong">{</strong></span>cron -|- {* * * * *} 140 tiempos<span style="color:blue"><strong class="text-strong">}</strong></span> <span style="color:blue"><strong class="text-strong">{</strong></span>cron -|- {* * * * *} 140 envivo<span style="color:blue"><strong class="text-strong">}</strong></span> <span style="color:blue"><strong class="text-strong">{</strong></span>cron -|- {*/1 * * * *} 23 <span style="color:red">warns</span><span style="color:blue"><strong class="text-strong">}</strong></span> <span style="color:blue"><strong class="text-strong">{</strong></span>cron -|- {*/30 * * * *} 4 status<span style="color:blue"><strong class="text-strong">}</strong></span><span style="color:blue"> <strong class="text-strong">{</strong></span>cron -|- {*/30 * * * *} 4 advertise3<span style="color:blue"><strong class="text-strong">}</strong></span> <span style="color:blue"><strong class="text-strong">{</strong></span>cron -|- {*/20 * * * *} 7 advertise2<span style="color:blue"><strong class="text-strong">}</strong></span></div></blockquote>If I put on the party line:<div class="codebox"><p>Code: </p><pre><code>.tcl binds cron</code></pre></div>It returns the same values, but without error.<br>How I can fix it?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12499">juanamores</a> — Mon May 18, 2015 9:59 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[juanamores]]></name></author>
		<updated>2015-05-18T03:57:09-04:00</updated>

		<published>2015-05-18T03:57:09-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=104114#p104114</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=104114#p104114"/>
		<title type="html"><![CDATA[Unbind bind time and bind cron ?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=104114#p104114"><![CDATA[
<blockquote class="uncited"><div><div class="codebox"><p>Code: </p><pre><code>unbind cron - {*/5 * * * *} warns</code></pre></div></div></blockquote> I had already tried but fails in that way.<br><strong class="text-strong">Tcl error [warns]: no such binding</strong><br><span style="text-decoration:underline">What I want is that the<em class="text-italics"> proc warns</em> not run again</span> when the <em class="text-italics">control</em> variable is greater or equal to 4.<br>Perhaps I misspoke and not is with the <em class="text-italics">unbind</em> command that accomplishes what I want.<br>So the <em class="text-italics">proc warns</em> continues to run, that's why the <em class="text-italics">unbind</em> is attempted again and gives the error.<br><br><div class="codebox"><p>Code: </p><pre><code>bind cron - {*/5 * * * *} warnsproc warns {nick uhost hand chan text} {   global canal_admin controlif {$control &gt;= 4} { unbind cron - {*/5 * * * *} warns }   if {(![file exist notices]) || (![file exist dj])} {return}if {[file exist avisos]} {set temp [open "avisos" r]set data [read -nonewline $temp]close $tempset lines [split $data "\n"]set control [lindex $lines 0]if {$control &gt;= 3} {putlog "\002NOTICEs\002 for \002DJ\002  \002disabled."putmsg $canal_admin [encoding convertfrom utf-8 "After 3          warnings, will not be more alert to DJ ."]set control [expr {$control + 1}]return }}   set temp [open "notices" r]set data [read -nonewline $temp]close $tempset lines [split $data "\n"]   set djnickname [lindex $lines 0]set nchan [lindex $lines 1]if {[file exist dj]} {set temp [open "dj" r]set dj [gets $temp]set dj [lindex $dj 0]close $tempif {$djnickname != $dj} {return}}   if {$djnickname == "AutoCHz"} {return}set entra ""set ic ""set x 0set y [llength $nchan]while {$x &lt; $y} {set ic [lindex [split $nchan] $x end]set x [expr {$x + 1}]if { $ic == "" } { continue }if {[onchan $djnickname $ic]} { continue} else {append entra [encoding convertfrom utf-8 " $ic"]}}     set entra [encoding convertfrom utf-8 "$entra"]     putquick "NOTICE $djnickname :For to emit is neccesary join into $entra"     set control [expr {$control + 1}]     set temp [open "avisos" w]     puts $temp $control     close $temp     return}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12499">juanamores</a> — Mon May 18, 2015 3:57 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[willyw]]></name></author>
		<updated>2015-05-16T14:12:07-04:00</updated>

		<published>2015-05-16T14:12:07-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=104111#p104111</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=104111#p104111"/>
		<title type="html"><![CDATA[Unbind bind time and bind cron ?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=104111#p104111"><![CDATA[
Also, go here:<br><a href="http://www.eggheads.org/support/egghtml/1.6.21/tcl-commands.html" class="postlink">http://www.eggheads.org/support/egghtml ... mands.html</a><br>and text search to find:  unbind<br>It will be in the section labeled:<br>9. Miscellaneous commands<br><br>Read about the unbind command there.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10420">willyw</a> — Sat May 16, 2015 2:12 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[SpiKe^^]]></name></author>
		<updated>2015-05-16T11:15:26-04:00</updated>

		<published>2015-05-16T11:15:26-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=104108#p104108</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=104108#p104108"/>
		<title type="html"><![CDATA[Unbind bind time and bind cron ?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=104108#p104108"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>unbind cron - {*/5 * * * *} warns</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7749">SpiKe^^</a> — Sat May 16, 2015 11:15 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[juanamores]]></name></author>
		<updated>2015-05-16T02:53:55-04:00</updated>

		<published>2015-05-16T02:53:55-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=104104#p104104</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=104104#p104104"/>
		<title type="html"><![CDATA[Unbind bind time and bind cron ?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=104104#p104104"><![CDATA[
The code has several  bind crone and bind time commands, activated every x minutes.<br>Example:<div class="codebox"><p>Code: </p><pre><code>bind cron - {*/5 * * * *} warnsproc warns {nick uhost hand chan text} {global canal_admin if {(![file exist notices]) || (![file exist dj])} {return}set temp [open "notices" r]set data [read -nonewline $temp] close $tempset lines [split $data "\n"]     set djnickname [lindex $lines 0]set nchan [lindex $lines 1]if {[file exist dj]} {set temp [open "dj" r]    set dj [gets $temp]set dj [lindex $dj 0]close $tempif {$djnickname != $dj} {return} }if {$djnickname == "AutoCHz"} {return} set entra ""set ic ""set x 0set y [llength $nchan]while {$x &lt; $y} {set ic [lindex [split $nchan] $x end]set x [expr {$x + 1}]if { $ic == "" } { continue }if {[onchan $djnickname $ic]} { continue  } else {  append entra [encoding convertfrom utf-8 " $ic"]  }}  set entra [encoding convertfrom utf-8 "$entra"]  putquick "NOTICE $djnickname :For to emit is neccesary join into $entra"  return      }</code></pre></div>With this script, the bot warns the current DJ every 5 minutes, you should join a x channels to broadcast.<br>I have noticed that this TCL, together with others, lag to much bot.<br>For that reason desire which in x time or x number of warnings, the warning no longer continue,  and that the command will disabled.<br>I can put a counter and reached a x  number put a return command.<br>But what I really want is to see how to make a <em class="text-italics">unbind</em> this command.<br><br>You can perform unbind this commands?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12499">juanamores</a> — Sat May 16, 2015 2:53 am</p><hr />
]]></content>
	</entry>
	</feed>
