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

	<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-12-31T00:16:47-04:00</updated>

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

		<entry>
		<author><name><![CDATA[demond]]></name></author>
		<updated>2005-12-31T00:16:47-04:00</updated>

		<published>2005-12-31T00:16:47-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=58840#p58840</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=58840#p58840"/>
		<title type="html"><![CDATA[help with array]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=58840#p58840"><![CDATA[
well, you have 2 options: either understand completely what you've created so far using my code - and then help yourself, or paste your entire script and hope someone will fix it for you (I won't do that, I'm not in the mood for debugging right now)<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5056">demond</a> — Sat Dec 31, 2005 12:16 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[bsdkid]]></name></author>
		<updated>2005-12-31T00:16:41-04:00</updated>

		<published>2005-12-31T00:16:41-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=58839#p58839</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=58839#p58839"/>
		<title type="html"><![CDATA[help with array]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=58839#p58839"><![CDATA[
Currently: expected integer but got ""<br>Currently:     while executing<br>Currently: "incr sco $pointvalue"<br>Currently:     invoked from within<br>Currently: "if [info exists score($lnick)] {<br>Currently:    set sco [lindex $score($lnick) 1]<br>Currently:       lset score($lnick) 1 [incr sco $pointvalue]<br>Currently:    } {<br>Currently:       set score($lnick)..."<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6919">bsdkid</a> — Sat Dec 31, 2005 12:16 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[bsdkid]]></name></author>
		<updated>2005-12-31T00:13:53-04:00</updated>

		<published>2005-12-31T00:13:53-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=58838#p58838</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=58838#p58838"/>
		<title type="html"><![CDATA[help with array]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=58838#p58838"><![CDATA[
I think something is wrong with this, after i reload the score array when the bot restart it screwed up.<div class="codebox"><p>Code: </p><pre><code>set f [open score.txt]foreach line [split [read $f]] {   foreach {n s} [split $line] {      set score($n) [list $n $s]   }}close $f </code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6919">bsdkid</a> — Sat Dec 31, 2005 12:13 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[demond]]></name></author>
		<updated>2005-12-31T00:09:07-04:00</updated>

		<published>2005-12-31T00:09:07-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=58836#p58836</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=58836#p58836"/>
		<title type="html"><![CDATA[help with array]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=58836#p58836"><![CDATA[
by understanding what exactly is being done by the code I gave you, and what exactly you've done with it <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"> then the bug will become obvious to you and you'll be able to fix it yourself<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5056">demond</a> — Sat Dec 31, 2005 12:09 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[bsdkid]]></name></author>
		<updated>2005-12-31T00:03:45-04:00</updated>

		<published>2005-12-31T00:03:45-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=58834#p58834</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=58834#p58834"/>
		<title type="html"><![CDATA[help with array]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=58834#p58834"><![CDATA[
how do i fix it demond?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6919">bsdkid</a> — Sat Dec 31, 2005 12:03 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[demond]]></name></author>
		<updated>2005-12-30T23:49:38-04:00</updated>

		<published>2005-12-30T23:49:38-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=58832#p58832</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=58832#p58832"/>
		<title type="html"><![CDATA[help with array]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=58832#p58832"><![CDATA[
then you must have messed up nicks (strings) with scores (integers)<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5056">demond</a> — Fri Dec 30, 2005 11:49 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[bsdkid]]></name></author>
		<updated>2005-12-30T07:21:58-04:00</updated>

		<published>2005-12-30T07:21:58-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=58801#p58801</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=58801#p58801"/>
		<title type="html"><![CDATA[help with array]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=58801#p58801"><![CDATA[
demond, i got 1 small error when i next start the bot, after reload the score array it says <br><br><br>Currently: expected integer but got ""<br>Currently:     while executing<br>Currently: "lsort -integer -decreasing -index 1 $pairs"<br>Currently:     (procedure "first" line 102)<br>Currently:     invoked from within<br><div class="codebox"><p>Code: </p><pre><code>set f [open $scorefile w]set pairs {}; foreach {n s} [array get score] {lappend pairs [list $n $s]}foreach pairs [lsort -integer -decreasing -index 1 $pairs] {puts $f $pairs}close $f</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6919">bsdkid</a> — Fri Dec 30, 2005 7:21 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[demond]]></name></author>
		<updated>2005-12-30T01:11:21-04:00</updated>

		<published>2005-12-30T01:11:21-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=58794#p58794</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=58794#p58794"/>
		<title type="html"><![CDATA[help with array]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=58794#p58794"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>set f [open score.txt]foreach line [split [read $f]] {   foreach {n s} [split $line] {      set score($n) [list $n $s]   }}close $f</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5056">demond</a> — Fri Dec 30, 2005 1:11 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[bsdkid]]></name></author>
		<updated>2005-12-29T22:17:17-04:00</updated>

		<published>2005-12-29T22:17:17-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=58790#p58790</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=58790#p58790"/>
		<title type="html"><![CDATA[help with array]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=58790#p58790"><![CDATA[
demond, I have one more question, How do i reload the score array when the bot start?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6919">bsdkid</a> — Thu Dec 29, 2005 10:17 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[bsdkid]]></name></author>
		<updated>2005-12-29T07:38:43-04:00</updated>

		<published>2005-12-29T07:38:43-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=58773#p58773</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=58773#p58773"/>
		<title type="html"><![CDATA[help with array]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=58773#p58773"><![CDATA[
You are awesome demond, thanks <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6919">bsdkid</a> — Thu Dec 29, 2005 7:38 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[demond]]></name></author>
		<updated>2005-12-29T01:05:24-04:00</updated>

		<published>2005-12-29T01:05:24-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=58772#p58772</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=58772#p58772"/>
		<title type="html"><![CDATA[help with array]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=58772#p58772"><![CDATA[
[array get] returns a list of key-value pairs (not lists!); in your case, the value itself is a pair (list!) containing the original nick and its score; so you need to [lsort] that list of lists by the index of score:<div class="codebox"><p>Code: </p><pre><code>foreach {k v} [array get score] {lappend pairs $v}foreach pair [lsort -integer -decreasing -index 1 $pairs] {   foreach {n s} $pair {puts $f "$n $s"}}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5056">demond</a> — Thu Dec 29, 2005 1:05 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[bsdkid]]></name></author>
		<updated>2005-12-29T07:38:07-04:00</updated>

		<published>2005-12-29T00:28:18-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=58771#p58771</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=58771#p58771"/>
		<title type="html"><![CDATA[help with array]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=58771#p58771"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>proc write_score {nick} {global scorefile points scoreif {![file exists $scorefile]} {set fd [open $scorefile w]close $fd}        set lnick [string tolower $nick]if [info exists score($lnick)] {set sco [lindex $score($lnick) 1]   lset score($lnick) 1 [incr sco $points]} {   set score($lnick) [list $nick $points]} </code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6919">bsdkid</a> — Thu Dec 29, 2005 12:28 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[bsdkid]]></name></author>
		<updated>2005-12-29T00:24:48-04:00</updated>

		<published>2005-12-29T00:24:48-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=58769#p58769</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=58769#p58769"/>
		<title type="html"><![CDATA[help with array]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=58769#p58769"><![CDATA[
still get error demond <br><br>expected integer but got "bsdkid 9"<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6919">bsdkid</a> — Thu Dec 29, 2005 12:24 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[demond]]></name></author>
		<updated>2005-12-29T00:03:28-04:00</updated>

		<published>2005-12-29T00:03:28-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=58768#p58768</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=58768#p58768"/>
		<title type="html"><![CDATA[help with array]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=58768#p58768"><![CDATA[
oops I made a typo, I meant [lset] of course:<div class="codebox"><p>Code: </p><pre><code>set lnick [string tolower $nick]if [info exists score($lnick)] {   set sco [lindex $score($lnick) 1]   lset score($lnick) 1 [incr sco $points]} {   set score($lnick) [list $nick $points]} </code></pre></div>and if you can't grasp what's being done here, you probably shouldn't aim to script; the idea is simple, the implementation even simpler - preserve the original nick, still indexing by lowercased nick (and since you can't have 2 values in array element - the original nick and the score - you need a list as array element)<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5056">demond</a> — Thu Dec 29, 2005 12:03 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Sir_Fz]]></name></author>
		<updated>2005-12-28T23:15:12-04:00</updated>

		<published>2005-12-28T23:15:12-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=58765#p58765</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=58765#p58765"/>
		<title type="html"><![CDATA[help with array]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=58765#p58765"><![CDATA[
I still don't understand your request.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3085">Sir_Fz</a> — Wed Dec 28, 2005 11:15 pm</p><hr />
]]></content>
	</entry>
	</feed>
