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

	<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-11-28T17:07:16-04:00</updated>

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

		<entry>
		<author><name><![CDATA[cerberus_gr]]></name></author>
		<updated>2003-11-28T17:07:16-04:00</updated>

		<published>2003-11-28T17:07:16-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=30831#p30831</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=30831#p30831"/>
		<title type="html"><![CDATA[proc decr as incr in tcl - input an expression in proc]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=30831#p30831"><![CDATA[
Thx a lot both <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>1) user I haven't taught tcl and I know only a few commands and I didn't know that in incr command u would use numbers &lt; 0, so my problem has sold<br><br>2) Perfect<br><br>P.S. in "1 = 1" expression I forgot one more "="  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"> and in my code I didn't returned anything, so that's why I wrote null <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"> Thanks a lot <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=2661">cerberus_gr</a> — Fri Nov 28, 2003 5:07 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2003-11-27T13:03:47-04:00</updated>

		<published>2003-11-27T13:03:47-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=30774#p30774</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=30774#p30774"/>
		<title type="html"><![CDATA[proc decr as incr in tcl - input an expression in proc]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=30774#p30774"><![CDATA[
1) To work with the actual variable you'll have to import it using 'upvar' or execute the expr/incr in the scope your variable exists in using 'uplevel'<div class="codebox"><p>Code: </p><pre><code>proc decr var {upvar 1 $var blaincr bla -1}</code></pre></div> ...or: <div class="codebox"><p>Code: </p><pre><code>proc decr var {uplevel 1 [list incr $var -1]}</code></pre></div>2) use 'expr':<div class="codebox"><p>Code: </p><pre><code>proc chk expr {if {[expr $expr]} {return "true"} {return "null"}}</code></pre></div> ...or use the C-style "if-then-else" structure:<div class="codebox"><p>Code: </p><pre><code>proc chk expr {expr $expr?"true":"null"}</code></pre></div>...but then you might aswell use 'expr' directly where you want the check imo. Oh, and btw: "1 = 1" is not a valid expression in tcl and the string "null" doesn't mean anything speacial.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2878">user</a> — Thu Nov 27, 2003 1:03 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Sir_Fz]]></name></author>
		<updated>2003-11-27T12:03:25-04:00</updated>

		<published>2003-11-27T12:03:25-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=30772#p30772</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=30772#p30772"/>
		<title type="html"><![CDATA[proc decr as incr in tcl - input an expression in proc]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=30772#p30772"><![CDATA[
your code should be: <div class="codebox"><p>Code: </p><pre><code>proc decr { var } { set var "[expr $var -1]" }</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3085">Sir_Fz</a> — Thu Nov 27, 2003 12:03 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[cerberus_gr]]></name></author>
		<updated>2003-11-27T11:35:13-04:00</updated>

		<published>2003-11-27T11:35:13-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=30770#p30770</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=30770#p30770"/>
		<title type="html"><![CDATA[proc decr as incr in tcl - input an expression in proc]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=30770#p30770"><![CDATA[
$var will return the name of the variable and not it's value<br><br>if ($hello == 10) then "decr hello" will set var = hello and not var = 10<br>I want to "read" bot name and value, $var returns the name, but HOW could I take the value?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2661">cerberus_gr</a> — Thu Nov 27, 2003 11:35 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Sir_Fz]]></name></author>
		<updated>2003-11-27T11:17:15-04:00</updated>

		<published>2003-11-27T11:17:15-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=30769#p30769</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=30769#p30769"/>
		<title type="html"><![CDATA[proc decr as incr in tcl - input an expression in proc]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=30769#p30769"><![CDATA[
try $var instead of ${var}<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3085">Sir_Fz</a> — Thu Nov 27, 2003 11:17 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[cerberus_gr]]></name></author>
		<updated>2003-11-27T11:37:54-04:00</updated>

		<published>2003-11-27T10:54:22-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=30768#p30768</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=30768#p30768"/>
		<title type="html"><![CDATA[proc decr as incr in tcl - input an expression in proc]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=30768#p30768"><![CDATA[
Hello,<br><br>1)<br>I want to write a procedure decr as incr command in tcl.<br><br>I have already done this: <div class="codebox"><p>Code: </p><pre><code>proc decr { var } { set ${var} "[expr ${var} - 1]" }</code></pre></div>but it stops with error:<br>Tcl error: can't read "$var": no such variable<br><br>set variable_name variable_value<br>variable_name = ?<br>variable_value = ?<br><br>2)<br>I want to have a procedure which has as input an expression<br><br>examples:<br>proc chk { expr } { if {$expr} { return "true" } }<br><br>[chk "1 = 1"]  -&gt; true<br>[chk "string match a hsagsa'] -&gt; true<br>[chk "3 &gt;= 4"] -&gt; null<br><br>but my code just checks if $expr is/isn't " "<br><br>Any help?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2661">cerberus_gr</a> — Thu Nov 27, 2003 10:54 am</p><hr />
]]></content>
	</entry>
	</feed>
