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

	<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-08-15T17:42:42-04:00</updated>

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

		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2003-08-15T17:42:42-04:00</updated>

		<published>2003-08-15T17:42:42-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=25031#p25031</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=25031#p25031"/>
		<title type="html"><![CDATA[return random nick from channel nicklist]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=25031#p25031"><![CDATA[
Nothing, after I've posted I've thinked a bit on the thinkgs stdragon said and he and now you where right. the lindex makes it be correct.. My appologies for that.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Fri Aug 15, 2003 5:42 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Dedan]]></name></author>
		<updated>2003-08-15T16:10:33-04:00</updated>

		<published>2003-08-15T16:10:33-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=25027#p25027</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=25027#p25027"/>
		<title type="html"><![CDATA[return random nick from channel nicklist]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=25027#p25027"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>    set spin_list "nick1 nick2 nick3 nick4 nick5"    set spin_length [llength $spin_list] </code></pre></div> $spin_length is 5<br><div class="codebox"><p>Code: </p><pre><code>    set spin_num [rand $spin_length}</code></pre></div> $spin_num is a number between 0-4<br><div class="codebox"><p>Code: </p><pre><code>    set spin_nick [lindex $spin_list $spin_num] </code></pre></div>[lindex]<br>This command treats list as a Tcl list and returns the index'th element from <br>it (0 refers to the first element of the list).<br><br>if $spin_num is 0, it would return the first element of the list (nick1)<br><br>if $spin_num is 4, it would return the fifth element of the list (nick5)<br><br>I don't see the problem Caesar, what am i missing?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3472">Dedan</a> — Fri Aug 15, 2003 4:10 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2003-08-15T13:48:59-04:00</updated>

		<published>2003-08-15T13:48:59-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=25024#p25024</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=25024#p25024"/>
		<title type="html"><![CDATA[return random nick from channel nicklist]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=25024#p25024"><![CDATA[
Umm.. you haven't got my point. I've said that the rand thing makes it choose a random number from 0 to the number you've have choosen to get a random number from it except it. Also, I do agree with you on the list part, I haven't said that the list part is wrong or something..<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Fri Aug 15, 2003 1:48 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[stdragon]]></name></author>
		<updated>2003-08-15T13:18:40-04:00</updated>

		<published>2003-08-15T13:18:40-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=25022#p25022</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=25022#p25022"/>
		<title type="html"><![CDATA[return random nick from channel nicklist]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=25022#p25022"><![CDATA[
Dedan -<br><br>Your code looks good except for this bit:<br><br>    set spin_list [lreplace $spin_list $nick $nick]<br>    set spin_list [lreplace $spin_list $botnick $botnick]<br><br>To remove $nick and $botnick from the list, you have to use lsearch to find it and then use that index to remove it.<br><br>set nick_idx [lsearch -exact $spin_list $nick]<br>set spin_list [lreplace $spin_list $nick_idx $nick_idx]<br><br>etc<br><br><br>Caesar -<br><br>Lists go from 0 to lastidx-1, so Dedan's code is right.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8">stdragon</a> — Fri Aug 15, 2003 1:18 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2003-08-15T11:23:36-04:00</updated>

		<published>2003-08-15T11:23:36-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=25016#p25016</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=25016#p25016"/>
		<title type="html"><![CDATA[return random nick from channel nicklist]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=25016#p25016"><![CDATA[
Test this:<div class="codebox"><p>Code: </p><pre><code>.tcl putlog "[rand 10] [rand 10] [rand 10] [rand 10] [rand 10] [rand 10] [rand 10] [rand 10] [rand 10] [rand 10] [rand 10] [rand 10] [rand 10] [rand 10]"</code></pre></div>and you'll see what I'm talking about.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Fri Aug 15, 2003 11:23 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Dedan]]></name></author>
		<updated>2003-08-15T10:58:05-04:00</updated>

		<published>2003-08-15T10:58:05-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=25015#p25015</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=25015#p25015"/>
		<title type="html"><![CDATA[return random nick from channel nicklist]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=25015#p25015"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>    set spin_num [rand $spin_length]     set spin_nick [lindex $spin_list $spin_num] </code></pre></div>i thought the first element of the list was considered "0"<br>so, if the value of spin_num was 0,<br>wouldn't it select the first element of the list?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3472">Dedan</a> — Fri Aug 15, 2003 10:58 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2003-08-15T10:13:03-04:00</updated>

		<published>2003-08-15T10:13:03-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=25010#p25010</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=25010#p25010"/>
		<title type="html"><![CDATA[return random nick from channel nicklist]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=25010#p25010"><![CDATA[
The <em class="text-italics">set spin_num [rand $spin_length]</em> should be <em class="text-italics">set spin_num [expr [rand $spin_length] +1]</em> because of the rand. Example: rand 10 will allways be a number from 0 to 9 so.. by adding 1 to the result of the rand actualy is a random number from 1 to 10 inccluding 1 and 10, as it should be.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Fri Aug 15, 2003 10:13 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Dedan]]></name></author>
		<updated>2003-08-15T09:14:37-04:00</updated>

		<published>2003-08-15T09:14:37-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=25008#p25008</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=25008#p25008"/>
		<title type="html"><![CDATA[return random nick from channel nicklist]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=25008#p25008"><![CDATA[
Thanks for the help.<br>i am going to try this:<br><div class="codebox"><p>Code: </p><pre><code>    set spin_list [chanlist $chan]    set spin_list [lreplace $spin_list $nick $nick]    set spin_list [lreplace $spin_list $botnick $botnick]    set spin_length [llength $spin_list]    if {[$spin_length == 0]} {    putserv "PRIVMSG $chan :You need more players"    return 0    }    set spin_num [rand $spin_length]    set spin_nick [lindex $spin_list $spin_num]</code></pre></div>I am still working on that script for kaamal<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3472">Dedan</a> — Fri Aug 15, 2003 9:14 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2003-08-15T09:10:49-04:00</updated>

		<published>2003-08-15T09:10:49-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=25006#p25006</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=25006#p25006"/>
		<title type="html"><![CDATA[return random nick from channel nicklist]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=25006#p25006"><![CDATA[
Umm.. yes, the code you've sugested should do the trick. Thanks for the tip.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Fri Aug 15, 2003 9:10 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2003-08-15T04:39:31-04:00</updated>

		<published>2003-08-15T04:39:31-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=24986#p24986</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=24986#p24986"/>
		<title type="html"><![CDATA[return random nick from channel nicklist]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=24986#p24986"><![CDATA[
<blockquote class="uncited"><div>Tip:<div class="codebox"><p>Code: </p><pre><code>set position [expr [rand [llength [chanlist $chan]]] + 1]</code></pre></div></div></blockquote>since list commands are zero-based, the llength is always "last element index+1" and since rand returns a number between 0 and the supplied integer-1 no expr is needed.<br><div class="codebox"><p>Code: </p><pre><code>lindex [chanlist $c] [rand [llength [chanlist $c]]]</code></pre></div>Keep in mind that an empty chanlist might be returned and cause rand to error on you (depending on what triggered the code of course), so you better check the llength first (or use expr rand() to do the randomizing)<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2878">user</a> — Fri Aug 15, 2003 4:39 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[rolandguy]]></name></author>
		<updated>2003-08-15T01:31:44-04:00</updated>

		<published>2003-08-15T01:31:44-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=24982#p24982</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=24982#p24982"/>
		<title type="html"><![CDATA[return random nick from channel nicklist]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=24982#p24982"><![CDATA[
chanlist &lt;channel&gt; [flags[&amp;chanflags]]<br><br>*please* read the doco...it's one of the eggdrop tcl commands, think you'll find everything you need there <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink"><br><br>roland<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3658">rolandguy</a> — Fri Aug 15, 2003 1:31 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2003-08-15T01:12:52-04:00</updated>

		<published>2003-08-15T01:12:52-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=24978#p24978</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=24978#p24978"/>
		<title type="html"><![CDATA[return random nick from channel nicklist]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=24978#p24978"><![CDATA[
<blockquote class="uncited"><div>set random_nick [lindex $chan_ppl $mynum] </div></blockquote>Huh? How exactly do you extract that nick and from where did you got that $chan_ppl variable?<br><br>Tip:<div class="codebox"><p>Code: </p><pre><code>set position [expr [rand [llength [chanlist $chan]]] + 1]</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Fri Aug 15, 2003 1:12 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[rolandguy]]></name></author>
		<updated>2003-08-14T16:58:49-04:00</updated>

		<published>2003-08-14T16:58:49-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=24960#p24960</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=24960#p24960"/>
		<title type="html"><![CDATA[return random nick from channel nicklist]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=24960#p24960"><![CDATA[
first thing you need is a nicklist...<br><br>chanlist &lt;channel&gt; [flags[&amp;chanflags]]  # see doco<br><br>then find a random number between 0 and the length of that list (llength).<br><br>set mynum [rand $list_length]<br><br>then pull the nick at mynum in the list<br><br>set random_nick [lindex $chan_ppl $mynum]<br><br>hope this helps <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink"><br><br>roland<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3658">rolandguy</a> — Thu Aug 14, 2003 4:58 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2003-08-14T17:01:57-04:00</updated>

		<published>2003-08-14T16:57:29-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=24959#p24959</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=24959#p24959"/>
		<title type="html"><![CDATA[return random nick from channel nicklist]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=24959#p24959"><![CDATA[
EDIT:<div class="codebox"><p>Code: </p><pre><code>* censored to train your brain :P *</code></pre></div>(I initially had code spoiling the point of roland's post)<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2878">user</a> — Thu Aug 14, 2003 4:57 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Dedan]]></name></author>
		<updated>2003-08-14T16:39:16-04:00</updated>

		<published>2003-08-14T16:39:16-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=24957#p24957</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=24957#p24957"/>
		<title type="html"><![CDATA[return random nick from channel nicklist]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=24957#p24957"><![CDATA[
I have no idea how to even start to<br>return a random nick from channel nicklist<br><br><br>Thanks for any help given<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3472">Dedan</a> — Thu Aug 14, 2003 4:39 pm</p><hr />
]]></content>
	</entry>
	</feed>
