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

	<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-04-11T02:42:11-04:00</updated>

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

		<entry>
		<author><name><![CDATA[juanamores]]></name></author>
		<updated>2015-04-11T02:42:11-04:00</updated>

		<published>2015-04-11T02:42:11-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=103783#p103783</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=103783#p103783"/>
		<title type="html"><![CDATA[[SOLVED]]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=103783#p103783"><![CDATA[
Tell you that I have solved the problem.<br>Very grateful to willyw and Spike ^^.<br><br>The idea of <strong class="text-strong">willyw</strong>, I invested because if the <em class="text-italics">set modes2 [getchanmode $chan]</em> command is executed before the timer,was not the result that I wanted, to wait 5sec and refresh the list and then take its value.<br><br>Regarding the comment <strong class="text-strong">Spike^^</strong> related to chan, I had changed my code before and everything was the same.<br><br>The problem was discovered by testing the code in parts, to the point where the BoT froze.<br><br>The error was in the While, had 2 errors, one was a brace:<blockquote class="uncited"><div>if {[string index $modes2 $x] in $modes1<span style="color:red">}</span> == 0 { </div></blockquote>The other most important mistake why the bot froze, was that the x variable is not increased in value.<br>Thus x always worth 0 (zero) and became infinite loop.<br><br>I managed to fix the increase in x variable, placing it at the beginning of the loop.<br>You may wonder but that makes x starts with a value of 1 instead of 0.<br>That's right, but that's no problem because the mode list always starts with the sign ''+" (i.e +mCc ) and this symbol would be index 0 which does not interest me to compare because it is always constant even changing modes.<br><br>Conclusion here is finished and fixed script:<div class="codebox"><p>Code: </p><pre><code>proc pub:addinvite {nick uhost hand chan text} {     if {$text == ""} { putmsg $chan "Please enter \002nick\002 to add."; return 0 } set t [lindex [split $text] 0] set modos [getchanmode $chan] set modes1 [split "$modos" {}]set ti "$t[join !*@*]"   if {![isinvite $ti $chan]} {  newchaninvite $chan $ti invite 0 sticky  utimer 5 [list rest_of_commands $modes1 $chan $t] proc rest_of_commands {modes1 chan t} {   set modes2 [getchanmode $chan]  set largo [string length $modes2]  set x 0  while  {$x &lt; $largo} {  set x [expr {$x + 1}]   if {[string index $modes2 $x] in $modes1 == 0} {          set modchange [string index $modes2 $x]          pushmode $chan "-[join $modchange]"          unset modchange        }}}  putmsg $chan "$t has been added to the autoinvite database $chan" } else { putmsg $chan "$t is already in the autoinvite database $chan" }}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12499">juanamores</a> — Sat Apr 11, 2015 2:42 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[SpiKe^^]]></name></author>
		<updated>2015-04-10T20:55:41-04:00</updated>

		<published>2015-04-10T20:55:41-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=103782#p103782</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=103782#p103782"/>
		<title type="html"><![CDATA[fix sintax commands utimer, after and vwait]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=103782#p103782"><![CDATA[
In your current process, you insist on calling the variable $chan...<blockquote class="uncited"><div>putmsg $chan "The channel current modes are: $modes1"</div></blockquote>...and at least 3 other times.<br><br>The variable $chan Does Not Exist, as you have named the channel var $c...<blockquote class="uncited"><div>proc pub:addinvite {n u h c t} {</div></blockquote>Calling a variable that does not exist will always result in a tcl error.<br><br>I'm with willyw on the whole vwait deal, nothing good can come from it:)<br><br>Beyond that, very little of that code will ever function at all.<br>You should be fixing the script that is causing your modes issue, and not trying to write a script to fix another broken script.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7749">SpiKe^^</a> — Fri Apr 10, 2015 8:55 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[willyw]]></name></author>
		<updated>2015-04-10T15:51:16-04:00</updated>

		<published>2015-04-10T15:51:16-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=103781#p103781</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=103781#p103781"/>
		<title type="html"><![CDATA[fix sintax commands utimer, after and vwait]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=103781#p103781"><![CDATA[
If you want to learn how to use the vwait command, I'm not going to address that.  I don't recall ever using it myself.<br>I can speculate that it is blocking, so that nothing else can happen.<br>Since vwait comes into effect before the utimer expires and sets the var,  it never happens.   The result is a locked up bot.<br>But... that is just me speculating.  Perhaps somebody else will come along that has used vwait, and can help you with that.<br><br>If you just want to get it working,  and your goal is to introduce some delay, then how about another idea:<br><div class="codebox"><p>Code: </p><pre><code>... set modes2 [getchanmode $chan]utimer 5 [list rest_of_commands $c $modes1 $modes2 $t]proc rest_of_commands {chan modes1 modes2  t} {...         commands go here...} </code></pre></div>Get the idea?<br>Just group the rest of the commands in a proc.<br>Use a utimer to call that proc.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10420">willyw</a> — Fri Apr 10, 2015 3:51 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[juanamores]]></name></author>
		<updated>2015-04-10T12:05:43-04:00</updated>

		<published>2015-04-10T12:05:43-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=103780#p103780</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=103780#p103780"/>
		<title type="html"><![CDATA[fix sintax commands utimer, after and vwait]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=103780#p103780"><![CDATA[
<blockquote class="uncited"><div>juanamores: Please show your entire script here, so we can see the context for where these few lines are being called.</div></blockquote> After running 'newchanvite' command, BoT change channel modes, for the reasons explained in this <a href="http://forum.egghelp.org/viewtopic.php?t=19915" class="postlink"> post</a>.<br>Slowly going correcting code to delete the modes set by the bot.<br> I only need to correct timers and vwait command syntax.<br><div class="codebox"><p>Code: </p><pre><code>bind pub o|o !addinvite pub:addinviteproc pub:addinvite {n u h c t} {###### I store channel modes in the variable modes1 #####       set modes1 [getchanmode $c]###### Show values on channel ######   putmsg $chan "The channel current modes are: $modes1"##### Add mask to nick ($t)#####   set t "$t[join !*@*]"##### Consults if the nick is on the invite list Channel ($t)#####      if {![isinvite $t $chan]} {     newchaninvite $chan $t invite 0 sticky##### I add this timer for 5 seconds to allow time for the list to refresh (Has the correct syntax the next line, utimer command or need after command?)#####     utimer 5 [list set modes2 [getchanmode $chan]] ##### HERE is where the problems begin, because the variable $modes2 is not yet set will by the timer 5 seconds!#########The code stop here, until $modes2 variable is not set, and then continue to the next line when variable $modes2 be set. ########      vwait modes2 putmsg $chan "Now the channel current modes are: $modes2"     set large [string length $modes2]     set x 0     while  {$x &lt; $large} {         if {[string index $modes2 $x] in $modes1} == 0 {          set modchange [string index $modes2 $x]          pushmode $chan "-[join $modchange]"          unset modchange         }     incr $x     }    putmsg $chan "$t has been added to the autoinvite database $c"    return   } else { putmsg $chan "$t is already in the autoinvite database $c"     }}</code></pre></div>If I use the line: <blockquote class="uncited"><div>utimer 5 [list set modes2 [getchanmode $chan]]</div></blockquote>Or the line: <blockquote class="uncited"><div>after 5000 {set modes2 [getchanmode $chan]}</div></blockquote>Error:can't read "modes2": no such variable. <br><br>If I add as a line 1 of the proc: <blockquote class="uncited"><div>global modes2</div></blockquote> The bot is frozen and I have to kill eggdrop process from Windows Task Manager.<br><br>Something is wrong with timers compared with vwait command.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12499">juanamores</a> — Fri Apr 10, 2015 12:05 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[SpiKe^^]]></name></author>
		<updated>2015-04-10T10:40:47-04:00</updated>

		<published>2015-04-10T10:40:47-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=103779#p103779</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=103779#p103779"/>
		<title type="html"><![CDATA[fix sintax commands utimer, after and vwait]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=103779#p103779"><![CDATA[
juanamores: Please show your entire script here, so we can see the context for where these few lines are being called.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7749">SpiKe^^</a> — Fri Apr 10, 2015 10:40 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[willyw]]></name></author>
		<updated>2015-04-10T09:33:32-04:00</updated>

		<published>2015-04-10T09:33:32-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=103778#p103778</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=103778#p103778"/>
		<title type="html"><![CDATA[Re: fix sintax commands utimer, after and vwait]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=103778#p103778"><![CDATA[
Here is some reading material that explains how to use timer and utimer like that.<br><br><a href="http://web.archive.org/web/20070205113405/http://www.peterre.info/characters.html" class="postlink">http://web.archive.org/web/200702051134 ... cters.html</a><br><br>The part you want it about half way down, under:<blockquote class="uncited"><div>The second golden rule of Tcl for eggdrop</div></blockquote><br>I hope this helps.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10420">willyw</a> — Fri Apr 10, 2015 9:33 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[juanamores]]></name></author>
		<updated>2015-04-10T06:44:02-04:00</updated>

		<published>2015-04-10T06:44:02-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=103777#p103777</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=103777#p103777"/>
		<title type="html"><![CDATA[fix sintax commands utimer, after and vwait]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=103777#p103777"><![CDATA[
<span style="text-decoration:underline">What is the correct syntax for this line</span>?<div class="codebox"><p>Code: </p><pre><code>utimer 5 {set modes [getchanmode $chan];putmsg $chan "Current modes: $modes"}</code></pre></div><strong class="text-strong">Error</strong>:can't read "chan": no such variable. <br><br><span style="text-decoration:underline">What is the correct syntax for this code</span>?<div class="codebox"><p>Code: </p><pre><code>after 5000 { set modes [getchanmode $chan]  }putmsg $chan "setting modes....."vwait modesputmsg $chan "current modes are $modes"</code></pre></div><strong class="text-strong">Error</strong>:  can't wait for variable "modes": would wait forever"<br><br>Please, fix these errors, I read and read but I don´t understand.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12499">juanamores</a> — Fri Apr 10, 2015 6:44 am</p><hr />
]]></content>
	</entry>
	</feed>
