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

	<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-11-13T07:10:56-04:00</updated>

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

		<entry>
		<author><name><![CDATA[TALES]]></name></author>
		<updated>2003-11-13T07:10:56-04:00</updated>

		<published>2003-11-13T07:10:56-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=29935#p29935</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=29935#p29935"/>
		<title type="html"><![CDATA[Trying to figure out a minor change]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=29935#p29935"><![CDATA[
<blockquote class="uncited"><div>Well I obviously can't speak for other folks, but the way I see it you are providing a free service to the eggdrop community by maintaining the Tcl script archive and a very good one at that. The point is that anyone who gets annoyed because they have to wait for you to do the update is being a little selfish IMHO. They obviously don't realise the amount of work you put into the archive and the site as a whole. I'm quite happy to wait a few days/weeks for updates to be added.</div></blockquote>Agree with you.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=4104">TALES</a> — Thu Nov 13, 2003 7:10 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Souperman]]></name></author>
		<updated>2003-11-13T03:00:44-04:00</updated>

		<published>2003-11-13T03:00:44-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=29928#p29928</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=29928#p29928"/>
		<title type="html"><![CDATA[Trying to figure out a minor change]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=29928#p29928"><![CDATA[
<blockquote class="uncited"><div>I'll be updating the archive again today. I do the updates manually, and believe it or not, it takes about an hour just to add seven or eight scripts. I've been working on an automated "self-serve" type of system which should be much more efficient and will allow for more frequent updates, since I gather it's annoying for authors having to wait for me all the time. Unfortunately with other things going on at the moment I haven't been able to finish it up, but I should get time during the Christmas holidays.</div></blockquote>Well I obviously can't speak for other folks, but the way I see it you are providing a free service to the eggdrop community by maintaining the Tcl script archive and a very good one at that.  The point is that anyone who gets annoyed because they have to wait for you to do the update is being a little selfish IMHO.  They obviously don't realise the amount of work you put into the archive and the site as a whole.  I'm quite happy to wait a few days/weeks for updates to be added. <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=801">Souperman</a> — Thu Nov 13, 2003 3:00 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[slennox]]></name></author>
		<updated>2003-11-12T09:31:39-04:00</updated>

		<published>2003-11-12T09:31:39-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=29912#p29912</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=29912#p29912"/>
		<title type="html"><![CDATA[Trying to figure out a minor change]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=29912#p29912"><![CDATA[
I'll be updating the archive again today. I do the updates manually, and believe it or not, it takes about an hour just to add seven or eight scripts. I've been working on an automated "self-serve" type of system which should be much more efficient and will allow for more frequent updates, since I gather it's annoying for authors having to wait for me all the time. Unfortunately with other things going on at the moment I haven't been able to finish it up, but I should get time during the Christmas holidays.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=13034">slennox</a> — Wed Nov 12, 2003 9:31 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[bobjuh]]></name></author>
		<updated>2003-11-11T10:38:28-04:00</updated>

		<published>2003-11-11T10:38:28-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=29858#p29858</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=29858#p29858"/>
		<title type="html"><![CDATA[Trying to figure out a minor change]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=29858#p29858"><![CDATA[
<blockquote class="uncited"><div>It will take a view day (weeks) when posting some new scripts i think.<br><br>i have made a new kind of game ( i hope  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_rolleyes.gif" width="15" height="15" alt=":roll:" title="Rolling Eyes"> ) Its a math game. For the one who are not so good in triv but are good in math. The game called: <strong class="text-strong">Crack the Code</strong> i hope slennox will post the script.</div></blockquote>hope so to <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br>It's a cool game.<br>Hope you got all those bugs out of it <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_razz.gif" width="15" height="15" alt=":P" title="Razz"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=109">bobjuh</a> — Tue Nov 11, 2003 10:38 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[TALES]]></name></author>
		<updated>2003-11-11T09:24:22-04:00</updated>

		<published>2003-11-11T09:24:22-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=29856#p29856</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=29856#p29856"/>
		<title type="html"><![CDATA[Trying to figure out a minor change]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=29856#p29856"><![CDATA[
It will take a view day (weeks) when posting some new scripts i think.<br><br>i have made a new kind of game ( i hope  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_rolleyes.gif" width="15" height="15" alt=":roll:" title="Rolling Eyes"> ) Its a math game. For the one who are not so good in triv but are good in math. The game called: <strong class="text-strong">Crack the Code</strong> i hope slennox will post the script.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=4104">TALES</a> — Tue Nov 11, 2003 9:24 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Souperman]]></name></author>
		<updated>2003-11-10T14:19:22-04:00</updated>

		<published>2003-11-10T14:19:22-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=29821#p29821</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=29821#p29821"/>
		<title type="html"><![CDATA[Trying to figure out a minor change]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=29821#p29821"><![CDATA[
I've asked slennox to remove that ancient 1.02 version from the archive but he hasn't as yet.  I think he doesn't like me or something.  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_mrgreen.gif" width="15" height="15" alt=":mrgreen:" title="Mr. Green"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=801">Souperman</a> — Mon Nov 10, 2003 2:19 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Sir_Fz]]></name></author>
		<updated>2003-10-25T08:47:16-04:00</updated>

		<published>2003-10-25T08:47:16-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=28918#p28918</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=28918#p28918"/>
		<title type="html"><![CDATA[Trying to figure out a minor change]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=28918#p28918"><![CDATA[
this is souperman's trivia script. Lucky you it has a new version, download it from <a href="http://eggdrop.za.net" class="postlink">here</a>.<br><br>you can set the separater (i.e. | * @ ...) and you can set the format, fro example "question|answer" or "answer|question" ... and lots of other new features.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3085">Sir_Fz</a> — Sat Oct 25, 2003 8:47 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Viper359]]></name></author>
		<updated>2003-10-24T17:57:11-04:00</updated>

		<published>2003-10-24T17:57:11-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=28900#p28900</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=28900#p28900"/>
		<title type="html"><![CDATA[Trying to figure out a minor change]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=28900#p28900"><![CDATA[
Okay, I will be attaching to this a tcl.  Its a trivia script.  I am trying to change a small problem with it.  <br><br>One of the things I am trying to find, to change is the answer | Question separtator.<br><br>ie: This is the question with the answer  viper359|who wrote this<br><br>what I want: Who Wrote this|Viper359<br><br>I want the answer to be at the end, not the beginning.  Were in the TCL is that command, and how do I change it to reflect my wishes.<br><br>I have spent several hours trying to find it, and fix it.<br><br>Thanks for the help<br><br>Below is the TCL<br>#PLEASE consult the file trivia.readme.html for detailed<br>#explanations of these variables.<br><br>set tgqdb "/home/viper359/bot2/triviabot/trivia.questions"<br>set tgscf "/home/viper359/bot2/triviabot/trivia.scores"<br>set tgerrfil "/home/viper359/bot2/triviabot/trivia.errors"<br>set tgchan "#Trivia-chat"<br>set tgpointsperanswer 1<br>set tgmaxhint 3<br>set tgstreakmin 3<br>set tgmaxmissed 0<br>set tghintchar "@"<br>set tgtimehint 30<br>set tgtimenext 10<br>set tgcongrats [list "Congratulations" "Well done" "Nice going" "Way to go" "You got it" "That's the way" "Show 'em how it's done"]<br>set tgnobodygotit [list "Nobody got it right." "Hello? Anybody home?" "You're going to have to try harder!" "Are these too tough for you?" "Am I alone here or what?" "You're not going to score any points this way!"]<br>set tgtrythenextone [list "Let's see if you can get the next one..." "Get ready for the next one..." "Maybe you'll get the next one..." "Try and get the next one..." "Here comes the next one..."]<br>set tgusebold 0<br>set tgcmdhelp "?"<br>set tgcmdstart "!start"<br>set tgflagsstart -|-<br>set tgcmdstop "!stop"<br>set tgflagsstop o|o<br>set tgcmdhint "!hint"<br>set tgflagshint o|o<br>set tgcmdskip "!skip"<br>set tgflagsskip o|o<br>set tgcmdreset "reset"<br>set tgflagsreset n|n<br>set tgcmdlookup "score"<br>set tgcmdtarget "target"<br>set tgcmderror "error"<br>set tgerrremindtime 15<br><br>#You'll need to remove the next line. It's just there to make sure you make<br>#some effort to edit the settings...<br>#die "* [file tail [info script]]: you didn't edit the settings like you were told, did you?"<br><br>######################################################################<br>#      You shouldn't need to modify anything beyond this point.      #<br>######################################################################<br>#Misc checks &amp; var initialisations<br>if {![file exists $tgqdb]} {die "[file tail [info script]]: $tgqdb does not exist!"}<br>if {![info exists alltools_loaded]||$allt_version&lt;204} {die "[file tail [info script]]: this script requires alltools.tcl v1.6 (or higher) to be loaded!"}<br>if {![info exists tgplaying]} {set tgplaying 0}<br>if {![info exists tghintnum]} {set tghintnum 0}<br>if {![info exists tgmissed]} {set tgmissed 0}<br><br>#Binds<br>bind pub $tgflagsstart $tgcmdstart tgstart<br>bind pub $tgflagsstop $tgcmdstop tgstop<br>bind pub $tgflagshint $tgcmdhint tgforcehint<br>bind pub $tgflagsskip $tgcmdskip tgskip<br>bind join -|- "$tgchan *" tgjoinmsg<br>bind msg - $tgcmdhelp tggivehelp<br>bind msg - $tgcmdlookup tgscorelookup<br>bind msg - $tgcmdtarget tgtargetlookup<br>bind msg - $tgcmderror tgerror<br>bind msg $tgflagsreset "$tgcmdreset" tgresetscores<br>bind kick - "$tgchan $botnick" tgbotgotkicked<br>bind evnt - disconnect-server tgbotgotdisconnected<br><br>#starts the game if it isn't running.<br>proc tgstart {nick host hand chan text} {<br> global tgplaying tgstreak tgchan tgerrremindtime tgerrremindtimer tgmissed<br> if {[strlwr $tgchan]==[strlwr $chan]} {<br>  if {$tgplaying==0} {<br>   tggamemsg "\00303Trivia game started by $nick!"<br>   tgnext<br>   set tgplaying 1<br>   set tgstreak 0<br>   set tgmissed 0<br>   set tgerrremindtimer [timer $tgerrremindtime tgerrremind]<br>  }<br>  return 1<br> }<br>}<br><br>#stops the game if it's running.<br>proc tgstop {nick host hand chan text} {<br> global tghinttimer tgnexttimer tgplaying tgchan tgcurrentanswer tgstreak tgstreakmin<br> global tgerrremindtimer<br> if {[strlwr $tgchan]==[strlwr $chan]} {<br>  if {$tgplaying==1} {<br>   tggamemsg "\00304Trivia game stopped by $nick!"<br>   if {$tgstreakmin&gt;0&amp;&amp;[lindex [split $tgstreak ,] 1]&gt;=$tgstreakmin} { tgstreakend }<br>   set tgstreak 0<br>   set tgplaying 0<br>   catch {unbind pubm -|- "$tgchan $tgcurrentanswer" tgcorrectanswer}<br>   if {[utimerexists tghint]!=""} {killutimer $tghinttimer}<br>   if {[utimerexists tgnext]!=""} {killutimer $tgnexttimer}<br>   if {[timerexists tgerrremind]!=""} {killtimer $tgerrremindtimer}<br>  }<br>  return 1<br> }<br>}<br><br>#gives a hint if there is currently a question to answer.<br>proc tgforcehint {nick host hand chan text} {<br> global tghinttimer tgnexttimer tgplaying tgchan tgcurrentanswer tgstreak tgstreakmin<br> if {[strlwr $tgchan]==[strlwr $chan]} {<br>  if {$tgplaying==1&amp;&amp;[utimerexists tghint]!=""} {<br>   killutimer $tghinttimer<br>   tghint<br>  }<br>  return 1<br> }<br>}<br><br>#skips the current question if one has been asked.<br>proc tgskip {nick host hand chan text} {<br> global tghinttimer tgnexttimer tgplaying tgchan tgcurrentanswer tgstreak tgstreakmin tgtimenext<br> if {[strlwr $tgchan]==[strlwr $chan]} {<br>  if {$tgplaying==1&amp;&amp;[utimerexists tghint]!=""} {<br>   tggamemsg "\00310Skipping to next question by $nick's request..."<br>   if {$tgstreakmin&gt;0&amp;&amp;[lindex [split $tgstreak ,] 1]&gt;=$tgstreakmin} { tgstreakend }<br>   set tgstreak 0<br>   unbind pubm -|- "$tgchan $tgcurrentanswer" tgcorrectanswer<br>   killutimer $tghinttimer<br>   set tgnexttimer [utimer $tgtimenext tgnext]<br>  }<br>  return 1<br> }<br>}<br><br>#reminds channel how to report errors in questions/answers<br>proc tgerrremind {} {<br> global tgerrremindtimer tgerrremindtime botnick tgcmderror<br> tggamemsg "\00306Remember: to report errors in questions/answers, type \00307/msg $botnick $tgcmderror &lt;number&gt; \[description\]"<br> set tgerrremindtimer [timer $tgerrremindtime tgerrremind]<br>}<br><br><br>#bot got kicked. stop the game.<br>proc tgbotgotkicked {nick host hand chan targ text} {<br> tgquietstop<br>}<br><br>#bot got disconnected. stop the game.<br>proc tgbotgotdisconnected {disconnect-server} {<br> tgquietstop<br>}<br><br>#stops the game quietly.<br>proc tgquietstop {} {<br> global tgplaying tgstreak tgchan tgcurrentanswer tghinttimer tgnexttimer tgerrremindtimer<br> if {$tgplaying==1} {<br>  set tgstreak 0<br>  set tgplaying 0<br>  catch {unbind pubm -|- "$tgchan $tgcurrentanswer" tgcorrectanswer}<br>  if {[utimerexists tghint]!=""} {killutimer $tghinttimer}<br>  if {[utimerexists tgnext]!=""} {killutimer $tgnexttimer}<br>  if {[timerexists tgerrremind]!=""} {killtimer $tgerrremindtimer}<br> }<br>}<br><br>#reads the question database.<br>proc tgreadqdb {} {<br> global tgqdb tgquestionstotal tgquestionslist<br> set tgquestionstotal 0<br> set tgquestionslist ""<br> set qfile [open $tgqdb r]<br> while {![eof $qfile]} {<br>  lappend tgquestionslist [gets $qfile]<br>  incr tgquestionstotal<br> }<br> close $qfile<br>}<br><br>#selects the next question.<br>proc tgnext {} {<br> global tgqdb tgcurrentquestion tgcurrentanswer tgquestionnumber tgquestionstotal<br> global tghintnum tgchan tgquestionslist<br> tgreadqdb<br> set tgquestionnumber [rand [llength $tgquestionslist]]<br> set tgquestionselected [lindex $tgquestionslist $tgquestionnumber]<br> set tgcurrentquestion [lindex [split $tgquestionselected |] 1]<br> set tgcurrentanswer [strlwr [lindex [split $tgquestionselected |] 0]]<br> unset tghintnum<br> tghint<br> bind pubm -|- "$tgchan $tgcurrentanswer" tgcorrectanswer<br> return<br>}<br><br>#shows timed hints.<br>proc tghint {} {<br> global tgmaxhint tghintnum tgcurrentanswer tghinttimer tgchan<br> global tgtimehint tghintchar tgquestionnumber tgquestionstotal<br> global tgcurrentquestion tghintcharsused tgnexttimer tgtimenext tgstreak tgstreakmin<br> global tgnobodygotit tgtrythenextone tgmissed tgmaxmissed tgcmdstart<br> if {[catch {incr tghintnum}]!=0} {set tghintnum 0}<br> if {$tghintnum &gt;= [expr $tgmaxhint+1]} {<br>  incr tgmissed<br>  set _msg ""<br>  append _msg "\00310[lindex $tgnobodygotit [rand [llength $tgnobodygotit]]]"<br>  if {$tgmaxmissed&gt;0&amp;&amp;$tgmissed&gt;=$tgmaxmissed} {<br>   append _msg " That's $tgmissed questions gone by unanswered! The game is now automatically disabled. To start the game again, type $tgcmdstart"<br>   tgquietstop<br>  } else {<br>   append _msg " [lindex $tgtrythenextone [rand [llength $tgtrythenextone]]]"<br>  }<br>  tggamemsg "$_msg"<br>  if {$tgstreakmin&gt;0&amp;&amp;[lindex [split $tgstreak ,] 1]&gt;=$tgstreakmin} { tgstreakend }<br>  set tgstreak 0<br>  catch {unbind pubm -|- "$tgchan $tgcurrentanswer" tgcorrectanswer}<br>  if {$tgmaxmissed==0||$tgmissed&lt;$tgmaxmissed} {<br>   set tgnexttimer [utimer $tgtimenext tgnext]<br>  }<br>  return<br> } elseif {$tghintnum == 0} {<br>  set i 0<br>  set _hint {}<br>  set tghintcharsused {}<br>  regsub -all -- "\[A-Za-z0-9\]" $tgcurrentanswer $tghintchar _hint<br> } elseif {$tghintnum == 1} {<br>  set i 0<br>  set _hint {}<br>  while {$i&lt;[llength [split $tgcurrentanswer " "]]} {<br>   set _word [lindex [split $tgcurrentanswer " "] $i]<br>   set j 0<br>   set _newword {}<br>   while {$j&lt;[strlen $_word]} {<br>    if {$j==0} {<br>     append _newword [stridx $_word $j]<br>     lappend tghintcharsused $i,$j<br>    } else {<br>     if {[string is alnum [stridx $_word $j]]} {<br>      append _newword $tghintchar<br>     } else {<br>      append _newword [stridx $_word $j]<br>      lappend tghintcharsused $i,$j<br>     }<br>    }<br>    incr j<br>   }<br>   lappend _hint $_newword<br>   incr i<br>  }<br>  } else {<br>   set i 0<br>   set _hint {}    <br>   while {$i&lt;[llength [split $tgcurrentanswer " "]]} {<br>    set _word [lindex [split $tgcurrentanswer " "] $i]<br>    set j 0<br>    set _newword {}<br>    set _selected [rand [strlen $_word]]<br>    regsub -all -- "\[^A-Za-z0-9\]" $_word "" _wordalnum<br>    if {[strlen $_wordalnum]&gt;=$tghintnum} {<br>     while {[lsearch $tghintcharsused $i,$_selected]!=-1||[string is alnum [stridx $_word $_selected]]==0} {<br>      set _selected [rand [strlen $_word]]<br>     }<br>    }<br>    lappend tghintcharsused $i,$_selected<br>    while {$j&lt;[strlen $_word]} {<br>     if {[lsearch $tghintcharsused $i,$j]!=-1||[string is alnum [stridx $_word $j]]==0} {<br>      append _newword [stridx $_word $j]<br>     } else {<br>      if {[string is alnum [stridx $_word $j]]} {<br>       append _newword $tghintchar<br>      }<br>    }<br>    incr j<br>   }<br>   lappend _hint $_newword<br>   incr i<br>  }<br> }<br> tggamemsg "\00304===== Question [expr $tgquestionnumber+1]/$tgquestionstotal [expr $tghintnum?"(Hint $tghintnum/$tgmaxhint)":""] ====="<br> tggamemsg "\00312[strupr $tgcurrentquestion]"<br> tggamemsg "\00303Hint: [strupr $_hint]"<br> set tghinttimer [utimer $tgtimehint tghint]<br>}<br><br>#triggered when someone says the correct answer.<br>proc tgcorrectanswer {nick host hand chan text} {<br> global tgcurrentanswer tghinttimer tgtimenext tgchan tgnexttimer tgstreak tgstreakmin<br> global tgscoresbyname tgranksbyname tgranksbynum tgcongrats tgscorestotal tgmissed<br> tggetscores<br> if {![info exists tgranksbyname($nick)]} {<br>  set _oldrank 0<br> } else {<br>  set _oldrank [lindex [split $tgranksbyname($nick) ,] 0]<br> }<br> tgincrscore $nick<br> tggetscores<br> set _newrank [lindex [split $tgranksbyname($nick) ,] 0]<br> set _msg "\00306[lindex $tgcongrats [rand [llength $tgcongrats]]] \00304$nick\00306! The answer was \00304[strupr $tgcurrentanswer]\00306."<br> if {$_newrank&lt;$_oldrank} {<br>  if {$_newrank==1} {<br>   append _msg " You are now in first place!"<br>  } else {<br>   append _msg " You are now ranked \00304[tgnumsuf [lindex [split $tgranksbyname($nick) ,] 0]]\00306 of \00304$tgscorestotal\00306, behind \00304[lindex [split $tgranksbynum([expr $_newrank-1]) ,] 0]\00306 with \00304[lindex [split $tgranksbynum([expr $_newrank-1]) ,] 1]\00306."<br>  }<br> }<br> tggamemsg "$_msg"<br> if {$tgstreak!=0} {<br>  if {[lindex [split $tgstreak ,] 0]==$nick} {<br>   set tgstreak $nick,[expr [lindex [split $tgstreak ,] 1]+1]<br>   if {$tgstreakmin&gt;0&amp;&amp;[lindex [split $tgstreak ,] 1]&gt;=$tgstreakmin} {<br>    tggamemsg "\00312$nick is on a winning streak! [lindex [split $tgstreak ,] 1] in a row so far!"<br>   }<br>  } else {<br>   if {$tgstreakmin&gt;0&amp;&amp;[lindex [split $tgstreak ,] 1]&gt;=$tgstreakmin} { tgstreakend }<br>   set tgstreak $nick,1<br>  }<br> } else {<br>  set tgstreak $nick,1<br> }<br> set tgmissed 0<br> tgshowscores<br> unbind pubm -|- "$tgchan $tgcurrentanswer" tgcorrectanswer<br> killutimer $tghinttimer<br> set tgnexttimer [utimer $tgtimenext tgnext]<br> return 1<br>}<br><br>#read current scores from file, sort and store in variable.<br>proc tggetscores {} {<br> global tgscf tgscorestotal tgscores tgscoresbyname tgranksbyname tgranksbynum<br> if {[file exists $tgscf]&amp;&amp;[file size $tgscf]&gt;2} {<br>  set _sfile [open $tgscf r]<br>  set tgscores [lsort -dict -decreasing [split [gets $_sfile] " "]]<br>  close $_sfile<br>  set tgscorestotal [llength $tgscores]<br> } else {<br>  set tgscores ""<br>  set tgscorestotal 0<br> }<br> if {[info exists tgscoresbyname]} {unset tgscoresbyname}<br> if {[info exists tgranksbyname]} {unset tgranksbyname}<br> if {[info exists tgranksbynum]} {unset tgranksbynum}<br> set i 0<br> while {$i&lt;[llength $tgscores]} {<br>  set _item [lindex $tgscores $i]<br>  set _nick [lindex [split $_item ,] 2]<br>  set _score [lindex [split $_item ,] 0]<br>  set tgscoresbyname($_nick) $_score<br>  set tgranksbyname($_nick) [expr $i+1],$_score<br>  set tgranksbynum([expr $i+1]) $_nick,$_score<br>  incr i<br> }<br> return<br>}<br><br>#increment someone's score.<br>proc tgincrscore {who} {<br> global tgscores tgscf tgpointsperanswer tgscorestotal<br> tggetscores<br> if {$tgscorestotal&gt;0} {<br>  set i 0<br>  if {[lsearch $tgscores "*,*,$who"]==-1} {<br>   append _newscores "1,[expr 1000000000000.0/[unixtime]],$who "<br>  }<br>  while {$i&lt;[llength $tgscores]} {<br>   set _item [lindex $tgscores $i]<br>   set _nick [lindex [split $_item ,] 2]<br>   set _time [lindex [split $_item ,] 1]<br>   set _score [lindex [split $_item ,] 0]<br>   if {[strlwr $who]==[strlwr $_nick]} {<br>    append _newscores "[expr $_score+$tgpointsperanswer],[expr 1000000000000.0/[unixtime]],$who[expr [expr [llength $tgscores]-$i]==1?"":"\ "]"<br>   } else {<br>    append _newscores "$_score,$_time,$_nick[expr [expr [llength $tgscores]-$i]==1?"":"\ "]"<br>   }<br>   incr i<br>  }<br> } else {<br>  append _newscores "1,[expr 1000000000000.0/[unixtime]],$who"<br> }<br> set _sfile [open $tgscf w]<br> puts $_sfile "$_newscores"<br> close $_sfile<br> return<br>}<br><br>#shows the current scores on channel.<br>proc tgshowscores {} {<br> global tgscores tgchan tgscorestotal<br> tggetscores<br> set i 0<br> while {$i&lt;[llength $tgscores]} {<br>  set _item [lindex $tgscores $i]<br>  set _nick [lindex [split $_item ,] 2]<br>  set _score [lindex [split $_item ,] 0]<br>  if {$i==0} {<br>   append _scores "\00304$_nick $_score"<br>  } elseif {$i==1} {<br>   append _scores ", \00303$_nick $_score"<br>  } elseif {$i==2} {<br>   append _scores ", \00312$_nick $_score"<br>  } elseif {[onchan $_nick $tgchan]} {<br>   append _scores ", \00306$_nick $_score"<br>  }<br>  incr i<br> }<br> tggamemsg "\00306The scores: $_scores"<br>}<br><br>#reset current scores.<br>proc tgresetscores {nick host hand text} {<br> global tgscf tgscorestotal tgscores<br> if {[file exists $tgscf]&amp;&amp;[file size $tgscf]&gt;2} {<br>  set _sfile [open $tgscf w]<br>  puts $_sfile ""<br>  close $_sfile<br>  set tgscores ""<br>  set tgscorestotal 0<br> }<br> tggamemsg "\00304===== Score table reset by $nick! ====="<br> return 1<br>}<br><br>#triggered when a winning streak ends.<br>proc tgstreakend {} {<br>  global tgstreak<br>  tggamemsg "\00312So much for [lindex [split $tgstreak ,] 0]'s winning streak."<br>  return<br>}<br><br>#triggered when someone joins trivia chan.<br>proc tgjoinmsg {nick host hand chan} {<br> global botnick tgplaying tgcmdhelp tgcmdstart<br> if {$nick != $botnick} {<br>  putnotc $nick "Welcome to $botnick's trivia channel. Trivia game is currently \002[expr $tgplaying?"on\002.":"off\002. To start the game, type \002$tgcmdstart\002."] Please type \002/MSG $botnick [strupr $tgcmdhelp]\002 if you need help. Enjoy your stay! <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":-)" title="Smile">"<br> }<br>}<br><br>#triggered when someone /msgs the bot with the score lookup command.<br>proc tgscorelookup {nick host hand text} {<br> global tgscoresbyname tgranksbyname tgscorestotal<br> if {$text==""} { set text $nick } else { set text [lindex [split $text " "] 0] }<br> tggetscores<br> set _array [array get tgscoresbyname]<br> set _index [lsearch [strlwr "$_array"] [strlwr "$text"]]<br> if {$_index==-1} {<br>  if {[strlwr $text]==[strlwr $nick]} {<br>   set _who "\00306You are"<br>  } else {<br>   set _who "\00304$text \00306is"<br>  }<br>  putnotc $nick "[tgbold]$_who \00306not on the score list."<br> } else {<br>  set _nick [lindex $_array $_index]<br>  if {[strlwr $_nick]==[strlwr $nick]} {<br>   set _who "\00306You are"<br>  } else {<br>   set _who "\00304$_nick \00306is"<br>  }<br>  putnotc $nick "[tgbold]$_who on \00304$tgscoresbyname($_nick)\00306, ranked \00304[tgnumsuf [lindex [split $tgranksbyname($_nick) ,] 0]] \00306of \00304$tgscorestotal\00306."<br> }<br> return 1<br>}<br><br>#triggered when someone /msgs the bot with the target lookup command.<br>proc tgtargetlookup {nick host hand text} {<br> global tgscoresbyname tgranksbyname tgscorestotal tgranksbynum<br> tggetscores<br> set _array [array get tgscoresbyname]<br> set _index [lsearch [strlwr "$_array"] [strlwr "$nick"]]<br> set _nick [lindex $_array $_index]<br> if {$_index==-1} {<br>  putnotc $nick "[tgbold]\00306You are not on the score list."<br> } elseif {$tgranksbyname($_nick)==1} {<br>  putnotc $nick "[tgbold]\00304You're in first place!"<br> } else {<br>  set _myrank [lindex [split $tgranksbyname($_nick) ,] 0]<br>  set _myscore [lindex [split $tgscoresbyname($_nick) ,] 0]<br>  set _tgtrank [expr [lindex [split $tgranksbyname($_nick) ,] 0]-1]<br>  set _tgtnick [lindex [split $tgranksbynum($_tgtrank) ,] 0]<br>  set _tgtscore [lindex [split $tgranksbynum($_tgtrank) ,] 1]<br>  putnotc $nick "[tgbold]\00306You are on \00304$_myscore\00306. Your next target is \00304$_tgtnick \00306with \00304$_tgtscore\00306, ranked \00304[tgnumsuf $_tgtrank] \00306of \00304$tgscorestotal\00304."<br> }<br> return 1<br>}<br><br>#triggered when someone /msgs the bot with the target lookup command.<br>proc tgerror {nick host hand text} {<br> global tgquestionstotal tgquestionslist tgerrfil<br> if {$text==""||![string is int [lindex $text 0]]} {<br>  putnotc $nick "[tgbold]\00306You need to specify the number of the question."<br>  return<br> }<br> tgreadqdb<br> set _qnum [lindex $text 0]<br> if {$_qnum&gt;$tgquestionstotal} {<br>  putnotc $nick "[tgbold]\00306No such question."<br>  return<br> }<br> set _qques [lindex [split [lindex $tgquestionslist [expr $_qnum-1]] |] 1]<br> set _qans [lindex [split [lindex $tgquestionslist [expr $_qnum-1]] |] 0]<br> set _desc [lrange $text 1 end]<br> if {$_desc==""} { set _desc "No further info given for this error." }<br> set _file [open $tgerrfil a]<br> puts $_file "Reported by:\t$nick"<br> puts $_file "Question #:\t$_qnum"<br> puts $_file "Question:\t$_qques"<br> puts $_file "Answer:\t\t$_qans"<br> puts $_file "Comments:\t$_desc"<br> puts $_file "--------------------------------------------------------------------------------"<br> close $_file<br> putnotc $nick "[tgbold]\00306Thanks for reporting the error."<br> return 1<br>}<br><br>#triggered when someone /msgs the bot with the help command.<br>proc tggivehelp {nick host hand {text ""}} {<br> global botnick tgcmdlookup tgcmdhelp tgcmdstart tgcmdstop tgchan tgflagsstop<br> global tgcmdstop tgflagshint tgcmdhint tgflagsskip tgcmdskip tgflagsreset tgcmdreset<br> global tgcmdtarget tgcmderror<br> if {$text==""} {<br>  putnotc $nick "You have access to the following /MSG commands:"<br>  putnotc $nick "To use, /MSG $botnick &lt;command&gt;"<br>  putnotc $nick "  \002[strupr $tgcmdlookup]\002 \[nick\]"<br>  putnotc $nick "   -- Shows you the rank &amp; score of \[nick\], if specified,"<br>  putnotc $nick "    otherwise, shows you your own rank &amp; score."<br>  putnotc $nick "  \002[strupr $tgcmdtarget]\002"<br>  putnotc $nick "   -- Shows you the rank &amp; score of the person ranked"<br>  putnotc $nick "    one above you."<br>  putnotc $nick "  \002[strupr $tgcmderror]\002 &lt;number&gt; \[description\]"<br>  putnotc $nick "   -- Reports an error in question &lt;number&gt;"<br>  putnotc $nick "    The description is optional, but helpful."<br>  if {[matchattr $hand $tgflagsreset $tgchan]} {<br>   putnotc $nick "  \002[strupr $tgcmdreset]\002"<br>   putnotc $nick "   -- Resets the score table."<br>  }<br>  putnotc $nick "For a list of channel commands, /MSG $botnick [strupr $tgcmdhelp] PUBCMDS"<br> }<br> if {[strlwr $text]=="pubcmds"} {<br>  putnotc $nick "You have access to the following channel commands:"<br>  putnotc $nick "  \002$tgcmdstart\002 -- starts the trivia game."<br>  if {[matchattr $hand $tgflagsstop $tgchan]} {<br>   putnotc $nick "  \002$tgcmdstop\002 -- stops the trivia game."<br>  }<br>  if {[matchattr $hand $tgflagshint $tgchan]} {<br>   putnotc $nick "  \002$tgcmdhint\002 -- shows a hint."<br>  }<br>  if {[matchattr $hand $tgflagsskip $tgchan]} {<br>   putnotc $nick "  \002$tgcmdskip\002 -- skips current question."<br>  }<br>  putnotc $nick "For a list of /MSG commands, /MSG $botnick [strupr $tgcmdhelp]"<br> }<br> return 1<br>}<br><br>#misc aliases<br>proc tggamemsg {what} {global tgchan;putquick "PRIVMSG $tgchan :[tgbold]$what"}<br>proc tggamenotc {who what} {putquick "NOTICE $who :$what"}<br>proc tgnumsuf {num} {set _last1 [string range $num [expr [strlen $num]-1] end];set _last2 [string range $num [expr [strlen $num]-2] end];if {$_last1=="1"&amp;&amp;$_last2!="11"} {return "[expr $num]st"} elseif {$_last1=="2"&amp;&amp;$_last2!="12"} {return "[expr $num]nd"} elseif {$_last1=="3"&amp;&amp;$_last2!="13"} {return "[expr $num]rd"} else {return "[expr $num]th"}}<br>proc tgbold {} {global tgusebold;if {$tgusebold==1} {return "\002"}}<br><br>putlog "* [file tail [info script]] by DarkMist` loaded."<br>tgreadqdb<br>putlog "* $tgquestionstotal questions in $tgqdb"<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2708">Viper359</a> — Fri Oct 24, 2003 5:57 pm</p><hr />
]]></content>
	</entry>
	</feed>
