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

	<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-16T03:02:46-04:00</updated>

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

		<entry>
		<author><name><![CDATA[demond]]></name></author>
		<updated>2005-12-16T03:02:46-04:00</updated>

		<published>2005-12-16T03:02:46-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=58336#p58336</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=58336#p58336"/>
		<title type="html"><![CDATA[wordgame]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=58336#p58336"><![CDATA[
that guy didn't bother to provide error traceback, but I'd guess the problem actually is with $fscore and $dscore which supposedly have to yield integer arguments to [format] but yield empty string instead<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5056">demond</a> — Fri Dec 16, 2005 3:02 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Ian-Highlander]]></name></author>
		<updated>2005-12-15T04:53:47-04:00</updated>

		<published>2005-12-15T04:53:47-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=58283#p58283</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=58283#p58283"/>
		<title type="html"><![CDATA[wordgame]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=58283#p58283"><![CDATA[
Well I had the same problem and changing the code as illustrated above fixed it for me and the scores work perfectly. Semantics or not <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=":wink:" title="Wink"><br><br>If the score function returns a null return then the original code barfs out, that extra bit simply tells it if it isnt null carry on but ignore this bit. Ok, it doesnt actually fix the fact that it shouldnt react like that in the first place but it cures the problem.<br><br>Anyway, try it and see if it works, it did for me. <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=17">Ian-Highlander</a> — Thu Dec 15, 2005 4:53 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[demond]]></name></author>
		<updated>2005-12-14T23:26:53-04:00</updated>

		<published>2005-12-14T23:26:53-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=58279#p58279</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=58279#p58279"/>
		<title type="html"><![CDATA[wordgame]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=58279#p58279"><![CDATA[
that won't help, it is functionally/semantically the same since [append] doesn't require its argument to exist already<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5056">demond</a> — Wed Dec 14, 2005 11:26 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Ian-Highlander]]></name></author>
		<updated>2005-12-14T07:40:02-04:00</updated>

		<published>2005-12-14T07:40:02-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=58251#p58251</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=58251#p58251"/>
		<title type="html"><![CDATA[wordgame]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=58251#p58251"><![CDATA[
Change:<div class="codebox"><p>Code: </p><pre><code>set tempsortscore [lsort -decreasing $tempsortscore] for {set i 0} {$i &lt; 10} {incr i} { set tiscore [lindex $tempsortscore $i] set newtempsortscore [string trimleft [lindex $tiscore 0] 0] append sortscore [format "\0034 %s\.\003 %s\(%d\/%d\)  " [expr {$i + 1}] [lindex $tiscore 2] $newtempsortscore [lindex $tiscore 1]] }</code></pre></div>To:<div class="codebox"><p>Code: </p><pre><code>set tempsortscore [lsort -decreasing $tempsortscore]set sortscore ""for {set i 0} {$i &lt; 10} {incr i} {set tiscore [lindex $tempsortscore $i]set newtempsortscore [string trimleft [lindex $tiscore 0] 0]if {$newtempsortscore != ""} {append sortscore [format "\0034 %s\. \003 %s\(%d\/%d\)  " [expr {$i + 1}] [lindex $tiscore 2] $newtempsortscore [lindex $tiscore 1]]}}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=17">Ian-Highlander</a> — Wed Dec 14, 2005 7:40 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[neilpkemp]]></name></author>
		<updated>2005-12-12T14:00:24-04:00</updated>

		<published>2005-12-12T14:00:24-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=58212#p58212</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=58212#p58212"/>
		<title type="html"><![CDATA[wordgame]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=58212#p58212"><![CDATA[
[17:59] &lt;eVolutioN&gt; [09:59] 1 SOLID 2 0<br>[17:59] &lt;eVolutioN&gt; [09:59] 2   <br>[17:59] &lt;eVolutioN&gt; [09:59] Tcl error [the_score]: expected integer but got ""<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6973">neilpkemp</a> — Mon Dec 12, 2005 2:00 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Sir_Fz]]></name></author>
		<updated>2005-12-12T13:35:14-04:00</updated>

		<published>2005-12-12T13:35:14-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=58210#p58210</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=58210#p58210"/>
		<title type="html"><![CDATA[wordgame]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=58210#p58210"><![CDATA[
Ok, this needs to be traced. Add<div class="codebox"><p>Code: </p><pre><code>putlog "[expr {$i + 1}] [lindex $tiscore 2] $newtempsortscore [lindex $tiscore 1]"</code></pre></div>before<div class="codebox"><p>Code: </p><pre><code>format "\0034 %s\.\003 %s\(%d\/%d\) " [expr {$i + 1}] [lindex $tiscore 2]$newtempsortscore [lindex $tiscore 1]</code></pre></div>And show us the output just before the error occurs.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3085">Sir_Fz</a> — Mon Dec 12, 2005 1:35 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[neilpkemp]]></name></author>
		<updated>2005-12-12T13:21:47-04:00</updated>

		<published>2005-12-12T13:21:47-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=58207#p58207</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=58207#p58207"/>
		<title type="html"><![CDATA[wordgame]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=58207#p58207"><![CDATA[
[17:20] &lt;eVolutioN&gt; [09:20] Tcl error [the_score]: expected integer but got ""<br>[17:21] &lt;SOLID&gt; .set errorInfo<br>[17:21] &lt;eVolutioN&gt; [09:21] #SOLID# set errorInfo<br>[17:21] &lt;eVolutioN&gt; Currently: expected integer but got ""<br>[17:21] &lt;eVolutioN&gt; Currently:     while executing<br>[17:21] &lt;eVolutioN&gt; Currently: "format "\0034 %s\.\003 %s\(%d\/%d\)  " [expr {$i + 1}] [lindex $tiscore 2] <br>  $newtempsortscore [lindex $tiscore 1]"<br>[17:21] &lt;eVolutioN&gt; Currently:     (procedure "the_score" line 31)<br>[17:21] &lt;eVolutioN&gt; Currently:     invoked from within<br>[17:21] &lt;eVolutioN&gt; Currently: "the_score $_pub1 $_pub2 $_pub3 $_pub4 $_pub5"<br><br>thxs again<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6973">neilpkemp</a> — Mon Dec 12, 2005 1:21 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Sir_Fz]]></name></author>
		<updated>2005-12-11T18:55:38-04:00</updated>

		<published>2005-12-11T18:55:38-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=58192#p58192</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=58192#p58192"/>
		<title type="html"><![CDATA[wordgame]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=58192#p58192"><![CDATA[
Paste the return of <strong class="text-strong">.set errorInfo</strong> (DCC) so we could detect where the error occurs.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3085">Sir_Fz</a> — Sun Dec 11, 2005 6:55 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[neilpkemp]]></name></author>
		<updated>2005-12-11T14:46:25-04:00</updated>

		<published>2005-12-11T14:46:25-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=58183#p58183</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=58183#p58183"/>
		<title type="html"><![CDATA[wordgame]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=58183#p58183"><![CDATA[
ive downlaoded this and it works ok , apart from when you to the !score you get his error <br><br>[10:44] Tcl error [the_score]: expected integer but got ""<br><div class="codebox"><p>Code: </p><pre><code>##################  Written by Murf 10/10/97 ####################                                                           #### Requires wordlist.txt and wscore file                     #### I have included a wordlist file, but if you want to write #### your own, the format is                                   ## ## &lt;word to scramble&gt;:&lt;clue&gt;                                 ####                                                           ####                                                           ####                                                           ####  The only  commands are:                                  ####                                                           ####  !word       -- starts the game                           ####  !score      -- spews the top ten scorers                 ####  !wordswitch -- turns it on or off                        ####  !wordanswer -- turn the answer on or off                 ####           Check www.blueday.org/eggdrop.html              ####           Contact murf@mindless.com with questions        ################################################################### NOTES# Scores are kept globally# Scores are only kept for those in the bot's user list.# The special user used to track various things, is added#   by the script.## REVISION HISTORY# Mar 26 2002   --  Fixed adding new channel # Dec 18 2000   --  Fixed the score again. It was totally broken, not listing#                   anything close to the top 10 scorers#               --  fixed problem with possible duplicate entries in the score#                   file is users change case of their nicks# July 9 2000   --  Added switch to say/not say the answer if no one gets it.#--  Got rid of all the 'putchan's# July 2 2000 -- Fixed bug in the_score that didn't account for # less than 10 people in the score list.#--Fixed bug in the_score that failed to check for #non-existent score file.## BINDS#Change the f|f if you want.bind pub - !score the_scorebind pub - !word pub_wordbind time - "05 03 % % %" wo_refresh_timebind msg o !wordswitch word_onoffbind msg o !wordanswer answer_onoff## VARIABLES, set these.# This is the file that holds the wordlist, set it to whateverset wlistfile /usr/home/vassy55/bot/scripts/wordlist.txt# This file keeps scores again call it whatever set wscorefile /usr/home/vassy55/bot/scripts/wscore.db# This special user is added to the bots userlist and used to track# where each chan is in the wordlistset specuser specialwd# Say the answer if no one gets it# 0 is don't say it / 1 is say itset ansonoff 1## ----------------Leave the rest alone----------------------------------# This variable tells whether the script is being run.  It will only allow# the game to be played in one channel at a time, otherwise too many timers# too much confusion.# Occasionally, the script may become confused during desynchs and says its # running when it isn't. You must reset this variable to 0. Don't worry# it doesnt happen often.  Obviously leave it set to 0 hereset winuse 0# This variable is the place in the wordlist.  Its initialized to 0 don't# mess with it.  I tried randomizing this, but found this worked better,# but its not hard to randomize if you like that better.set word_list_count 0# On off switch for the annoying people# 0 is off/ 1 is onset glonoff 1# Global channel variable, initialized to null, leave aloneset chan ""# Initializes global wordlist to null, leave it aloneset words ""# ----------CODE--------------------------------------------------------# Procedure to turn on/off whether the answer is given if no one# gets it.proc answer_onoff {nick uhost handle args} {  global ansonoff botnick  set onoff [string tolower [ string trim [lindex [split $args] 0] "{}" ]]  if {$onoff == "on"} {  set ansonoff 1putserv "NOTICE $nick :Wordgame will now tell you losers the answers ;-P"return}   if {$onoff == "off"} { set ansonoff 0putserv "NOTICE $nick :Wordgame will no longer tell you losers the answers"return}   putserv "NOTICE $nick :USAGE: /msg $botnick !wordanswer on\/off"   return}# Had to add an on off switch cause some pple started annoying meproc word_onoff {nick uhost handle args} {  global botnick glonoff  set onoff [string tolower [ string trim [lindex [split $args] 0] "{}" ]]  if {$onoff == "on"} {  set glonoff 1putserv "NOTICE $nick :Wordgame is turned on"return}   if {$onoff == "off"} { set glonoff 0putserv "NOTICE $nick :Wordgame is turned off"return}   putserv "NOTICE $nick :USAGE: /msg $botnick !wordswitch on\/off"   return}# This is the main proc, it spews the word and sets the timers to do the # rest.proc pub_word {nick uhost handle channel args} {   global wscorefile wlistfile words word_list_count answer winuse \chan letone lettwo letters specuser glonoff   if {$glonoff == 0} {putserv "PRIVMSG $channel :Sorry, wordgame is turned off, try again later"return   }    set chn [string tolower $channel]   if {$word_list_count == 0} {       if {![validuser $specuser]} {          set channels [channels]          adduser $specuser specuser!special@word.special.org          foreach chann $channels {             setuser $specuser XTRA wcount.$chann 0          }       }       set word_list_count [getuser $specuser XTRA wcount.$chn]       if {$word_list_count == ""} {          setuser $specuser XTRA wcount.$chn 0          set $word_list_count 0       }         set words ""       set fd [open $wlistfile r]       while {![eof $fd]} {          lappend words [gets $fd]       }       close $fd   }   if {($winuse == 1) &amp;&amp; ([string compare $chn $chan] != 0)} {      putserv "PRIVMSG $chn :Sorry, they're already playing in $chan, go join in. I'll tell em your coming, $nick."    return 0   } elseif {($winuse == 1) &amp;&amp; ([string compare $chn $chan] == 0)} {         putserv "PRIVMSG $chan :HEY! One word at a time!"     return 0   } elseif {$winuse == 0} {      set chan $chn      set winuse 1      set word_pair [lindex $words $word_list_count]      set answer [lindex [split $word_pair :] 1]      set word_split [split $word_pair :]      set letters [lreplace $word_split 1 1]      set let_split [split $letters {}]      set letone [lindex $let_split 0]      set slettwo $letone      set slettwo [join [lappend slettwo [lindex $let_split 1]]]      regsub { } $slettwo {} lettwo      set i [llength $let_split]      set smixed ""      set tmixed ""      for {set j 0} {$j &lt; $i} {incr j} {        set k [rand [llength $let_split]]         set smixed $tmixed        set smixed [lappend smixed [lindex $let_split $k]]        set let_split [lreplace $let_split $k $k]        regsub { } $smixed {} tmixed      }      set mixed $tmixed      bind pub - $letters pub_gotit      putserv "PRIVMSG $chan :Unscramble ---&gt; \0036 $mixed "      incr word_list_count       if {$word_list_count &gt;= [expr [llength $words] -1]} {         set word_list_count "0"      }      setuser $specuser XTRA wcount.$chn $word_list_count      utimer 60 noone_gotit       utimer 15 clue_1      utimer 30 clue_2      utimer 45 clue_3   }}# All the timers expired and no one got it. Spew to chan.proc noone_gotit {} {   global winuse chan letters ansonoff   if {$ansonoff} {     putserv "PRIVMSG $chan :Nobody got it...it\'s \0034$letters"   } else {      putserv "PRIVMSG $chan :Nobody got it...\0034losers!"   }   unbind pub - $letters pub_gotit   set winuse 0    set chan "" }# List of things to say when a validuser winsset winsay {"must be a fluke""you rule!!""how's that VD comin along?""can I be your friend?""you're such a badass!""must have gotten all the easy ones!""but you still suck!""you must be on \0034fire!!""cheater!"}# Somebody won, spew to chan and update score file. Scores are kept for both# daily and cumulative.  Once anyone hits 500 all scores are reset.proc pub_gotit {nick uhost handle channel args} {   global wscorefile words letters answer  winuse chan winsay   putserv "PRIVMSG $chan :Woohoo $nick!! You got it...\0034$letters"   kill_timers      unbind pub - $letters pub_gotit   if {![validuser $handle]} {     set winuse 0     set chan ""     return 0   }   if {![file exists $wscorefile]} {set fd [open $wscorefile w]close $fd   }   set fd [open $wscorefile r]   set j 0   while {![eof $fd]} {     lappend score [gets $fd]     set j [incr j]    }   set i [expr $j - 1]   set score [lreplace $score $i $i]   close $fd   for {set k 0} {$k &lt; $i} {incr k 3} {     set scnick [lindex $score $k]     if {[string tolower $handle] == [string tolower $scnick]} {        set newd [expr [lindex $score [expr $k + 1]] + 1]        set newf [expr [lindex $score [expr $k + 2]] + 1]        set score [lreplace $score [expr $k + 1] [expr $k + 2] $newd $newf]        set dscore [lindex $score [expr $k + 1]]        set rand_say [lindex $winsay [rand [llength $winsay]]]        putserv "PRIVMSG  $chan :$nick you've won $dscore times today, $rand_say"        if {$newf == 500} {          putserv "PRIVMSG $chan :OH MY GAWD!! $scnick just scored 500 since time began!"          set score [lreplace $score 1 2 0 0]          for {set k 1} {$k &lt; $i} {incr k 2} {            set score [lreplace $score $k $k 0]    incr k            set score [lreplace $score $k $k 0]          }          putserv "PRIVMSG $chan :\001ACTION sprinkles bot dust and time begins again!"        }        set winuse 0        set chan ""        set fd [open $wscorefile w]        foreach line $score {          puts $fd $line        }         close $fd        return 0     }     }   putserv "PRIVMSG $chan :$nick this is your first ever win!!!...Don't you feel pathetic!"   set score [lappend score $handle]   set score [lappend score 1]   set score [lappend score 1]   set fd [open $wscorefile w]     foreach line $score {       puts $fd $line     }   close $fd   set winuse 0   set chan ""}proc the_score {nick uhost handle channel args} {  global botnick wscorefile words answer winuse chan  if {($winuse == 1) &amp;&amp; ($chan == $channel)} {    putserv "PRIVMSG $chan :Sheesh! Can't you see we're playing here!!"  return 0  }  if {![file exists $wscorefile]} {    putserv "PRIVMSG $chan : No one has scored yet!"    return  }  set fd [open $wscorefile r]  set j 0   while {![eof $fd]} {     lappend score [gets $fd] incr j   }   set i [expr $j - 1]   set score [lreplace $score $i $i]   close $fd   set looptest [llength $score]   for {set k 0} {$k &lt; $looptest} {incr k 3} {      set wosnick [lindex $score $k]       set dscore [lindex $score [expr $k + 1]]      set fscore [format "%d" [lindex $score [expr $k + 2]]]      lappend tempsortscore [format "%.20d %d %s" $fscore $dscore $wosnick]   }   set tempsortscore [lsort -decreasing $tempsortscore]   for {set i 0} {$i &lt; 10} {incr i} {      set tiscore [lindex $tempsortscore $i]  set newtempsortscore [string trimleft [lindex $tiscore 0] 0]      append sortscore [format "\0034 %s\.\003 %s\(%d\/%d\)  " [expr {$i + 1}] [lindex $tiscore 2] $newtempsortscore [lindex $tiscore 1]]   }   set slength [llength $sortscore]   putserv "PRIVMSG $channel :The top 10 Scramble scorers are (Total/Daily):"   putserv "PRIVMSG $channel :$sortscore"}# Give clue wordproc clue_1 {} {   global chan answer   set clue $answer   putserv "PRIVMSG $chan :Clue ---&gt;\00312  $clue"}# Give first letter of the wordproc clue_2 {} {   global chan letone   set clue $letone   putserv "PRIVMSG $chan :First letter ---&gt;\00312  $clue"}# Give the second letterproc clue_3 {} {   global chan lettwo   set clue $lettwo    putserv "PRIVMSG $chan :First two letters ---&gt;\00312  $clue"}# Kill all remaining timers when someone wins.proc kill_timers {} {   global chan   foreach j [utimers] {     if {[lindex $j 1] == "noone_gotit"} {        killutimer [lindex $j 2]     }     if {[lindex $j 1] == "clue_1"} {        killutimer [lindex $j 2]     }     if {[lindex $j 1] == "clue_2"} {        killutimer [lindex $j 2]     }     if {[lindex $j 1] == "clue_3"} {        killutimer [lindex $j 2]     }   }   return 0}# Its 3:00 am, clear the daily scores.proc wo_refresh_time {m h d mo y} {  global wscorefile   set fd [open $wscorefile r]  set j 0  while {![eof $fd]} {     lappend score [gets $fd]     set j [incr j]    }  set i [expr $j - 1]  set score [lreplace $score $i $i]  close $fd  set score [lreplace $score 1 1 0]  for {set k 1} {$k &lt; $i} {incr k 3} {     set score [lreplace $score $k $k 0]  }  set fd [open $wscorefile w]  foreach line $score {      puts $fd $line  }   close $fd  return 1}putlog "Wordgame by murf loaded"</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6973">neilpkemp</a> — Sun Dec 11, 2005 2:46 pm</p><hr />
]]></content>
	</entry>
	</feed>
