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

	<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>2005-10-24T12:13:11-04:00</updated>

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

		<entry>
		<author><name><![CDATA[romain]]></name></author>
		<updated>2005-10-24T12:13:11-04:00</updated>

		<published>2005-10-24T12:13:11-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=56794#p56794</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=56794#p56794"/>
		<title type="html"><![CDATA[array question]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=56794#p56794"><![CDATA[
Yeah, it's ok.<br>Thanks<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6856">romain</a> — Mon Oct 24, 2005 12:13 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[De Kus]]></name></author>
		<updated>2005-10-24T07:08:32-04:00</updated>

		<published>2005-10-24T07:08:32-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=56787#p56787</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=56787#p56787"/>
		<title type="html"><![CDATA[array question]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=56787#p56787"><![CDATA[
try:<div class="codebox"><p>Code: </p><pre><code>proc pub:test {nick host hand chan arg} {  foreach {x y} [array get ::kick] {    if {[string is integer -s $y]} {      lappend score [list $x $y]    }  }  set i 1  foreach {e} [lsort -decreasing -integer -index 1 $score] {    puthelp "PRIVMSG $chan :$i. [lindex $e 0] with [lindex $e 1] kicks"    if {[incr i] == 10} {break}  }}</code></pre></div>if you wonder why I used 2 foreach... the problem is that array get will not return a proper sublist, but just a list which uneven elements are the names and even ones are the values. So first a proper sublist must be created then we can use lsort to sort it <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_biggrin.gif" width="15" height="15" alt=":D" title="Very Happy">. Change the '== 10' thing to whatever maximum number of results you want <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink">.<br>btw. the is integer check will prevent possible errors to occur in lsort from unproper array values. Since I dont know the script that created it, I wont trust it <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_biggrin.gif" width="15" height="15" alt=":D" title="Very Happy">.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2382">De Kus</a> — Mon Oct 24, 2005 7:08 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[romain]]></name></author>
		<updated>2005-10-24T03:57:57-04:00</updated>

		<published>2005-10-24T03:57:57-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=56786#p56786</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=56786#p56786"/>
		<title type="html"><![CDATA[array question]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=56786#p56786"><![CDATA[
Hello,<br><br>I've more difficulty to write the results like this<br><blockquote class="uncited"><div>1. kili with 30 kicks <br>2. lili with 15 kicks <br>3. lolo with 10 kicks <br>4. kilo with 3 kicks</div></blockquote>if somebody can help me <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_question.gif" width="15" height="15" alt=":?:" title="Question"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6856">romain</a> — Mon Oct 24, 2005 3:57 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[De Kus]]></name></author>
		<updated>2005-10-19T15:54:18-04:00</updated>

		<published>2005-10-19T15:54:18-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=56718#p56718</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=56718#p56718"/>
		<title type="html"><![CDATA[array question]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=56718#p56718"><![CDATA[
decreasing in which way? Value or element? For value (which would put the one with the most kicks to the top) you will need to add ' -integer -index 1' to the parameters of lsort.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2382">De Kus</a> — Wed Oct 19, 2005 3:54 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[KrzychuG]]></name></author>
		<updated>2005-10-19T14:24:25-04:00</updated>

		<published>2005-10-19T14:24:25-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=56715#p56715</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=56715#p56715"/>
		<title type="html"><![CDATA[array question]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=56715#p56715"><![CDATA[
Replace <div class="codebox"><p>Code: </p><pre><code>[array get ::score]</code></pre></div>with<div class="codebox"><p>Code: </p><pre><code>[lsort -decreasing [array get ::score]]</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3672">KrzychuG</a> — Wed Oct 19, 2005 2:24 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[romain]]></name></author>
		<updated>2005-10-24T03:58:51-04:00</updated>

		<published>2005-10-19T09:20:28-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=56709#p56709</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=56709#p56709"/>
		<title type="html"><![CDATA[array question]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=56709#p56709"><![CDATA[
hello,<br><br>I have this script<div class="codebox"><p>Code: </p><pre><code>set ::kick(lolo) 10set ::kick(lili) 15set ::kick(kilo) 3set ::kick(kili) 30bind pub - !kick pub:testproc pub:test {nick host hand chan arg} { foreach {x y} [array get ::kick] {  putserv "privmsg $chan : $x with $y kicks" }}</code></pre></div>It works.But it's possible to write this list in order decreasing <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_question.gif" width="15" height="15" alt=":?:" title="Question"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6856">romain</a> — Wed Oct 19, 2005 9:20 am</p><hr />
]]></content>
	</entry>
	</feed>
