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

	<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>2004-02-12T18:33:45-04:00</updated>

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

		<entry>
		<author><name><![CDATA[stdragon]]></name></author>
		<updated>2004-02-12T18:33:45-04:00</updated>

		<published>2004-02-12T18:33:45-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=33530#p33530</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=33530#p33530"/>
		<title type="html"><![CDATA[problems with dice code]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=33530#p33530"><![CDATA[
Two problems:<br><br>1. [calctotals] should just be calctotals. Use [ ] around it when you want to use the return value, like set blah [calctotals].<br><br>2. The if statement's condition should be in { }, not ( ).<br><br>And a suggestion: if I remember correctly, eggdrop's rand function really sucks. It's better to use tcl's, like this: set dice1 [expr int(rand() * 6) + 1]<br><br>Even better, I found, is to use eggdrop's md5 function to create your own random number generator. It creates a smooth distribution and avoids long runs of the same number.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8">stdragon</a> — Thu Feb 12, 2004 6:33 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2004-02-12T11:31:14-04:00</updated>

		<published>2004-02-12T11:31:14-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=33512#p33512</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=33512#p33512"/>
		<title type="html"><![CDATA[problems with dice code]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=33512#p33512"><![CDATA[
im a starter with tcl and was working on a little dice game, but i just keep getting errors on this code... have been searching around for a couple of hours now and tried lots of things but i cant get it to work....  whenever i call the proc throw evrything goes well untill it calls the proc  calctotals. then it gives me this errormessage over the partyline :  <br><br>[maxxje] [16:17] Tcl error [throw]: syntax error in expression "(3"<br><br>can anyone help me figure this out? TIA<br><br><div class="codebox"><p>Code: </p><pre><code>proc throw {nick host chan args} {    global dice1    global dice2    global total        set dice1 [expr [rand 6] + 1]    set dice2 [expr [rand 6] + 1]        putserv "notice $nick : Dice 1 : $dice1"    putserv "notice $nick : Dice 2 : $dice2"            [calctotals]        putserv "notice $nick : Total score for this throw : $total"    putserv "notice $nick : Required score : ***"}proc calctotals {args} {        global dice1    global dice2    global total    if ($dice1 == $dice2){set total $dice1append total 00    }        if ($dice1 &gt; $dice2){set total $dice1append total $dice2    }        if ($dice2 &gt; $dice1){set total $dice2append total $dice1    }}</code></pre></div><p>Statistics: Posted by Guest — Thu Feb 12, 2004 11:31 am</p><hr />
]]></content>
	</entry>
	</feed>
