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

	<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>2002-12-27T00:13:08-04:00</updated>

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

		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2002-12-27T00:13:08-04:00</updated>

		<published>2002-12-27T00:13:08-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=14617#p14617</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=14617#p14617"/>
		<title type="html"><![CDATA[Redirecting Output]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=14617#p14617"><![CDATA[
Thanks for the quick reply!  'catch' is exactly what I was looking for.  Here is the final code for anyone interested:<div class="codebox"><p>Code: </p><pre><code>bind pub - !calc calcproc calc { nick uhost hand chan arg } {    if {[llength $arg]==0} {        return 0    }    if { [catch { set result [expr $arg]} err] } {        putserv "PRIVMSG $chan :$nick: Error:  $err"    } else {        putserv "PRIVMSG $chan :$nick: $result"    }}</code></pre></div>thanks again,<br>acm<p>Statistics: Posted by Guest — Fri Dec 27, 2002 12:13 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[tainted]]></name></author>
		<updated>2002-12-26T23:59:16-04:00</updated>

		<published>2002-12-26T23:59:16-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=14616#p14616</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=14616#p14616"/>
		<title type="html"><![CDATA[Redirecting Output]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=14616#p14616"><![CDATA[
You should probably catch it, with something similiar to this (correct me if im wrong guys)<div class="codebox"><p>Code: </p><pre><code>if {[catch blah blah e]} {putserv "etc etc"return}&lt;on to the existing code&gt;</code></pre></div>Make sure to use catch to execute the calc string, otherwise it wont do any good. You could also just check if the operation is "/" and then if the number is not zero, put I'll let you try out this way first.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=1256">tainted</a> — Thu Dec 26, 2002 11:59 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2002-12-26T23:06:15-04:00</updated>

		<published>2002-12-26T23:06:15-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=14615#p14615</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=14615#p14615"/>
		<title type="html"><![CDATA[Redirecting Output]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=14615#p14615"><![CDATA[
I wrote a little !calc script:<div class="codebox"><p>Code: </p><pre><code>bind pub - !calc calcproc calc { nick uhost hand chan arg } {    if {[llength $arg]==0} {        return 0    }    set result [expr $arg]    putserv "PRIVMSG $chan :$nick: $result"}</code></pre></div>It works exactly how I want it to, <strong class="text-strong">except</strong> when there are problems with the arguments.  Example:<br><br>!calc 4 / 0<br><br>This returns the following in botnet (and nothing to the channel):<br><br>Tcl error [calc]: divide by zero<br><br>I would like this to print out to the channel instead.  Is it possible to do output redirection like this?<p>Statistics: Posted by Guest — Thu Dec 26, 2002 11:06 pm</p><hr />
]]></content>
	</entry>
	</feed>
