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

	<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-10-11T07:33:31-04:00</updated>

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

		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2003-10-11T07:33:31-04:00</updated>

		<published>2003-10-11T07:33:31-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=28254#p28254</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=28254#p28254"/>
		<title type="html"><![CDATA[!calc - calculator script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=28254#p28254"><![CDATA[
<blockquote class="uncited"><div>Can anybody else solve that one, I am finding it very hard.<br><br>Looking at my code, it is near impossible. It would require that the proc physicaly be called twice.<br><br>The puthelp line is only called once, and isn't in a loop of any kind.</div></blockquote>Your switch is missing a }, so the putserv is in fact inside the foreach loop ....if you get the code compiled by adding a } to the end (which normal people wouldn't do <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_razz.gif" width="15" height="15" alt=":P" title="Razz">)<blockquote class="uncited"><div><div class="codebox"><p>Code: </p><pre><code>set x 0 set z +</code></pre></div><div class="codebox"><p>Code: </p><pre><code>if {[llength [split $arg]] == 1} { set arg [join [split $arg {}]] }</code></pre></div></div></blockquote>!calc 10+10 = 2 if you do that <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=2878">user</a> — Sat Oct 11, 2003 7:33 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ppslim]]></name></author>
		<updated>2003-10-11T06:51:16-04:00</updated>

		<published>2003-10-11T06:51:16-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=28249#p28249</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=28249#p28249"/>
		<title type="html"><![CDATA[!calc - calculator script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=28249#p28249"><![CDATA[
Can anybody else solve that one, I am finding it very hard.<br><br>Looking at my code, it is near impossible. It would require that the proc physicaly be called twice.<br><br>The puthelp line is only called once, and isn't in a loop of any kind.<br><br>As for your outputs, 5+5 is invalid, due to the way to does syntax and security checks.<br><br>You have two options, you can try using the other script provided, or add this small bit of code below<br><div class="codebox"><p>Code: </p><pre><code>set x 0   set z +</code></pre></div><div class="codebox"><p>Code: </p><pre><code>if {[llength [split $arg]] == 1} { set arg [join [split $arg {}]] }</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2">ppslim</a> — Sat Oct 11, 2003 6:51 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[3zzy]]></name></author>
		<updated>2003-10-11T05:56:08-04:00</updated>

		<published>2003-10-11T05:56:08-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=28247#p28247</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=28247#p28247"/>
		<title type="html"><![CDATA[!calc - calculator script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=28247#p28247"><![CDATA[
Starange behaviour..<br><br>[11:55:10] [@3zzy]: !calc 5+5<br>[11:55:15] [@barabashka]: Invalid character found<br><br>[11:54:41] [@3zzy]: !calc 5 + 5<br>[11:54:43] [@barabashka]: Calculated value = 5<br>[11:54:45] [@barabashka]: Calculated value = 10<br><br>[11:55:34] [@3zzy]: !calc 5 * 5<br>[11:55:36] [@barabashka]: Calculated value = 5<br>[11:55:38] [@barabashka]: Calculated value = 25<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3845">3zzy</a> — Sat Oct 11, 2003 5:56 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2003-10-10T07:14:12-04:00</updated>

		<published>2003-10-10T07:14:12-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=28232#p28232</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=28232#p28232"/>
		<title type="html"><![CDATA[!calc - calculator script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=28232#p28232"><![CDATA[
<blockquote class="uncited"><div>Why not use errinfo to give that description then.</div></blockquote>Because of the "0+" making it return the wrong error (the error is captured by catch in my proc, but i don't display it)<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2878">user</a> — Fri Oct 10, 2003 7:14 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ppslim]]></name></author>
		<updated>2003-10-10T07:11:57-04:00</updated>

		<published>2003-10-10T07:11:57-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=28231#p28231</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=28231#p28231"/>
		<title type="html"><![CDATA[!calc - calculator script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=28231#p28231"><![CDATA[
Why not use errinfo to give that description then.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2">ppslim</a> — Fri Oct 10, 2003 7:11 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2003-10-10T06:56:41-04:00</updated>

		<published>2003-10-10T06:56:41-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=28230#p28230</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=28230#p28230"/>
		<title type="html"><![CDATA[secure expr]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=28230#p28230"><![CDATA[
Here's a safe way to expr stuff (works with math functions like sin/rand/abs etc too). The price you have to pay is less descriptive error messages.<br><div class="codebox"><p>Code: </p><pre><code>proc sexpr {e} {if {[catch {expr 0+[list $e]} r]} {set e "syntax error in expression \"$e\""} {set e "$e = $r"}}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2878">user</a> — Fri Oct 10, 2003 6:56 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ppslim]]></name></author>
		<updated>2003-10-10T06:33:50-04:00</updated>

		<published>2003-10-10T06:33:50-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=28229#p28229</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=28229#p28229"/>
		<title type="html"><![CDATA[!calc - calculator script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=28229#p28229"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>proc pub:calc {nick uh hand chan arg} {  set x 0  set z +  foreach a [split $arg] {    switch -- $a {      {*} -      {-} -      {/} -      {+} { set z $a }      default {         if {![regexp {^[0-9]+$} $a]} {           puthelp "PRIVMSG $chan :Invalid character found"           return         }         set x [expr $x $z $a]      }  }  puthelp "PRIVMSG $chan :Calculated value = $x"}bind pub - "!calc" pub:calc</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2">ppslim</a> — Fri Oct 10, 2003 6:33 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[3zzy]]></name></author>
		<updated>2003-10-10T06:10:25-04:00</updated>

		<published>2003-10-10T06:10:25-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=28227#p28227</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=28227#p28227"/>
		<title type="html"><![CDATA[!calc - calculator script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=28227#p28227"><![CDATA[
Is there one out there? not the one which also works as a definition engine, i need only a calculator script which would respond to public commands e.g. !calc 5+5 etc..<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3845">3zzy</a> — Fri Oct 10, 2003 6:10 am</p><hr />
]]></content>
	</entry>
	</feed>
