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

	<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-04-16T09:01:24-04:00</updated>

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

		<entry>
		<author><name><![CDATA[Darkj]]></name></author>
		<updated>2004-04-16T09:01:24-04:00</updated>

		<published>2004-04-16T09:01:24-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=35612#p35612</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=35612#p35612"/>
		<title type="html"><![CDATA[Top10 Help (Custom Design)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=35612#p35612"><![CDATA[
Awesome user, that put me on a great step to the right direction.  Thank you muchly.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3459">Darkj</a> — Fri Apr 16, 2004 9:01 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2004-04-15T11:29:24-04:00</updated>

		<published>2004-04-15T11:29:24-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=35554#p35554</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=35554#p35554"/>
		<title type="html"><![CDATA[Re: Top10 Help (Custom Design)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=35554#p35554"><![CDATA[
I'd make a list of lists that contain name and score..like this:<div class="codebox"><p>Code: </p><pre><code># this list will of course be generated by the code reading your .ini:set unsorted {{Name1 1000} {Name2 1001} {Name3 999}}if {[llength $unsorted]==0} {set result "\0032No one has requested anything yet.\003"} else {# lsort that list using the -index option:set sorted [lsort -index 1 -integer -decreasing $unsorted]set result {}set i 0# and use a foreach loop to generate the output (using lrange to limit the number to max 10)foreach pair [lrange $sorted 0 9] {lappend result "[incr i]) \00304[join $pair " \00306"]\003"}if {[llength $result]==1} {set result "\0032Top Requester:\003 [join $result]"} {set result "\0032Top [llength $result] Requesters:\003 [join $result]"}}puthelp "PRIVMSG #chan :$result"</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2878">user</a> — Thu Apr 15, 2004 11:29 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Darkj]]></name></author>
		<updated>2004-04-14T20:38:36-04:00</updated>

		<published>2004-04-14T20:38:36-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=35532#p35532</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=35532#p35532"/>
		<title type="html"><![CDATA[Top10 Help (Custom Design)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=35532#p35532"><![CDATA[
The way I am doing this seems way to complicated.  There is like 200 lines of code for this, which isn't quite right.  Now my code my be newbish, its kind of my first attempt at top10 scores.  It does work, surprisingly enough, but it sucks.<br><br>The way the score database is designed is:<br>[nick]<br>value1=#<br>value2=#<br><br>[nick]<br>value1=#<br>value2=#<br><br>etc...<br><br>Now the code<br><div class="codebox"><p>Code: </p><pre><code>proc proc_top10 {nick uhost handle chan text} {   global mainchanreqs inifilereqs inifilescores   if {$chan != $mainchanreqs} {     return 0   }    set choice [lindex $text 0]   if {[string match -nocase "reqs" $text]} {   set v 0   set hscore(0) 0   set hiscore(0) 0   foreach {name} [parseIni $inifilescores] {   incr v    set hscore($v) value1   set hiscore($v) value2   if {($hscore($v) == "\;") &amp;&amp; ($hiscore($v) == "\;")} {    set hscore($v) 0    set hiscore($v) 0   }   }   set first 0   set second 0   set third 0   set fourth 0   set fifth 0   set sixth 0   set seventh 0   set eight 0   set ninth 0   set tenth 0   for { set k 0 } {$k &lt; $v} {incr k} {    if {$hscore($k) &gt; $hscore($first)} {set tenth $ninthset ninth $eightset eight $seventhset seventh $sixth       set sixth $fifth       set fifth $fourth       set fourth $third       set third $second       set second $first       set first $k       continue       }    if {$hscore($k) &gt; $hscore($second)} {        set tenth $ninth        set ninth $eight        set eight $seventh        set seventh $sixthset sixth $fifth       set fifth $fourth       set fourth $third       set third $second       set second $k       continue       }    if {$hscore($k) &gt; $hscore($third)} {        set tenth $ninth        set ninth $eight        set eight $seventh        set seventh $sixth        set sixth $fifth       set fifth $fourth       set fourth $third       set third $k       continue       }    if {$hscore($k) &gt; $hscore($fourth)} {        set tenth $ninth        set ninth $eight        set eight $seventh        set seventh $sixth        set sixth $fifth       set fifth $fourth       set fourth $k       continue       }    if {$hscore($k) &gt; $hscore($fifth)} {        set tenth $ninth        set ninth $eight        set eight $seventh        set seventh $sixth        set sixth $fifth       set fifth $k       continue       }    if {$hscore($k) &gt; $hscore($sixth)} {        set tenth $ninth        set ninth $eight          set eight $seventh        set seventh $sixth        set sixth $k       continue       }    if {$hscore($k) &gt; $hscore($seventh)} {        set tenth $ninth        set ninth $eight          set eight $seventh        set seventh $k       continue       }    if {$hscore($k) &gt; $hscore($eight)} {        set tenth $ninth        set ninth $eight          set eight $k       continue       }    if {$hscore($k) &gt; $hscore($ninth)} {set tenth $ninth        set ninth $k       continue       }    if {$hscore($k) &gt; $hscore($tenth)} {       set tenth $k       continue       }    }    if {($hscore($first) == "0") &amp;&amp; ($hiscore($first) == "0")} {      putserv "PRIVMSG $mainchanreqs :\0032No one has requested anything yet.\003"      return 0    }    if {($hscore($second) == "0") &amp;&amp; ($hiscore($second) == "0")} {      puthelp "PRIVMSG $mainchanreqs :\0032Top 1 Requester\:\003 1\)\0034 $hiscore($first)\003 \0036 $hscore($first)\003\002"       return 0    }    if {($hscore($third) == "0") &amp;&amp; ($hiscore($third) == "0")} {      puthelp "PRIVMSG $mainchanreqs :\0032Top 2 Requesters\:\003 1\)\0034 $hiscore($first)\003 \0036 $hscore($first)\003  2\)\0034 $hiscore($second)\003 \0036 $hscore($second)\003\002"       return 0    }    if {($hscore($fourth) == "0") &amp;&amp; ($hiscore($fourth) == "0")} {      puthelp "PRIVMSG $mainchanreqs :\0032Top 3 Requesters\:\003 1\)\0034 $hiscore($first)\003 \0036 $hscore($first)\003  2\)\0034 $hiscore($second)\003 \0036 $hscore($second)\003  3)\0034 $hiscore($third)\003 \0036 $hscore($third)\003\002"       return 0    }    if {($hscore($fifth) == "0") &amp;&amp; ($hiscore($fifth) == "0")} {      puthelp "PRIVMSG $mainchanreqs :\0032Top 4 Requesters\:\003 1\)\0034 $hiscore($first)\003 \0036 $hscore($first)\003  2\)\0034 $hiscore($second)\003 \0036 $hscore($second)\003  3)\0034 $hiscore($third)\003 \0036 $hscore($third)\003  4\)\0034 $hiscore($fourth)\003 \0036 $hscore($fourth)\003\002"       return 0    }    if {($hscore($sixth) == "0") &amp;&amp; ($hiscore($sixth) == "0")} {      puthelp "PRIVMSG $mainchanreqs :\0032Top 5 Requesters\:\003 1\)\0034 $hiscore($first)\003 \0036 $hscore($first)\003  2\)\0034 $hiscore($second)\003 \0036 $hscore($second)\003  3)\0034 $hiscore($third)\003 \0036 $hscore($third)\003  4\)\0034 $hiscore($fourth)\003 \0036 $hscore($fourth)\003  5\)\0034 $hiscore($fifth)\003 \0036 $hscore($fifth)\003\002"       return 0    }    if {($hscore($seventh) == "0") &amp;&amp; ($hiscore($seventh) == "0")} {      puthelp "PRIVMSG $mainchanreqs :\0032Top 6 Requesters\:\003 1\)\0034 $hiscore($first)\003 \0036 $hscore($first)\003  2\)\0034 $hiscore($second)\003 \0036 $hscore($second)\003  3)\0034 $hiscore($third)\003 \0036 $hscore($third)\003  4\)\0034 $hiscore($fourth)\003 \0036 $hscore($fourth)\003  5\)\0034 $hiscore($fifth)\003 \0036 $hscore($fifth)\003  6\)\0034 $hiscore($sixth)\003 \0036 $hscore($sixth)\003\002"       return 0    }    if {($hscore($eight) == "0") &amp;&amp; ($hiscore($eight) == "0")} {      puthelp "PRIVMSG $mainchanreqs :\0032Top 7 Requesters\:\003 1\)\0034 $hiscore($first)\003 \0036 $hscore($first)\003  2\)\0034 $hiscore($second)\003 \0036 $hscore($second)\003  3)\0034 $hiscore($third)\003 \0036 $hscore($third)\003  4\)\0034 $hiscore($fourth)\003 \0036 $hscore($fourth)\003  5\)\0034 $hiscore($fifth)\003 \0036 $hscore($fifth)\003  6\)\0034 $hiscore($sixth)\003 \0036 $hscore($sixth)\003  7\)\0034 $hiscore($seventh)\003 \0036 $hscore($sixth)\003\002"       return 0    }    if {($hscore($ninth) == "0") &amp;&amp; ($hiscore($ninth) == "0")} {      puthelp "PRIVMSG $mainchanreqs :\0032Top 8 Requesters\:\003 1\)\0034 $hiscore($first)\003 \0036 $hscore($first)\003  2\)\0034 $hiscore($second)\003 \0036 $hscore($second)\003  3)\0034 $hiscore($third)\003 \0036 $hscore($third)\003  4\)\0034 $hiscore($fourth)\003 \0036 $hscore($fourth)\003  5\)\0034 $hiscore($fifth)\003 \0036 $hscore($fifth)\003  6\)\0034 $hiscore($sixth)\003 \0036 $hscore($sixth)\003  7\)\0034 $hiscore($seventh)\003 \0036 $hscore($sixth)\003  8\)\0034 $hiscore($eight)\003 \0036 $hscore($eight)\003\002"       return 0    }    if {($hscore($tenth) == "0") &amp;&amp; ($hiscore($tenth) == "0")} {      puthelp "PRIVMSG $mainchanreqs :\0032Top 9 Requesters\:\003 1\)\0034 $hiscore($first)\003 \0036 $hscore($first)\003  2\)\0034 $hiscore($second)\003 \0036 $hscore($second)\003  3)\0034 $hiscore($third)\003 \0036 $hscore($third)\003  4\)\0034 $hiscore($fourth)\003 \0036 $hscore($fourth)\003  5\)\0034 $hiscore($fifth)\003 \0036 $hscore($fifth)\003  6\)\0034 $hiscore($sixth)\003 \0036 $hscore($sixth)\003  7\)\0034 $hiscore($seventh)\003 \0036 $hscore($sixth)\003  8\)\0034 $hiscore($eight)\003 \0036 $hscore($eight)\003  9\)\0034 $hiscore($ninth)\003 \0036 $hscore($ninth)\003\002"       return 0    }     puthelp "PRIVMSG $mainchanreqs :\0032Top 10 Requesters\:\003 1\)\0034 $hiscore($first)\003 \0036 $hscore($first)\003  2\)\0034 $hiscore($second)\003 \0036 $hscore($second)\003  3)\0034 $hiscore($third)\003 \0036 $hscore($third)\003  4\)\0034 $hiscore($fourth)\003 \0036 $hscore($fourth)\003  5\)\0034 $hiscore($fifth)\003 \0036 $hscore($fifth)\003  6\)\0034 $hiscore($sixth)\003 \0036 $hscore($sixth)\003  7\)\0034 $hiscore($seventh)\003 \0036 $hscore($sixth)\003  8\)\0034 $hiscore($eight)\003 \0036 $hscore($eight)\003  9\)\0034 $hiscore($ninth)\003 \0036 $hscore($ninth)\003  10\)\0034 $hiscore($tenth)\003 \0036 $hscore($tenth)\003\002"     return 0   } return 0}</code></pre></div>Any suggestions would help.  Thanks<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3459">Darkj</a> — Wed Apr 14, 2004 8:38 pm</p><hr />
]]></content>
	</entry>
	</feed>
