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

	<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-08-24T09:43:21-04:00</updated>

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

		<entry>
		<author><name><![CDATA[Dedan]]></name></author>
		<updated>2003-08-24T09:43:21-04:00</updated>

		<published>2003-08-24T09:43:21-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=25575#p25575</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=25575#p25575"/>
		<title type="html"><![CDATA[Trouble with Vars]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=25575#p25575"><![CDATA[
so, it should be:<br><div class="codebox"><p>Code: </p><pre><code>proc flood:dec {var} {   upvar 1 $var v  incr v -1  if {$v &lt; 0} {set v 0} } </code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3472">Dedan</a> — Sun Aug 24, 2003 9:43 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2003-08-24T09:39:44-04:00</updated>

		<published>2003-08-24T09:39:44-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=25574#p25574</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=25574#p25574"/>
		<title type="html"><![CDATA[Trouble with Vars]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=25574#p25574"><![CDATA[
In the flood:dec proc don't forget to call globaly the var variable or use what user sugested.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Sun Aug 24, 2003 9:39 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2003-08-24T09:12:14-04:00</updated>

		<published>2003-08-24T09:12:14-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=25573#p25573</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=25573#p25573"/>
		<title type="html"><![CDATA[Re: Trouble with Vars]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=25573#p25573"><![CDATA[
You pass the variable name to the proc and then try to incr the variable containing the variable name, which obviously won't work unless that name is a integer <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>I suggest using 'upvar' to import the variable...this way you can pass any variable name to the proc without risking screwups because the name is already taken.<br><div class="codebox"><p>Code: </p><pre><code>proc flood:dec {var} {   upvar 1 $var v  if {[incr v -1]&lt;0} {set v 0} }</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2878">user</a> — Sun Aug 24, 2003 9:12 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Dedan]]></name></author>
		<updated>2003-08-24T09:05:06-04:00</updated>

		<published>2003-08-24T09:05:06-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=25571#p25571</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=25571#p25571"/>
		<title type="html"><![CDATA[Trouble with Vars]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=25571#p25571"><![CDATA[
Everytime i try to make a nice timed var, i run into this problem.<br><br>you can increase the value of a var with: "incr codes_flood 1"<br>why can't you decrease it in a "called" proc?<br><br>&lt;stenone&gt; [07:47] Tcl error in script for 'timer400':<br>&lt;stenone&gt; [07:47] expected integer but got "codes_flood"<br><div class="codebox"><p>Code: </p><pre><code>proc stuff {usual stuff} {  global stuff   if flood stuff        if {$codes_found &gt;= $codes_max} {      incr codes_flood 1      utimer 7 [list flood:dec codes_flood]}proc flood:dec {var} {  global codes_flood  incr var -1  if {$var &lt; "0"} {set var "0"}  return 0}</code></pre></div>Thanks for any help given<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3472">Dedan</a> — Sun Aug 24, 2003 9:05 am</p><hr />
]]></content>
	</entry>
	</feed>
