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

	<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-12-21T15:31:36-04:00</updated>

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

		<entry>
		<author><name><![CDATA[Ofloo]]></name></author>
		<updated>2004-12-21T15:31:36-04:00</updated>

		<published>2004-12-21T15:31:36-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=44321#p44321</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=44321#p44321"/>
		<title type="html"><![CDATA[Simple random-script, please help me complete it]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=44321#p44321"><![CDATA[
<blockquote class="uncited"><div>proc myproc {n u h c t} {<br> if {....} { #do stuff }<br> if {....} { #do stuff }<br> if {....} { #do stuff }<br> if {....} { #do stuff }<br> if {....} { #do stuff }<br>} </div></blockquote>this will trigger all the elseif will end on the first condition it meets<br><br>for example lets say the number is 5 then $number is  smaller then 35 but also smaller then 65 !!!!!<br><br>same with bigger if number is 60 then it is bigger then 30 and bigger then 10 .. so thats why elseif it will enter the first condition it meets and not go on any  further unless you use return on the end of the if statement .. <br><div class="codebox"><p>Code: </p><pre><code>if {....} {   #do stuff    return}if {....} {   #do stuff   return}if {....} {   #do stuff   return}if {....} {   #do stuff   return}if {....} {   #do stuff   return}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3151">Ofloo</a> — Tue Dec 21, 2004 3:31 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[awyeah]]></name></author>
		<updated>2004-12-19T21:02:05-04:00</updated>

		<published>2004-12-19T21:02:05-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=44188#p44188</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=44188#p44188"/>
		<title type="html"><![CDATA[Simple random-script, please help me complete it]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=44188#p44188"><![CDATA[
If you didn't understand the structure logic. Here it is to make it simpler. Basically, the structure is like:<br><div class="codebox"><p>Code: </p><pre><code>proc myproc {n u h c t} { if {....} { #do stuff } elseif {....} { #do stuff } elseif {....} { #do stuff } elseif {....} { #do stuff } else { #do stuff }}</code></pre></div>{....} being the condition to satisfy. Remember "else" will have no condition to satisfy as it will be your last choice, saying your last resort, if every condition before it does not satisfy and run, then else will do the job.<br><br>Or you can do a similar thing with alot of "if's" and it will still work as well. But note this one does not have an "else". So if the conditions are satisfied they will run, otherwise they wont. Generally this type of structure is used if more than one condition is true; for multiple conditions.<br><div class="codebox"><p>Code: </p><pre><code>proc myproc {n u h c t} { if {....} { #do stuff } if {....} { #do stuff } if {....} { #do stuff } if {....} { #do stuff } if {....} { #do stuff }}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=4875">awyeah</a> — Sun Dec 19, 2004 9:02 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[spock]]></name></author>
		<updated>2004-12-19T15:30:24-04:00</updated>

		<published>2004-12-19T15:30:24-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=44176#p44176</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=44176#p44176"/>
		<title type="html"><![CDATA[Simple random-script, please help me complete it]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=44176#p44176"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>bind pub - !result pubresultproc pubresult { n u h c t } {   set number [expr {[rand 100]+1}]   if {$number &lt; 5} {    set result "Critical failure"  } elseif {$number &lt; 15} {    set result "Very bad"  } elseif {$number &lt; 35} {    set result "Bad"  } elseif {$number &lt; 65} {    set result "Average"  } elseif {$number &lt; 85} {    set result "Good"  } elseif {$number &lt; 95} {    set result "Very Good"  } else {     set result "Critical success"   }   puthelp "PRIVMSG $c :Result... $result ($number)" }</code></pre></div>elseif is not a command but an argument to if<br><br>edit1&amp;2: fixed broken english<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2369">spock</a> — Sun Dec 19, 2004 3:30 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[borys85]]></name></author>
		<updated>2004-12-19T15:03:12-04:00</updated>

		<published>2004-12-19T15:03:12-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=44174#p44174</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=44174#p44174"/>
		<title type="html"><![CDATA[Simple random-script, please help me complete it]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=44174#p44174"><![CDATA[
Hello!<br><br>We're playing RPG online (by IRC) and I need a script which can "simulate" dice. It has to do this: When user types "!result" it picks a random integer between 1-100 (1 and 100 included) and then it prints out the result of the action (as text) based on the picked number.<br><br>I think I managed to write the main part of this script. It looks like this:<br><div class="codebox"><p>Code: </p><pre><code>{set number [rand 100]set number [expr $string + 1]if {$number &gt; 0} then {set result "Critical failure"}if {$number &gt; 5} then {set result Very bad"}if {$number &gt; 15} then {set result "Bad"}if {$number &gt; 35} then {set result "Average"}if {$number &gt; 65} then {set result "Good"}if {$number &gt; 85} then {set result "Very good"}if ($number &gt; 95} then {set result "Critical success"}puthelp "PRIVMSG $chan :Result... $result"}</code></pre></div>I think it's OK (is it?). I know I should have used "elseif", but Eggbot didn't recognize the command. Kinda strange...<br><br>Anyway, I know very little about Tcl. The script above does not work. It is missing proc-line and bind-line. Could you please tell me how they shall look like?<br><br>Thank you for your help<br>Borys<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5810">borys85</a> — Sun Dec 19, 2004 3:03 pm</p><hr />
]]></content>
	</entry>
	</feed>
