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

	<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>2021-08-27T03:52:11-04:00</updated>

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

		<entry>
		<author><name><![CDATA[CrazyCat]]></name></author>
		<updated>2021-08-27T03:52:11-04:00</updated>

		<published>2021-08-27T03:52:11-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=110253#p110253</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=110253#p110253"/>
		<title type="html"><![CDATA[error trivia tcl]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=110253#p110253"><![CDATA[
as said on eggdrop.fr, a <strong class="text-strong">set tgmaxhintcurrent 0</strong> is missing in the initialization of script<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=691">CrazyCat</a> — Fri Aug 27, 2021 3:52 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[mabrook]]></name></author>
		<updated>2021-08-26T09:27:18-04:00</updated>

		<published>2021-08-26T09:27:18-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=110252#p110252</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=110252#p110252"/>
		<title type="html"><![CDATA[error trivia tcl]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=110252#p110252"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>########################################################################## PLEASE customise the settings before rehashing your bot!          ## Author:        Graeme Donaldson                                   ## IRC:           Souperman #eggdrop @ Undernet                      ## Translated by: Florin Ciprian Bodin                               ## IRC:           OryNider #Bibliuta @ Undernet                      ## WWW:           www.pubory.uv.ro                                   ## Version:       Trivia 2.2.1 ## Lang: Romanian/English                                               ###########################################################################  The full path to the file containing the questions and answers.  #  The account the bot runs on must have read access to this file.set tgqdb "scripts/trivia_que.txt"#  The character that seperates the question and the answer in the#  question/answer file.set tgqdbsep "="#  What you set here defines how the bot expects the question/answer#  pairs to be arranged.#  If set to 1, bot expects lines in the format:#    question&lt;seperator&gt;answer#  If set to 0, bot expects lines in the format:#    answer&lt;seperator&gt;questionset tgqdbquestionfirst 1#  The full path to the file which tracks the scores. The account#  the bot runs on must have read &amp; write access to this file. If#  the file does not exist, it will be created when needed.set tgscf "scripts/trivia.scores"#  How to send error reports. Set to 1 to send error report to an#  e-mail address of your choice, or 0 to record errors in a file.#  Sending via e-mail requires that the bot have access to the "mail"#  program. If the bot doesn't have access to this program (e.g. if#  you're running the bot on the Windows platform), then set this to#  0 to have errors recorded in a file.set tgerrmethod 0#  The full path to the file which records error reports. The#  account the bot runs on must have read &amp; write access to this#  file. If the file does not exist, it will be created when needed.set tgerrfil "scripts/trivia.errors"#  The e-mail address to send error reports to.set tgerremail "you@somewhere.com"#  If error reports are sent via e-mail, where will the bot create#  a temp file? /tmp is usually a good idea.set tgerrmailtmp "/tmp"#  The full path to the file which the bot will use to generate#  an HTML info page. The account the bot runs on must have read#  &amp; write access to this file. If the file does not exist, it will#  be created when needed.#  set tghtmlfile "/var/www/html/skorlar/index.html"set tghtmlfile "mychan.html"#  How often (in seconds) does the html file get updated. Set to 0#  to disable HTML page.set tghtmlrefresh 0#  The font to use on the html page.set tghtmlfont "verdana,helvetica,arial"#  The name of the channel where the game will be played. The game#  can only be played on one channel.set tgchan "#club-53"#  How many points to give a person for a correctly answered#  question.set tgpointsperanswer 10#  The maximum number of hints to give before the question 'expires'#  and the bot goes on to another one. This EXCLUDES the first hint#  given as the question is asked (i.e. the hint which shows no letters,#  only placeholders).set tgmaxhint 3#  Should the bot show the question on each hint (1) or only on the first (0)?set tgalwaysshowq 1#  Show questions in all CAPS (1) or not (0)?set tgcapsquestion 0#  Show answers in all CAPS (1) or not (0)?set tgcapsanswer 0#  Show hints in all CAPS (1) or not (0)?set tgcapshint 0#  The minimum number of correct answers in a row by one person which#  puts them on a winning streak. Setting this to 0 will disable the#  winning streak feature.set tgstreakmin 3#  How many points to give for a simple winning streak.set tgstreakpoints 3#  The number of missed (i.e. unanswered, not skipped) questions to allow#  before automatically stopping the game. Setting this to 0 will cause the#  game to run until somebody uses the stop command, or the bot dies, gets#  killed, pings out, or whatever. Or if next setting is nor 0.set tgmaxmissed 0#  The maximum number of points that can be acumulated untill pause.#  The game can be started again with tgcmdtrivia "!trivia" command#  by any player. set tgmaxallowed 200#  The character to use as a placeholder in hints.set tghintchar "*"#  The time in seconds between hints.set tgtimehint 20#  The time in seconds between a correct answer, 'expired' or skipped question#  and the next question being asked.set tgtimenext 10#  Phrases to use at random when someone answers a question correctly. This must#  be a TCL list. If you don't know what that means, stick to the defaults.set tgcongrats [list "Felicitari" "Bine" "Bravo" "Asa da" "Te-ai prins" "Corect" "Arata-le cum se face" "Mama ce creier are"]#  Phrases to use when the question has 'expired'. Must also be a TCL list.set tgnobodygotit [list "Nimeni nu a gasit raspunsul." "Hello? E cineva acasa?" "Ar trebui sa va straduiti mai mult!" "Sunt oare prea grele intrebarile?" "Vorbesc cumva singur?" "Nu cred ca se pot castiga puncte in felul asta!"]#  Phrases to use when the question expired and there's another one coming up.#  Yep, you guessed it... another TCL list.set tgtrythenextone [list "Sa vedem daca o stiti si pe asta..." "Pregatiti-va pentru urmatoarea..." "Poate o sa o stiti pe urmatoarea..." "Incercati sa o aflati pe urmatoarea..." "Urmatoarea intrebare..."]#  Will the bot calculate the time it took to get the correct#  answer (1) or not (0)? (requires TCL 8.3 or higher).set tgtimeanswer 1#  Will the bot show the correct answer if nobody gets it (1) or not (0)?set tgshowanswer 1#  When someone answers a question, will the bot show just that person's score (0)#  or will it show all players' scores (1) (default). This is useful in channels with#  a large number (&gt;20) players.set tgshowallscores 0#  Use bold codes in messages (1) or not (0)?set tgusebold 0#  Send private messages using /msg (1) or not (0)?#  If set to 0, private messages will be sent using /noticeset tgpriv2msg 0#  Word to use as /msg command to give help.#  e.g. set tgcmdhelp "helpme" will make the bot give help when someone#  does "/msg &lt;botnick&gt; ajutor"set tgcmdhelp "ajutor"#  Channel command used to start the game.set tgcmdstart "!start"#  Flags required to be able to use the start command.set tgflagsstart "-|-"#  Channel command used to stop the game.set tgcmdstop "!stop"#  Flags required to be able to use the stop command.set tgflagsstop "o|o"#  Channel command used to pause the game.set tgcmdpause "!pause"#  Flags required to be able to use the puse command.set tgflagspause "o|o"#  Channel command used to start the game if paused.set tgcmdtrivia "!trivia"#  Flags required to be able to use the trivia command.set tgflagstrivia "-|-"#  Channel command used to give a hint.set tgcmdhint "!sugestie"#  Flags required to be able to use the hint command.set tgflagshint "-|-"#  Disable the !sugestie command x seconds after someone uses it. This#  prevents accidental double hints if two people use the command in#  quick succession.set tgtempnohint 10#  Channel command used to skip the question.#  set tgcmdskip "!sari"set tgcmdskip "!skip"#  Flags required to be able to use the skip command.set tgflagsskip "o|o"#  Channel command for showing the top 10 scores.set tgcmdtop10 "!top"set tgcmdtop20 "!top20"#  Flags required to use the top 10 command.set tgflagstop10 "-|-"#  /msg command used to reset scores.set tgcmdreset "reset"#  Flags required to be able to use the reset command.set tgflagsreset "m|m"#  Require password for resetting scores?#  If enabled, you must use /msg bot reset &lt;password&gt; to reset scores.#  The password is the one set by a user using '/msg bot pass'.set tgresetreqpw 1#  /msg command for looking up somebody's score.set tgcmdlookup "scor"#  /msg command for looking up your target.#  (i.e. the person ranked one higher than you).set tgcmdtarget "concurent"#  /msg command for reporting errors in questions and/or answers.set tgcmderror "eroare"#  /msg command to show channel's rules.set tgcmdrules "reguli"#  Channel's rules.set tgrules "Fara reclama, fara profanari, fara certuri, fara scripturi active sau flood. Incalca aceste reguli si fi gata sa ai ban. Distractie placuta! :-)"#  Number of minutes between reminders of how to report errors.set tgerrremindtime 20#  COLOURS#  The colour codes used are the same as those used by mIRC:#  00:white        01:black        02:dark blue    03:dark green#  04:red          05:brown        06:purple       07:orange#  08:yellow       09:light green  10:turquoise    11:cyan#  12:light blue   13:magenta      14:dark grey    15:light grey##  Always specify colour codes as two digits, i.e. use "01" for#  black, not "1".#  You can specify a background colour using "00,04" (white text#  on red background).#  To disable a colour, use "".#  Note that disabling some colours but not others may yield#  unexpected results.set tgcolourstart "08,02";#Game has started.set tgcolourstop "08,02";#Game has stopped.set tgcolourskip "02";#Question has been skipped.set tgcolourerr "12";#How to report errors.set tgcolourmiss "02";#Nobody answered the question.set tgcolourqhead "01";#Question heading.set tgcolourqbody "08,02";#Question textset tgcolourhint "00,12";#Hint.set tgcolourstrk "12";#Person is on a winning streak.set tgcolourscr1 "04";#Score of person in first place.set tgcolourscr2 "12";#Score of person in second place.set tgcolourscr3 "03";#Score of person in third place.set tgcolourrset "04";#Scores have been reset.set tgcolourstend "12";#Winning streak ended.set tgcolourmisc1 "09,01";#Miscellaneous colour #1 (Top).set tgcolourmisc2 "04";#Miscellaneous colour #2.set tgcolourmisc3 "04,01";#Miscellaneous colour #3.# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # ##                                                                   ##     Any editing done beyond this point is done at your own risk!  ##                                                                   ## # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # ##Misc checks &amp; var initialisationsset tgver "2.2"set tgrel "stable"if {[info tclversion]&lt;8.2} {putlog "\002[file tail [info script]]\002 Script Calistirilamadi, Turkdrop 2.2.1 ve tcl 8.2+ kullandiginizdan emin olun..."return}if {$tgtimeanswer==1&amp;&amp;[info tclversion]&lt;8.3} {putlog "\002[file tail [info script]]\002 warning: Cevap suresi tcl versionunuz yuzunden hesaplanamiyacaktir..."set tgtimeanswer 0}if {![info exists alltools_loaded]||$allt_version&lt;205} {putlog "\002[file tail [info script]]\002 Trivia tcl calismak icin Turkdrop 2.2.1 ve alltools.tcl ye ihtiyac duymaktadir..."return}if {[utimerexists tghtml]!=""} {killutimer $tghtmlrefreshtimer}if {$tghtmlrefresh&gt;0} {set tghtmlrefreshtimer [utimer $tghtmlrefresh tghtml]}if {![file exists $tgqdb]} {putlog "\002[file tail [info script]]\002 failed to load: $tgqdb does not exist."return}if {[llength [split $tgchan]]!=1} {putlog "\002[file tail [info script]]\002 failed to load: too many channels specified."return}if {![info exists tgplaying]} {set ctcp-version "${ctcp-version} (Turkdrop 2.2.1 ve trivia2.2.tcl yuklu www.ircturk.org)"set tgplaying 0}if {![info exists tghintnum]} {set tghintnum 0}if {![info exists tgmissed]} {set tgmissed 0}if {![info exists tgmaxacumulated]} {set tgmaxacumulated 0}if {![info exists tgstreakplus]} {set tgstreakplus 0}#Bindsbind pubm $tgflagsstart "$tgchan %$tgcmdstart" tgstartbind pubm $tgflagsstop "$tgchan %$tgcmdstop" tgstopproc tgbindhintcmd {} {global tgflagshint tgcmdhintbind pubm $tgflagshint "$::tgchan %$tgcmdhint" tgforcehint}proc tgunbindhintcmd {} {global tgflagshint tgcmdhintunbind pubm $tgflagshint "$::tgchan %$tgcmdhint" tgforcehint}tgbindhintcmdbind pubm $tgflagsskip "$tgchan %$tgcmdskip" tgskipbind pubm $tgflagstop10 "$tgchan %$tgcmdtop10" tgshowtop10bind pubm $tgflagstop10 "$tgchan %$tgcmdtop20" tgshowtop20bind pubm $tgflagspause "$tgchan %$tgcmdpause" tgpausebind pubm $tgflagstrivia "$tgchan %$tgcmdtrivia" tgtriviabind join -|- "$tgchan *" tgjoinmsgbind msg - $tgcmdhelp tggivehelpbind msg - $tgcmdlookup tgscorelookupbind msg - $tgcmdtarget tgtargetlookupbind msg - $tgcmderror tgerrorbind msg - $tgcmdrules tgrulesmsgbind msg $tgflagsreset "$tgcmdreset" tgresetscoresbind kick - "$tgchan $botnick" tgbotgotkickedbind evnt - disconnect-server tgbotgotdisconnected#starts the game if it isn't running.proc tgstart {nick host hand chan text} {global tgplaying tgpause tgstreak tgchan tgerrremindtime tgerrremindtimer tgmissed tgmaxacumulated tgmaxhintcurrent tgcmdtriviaif {[strlwr $tgchan]==[strlwr $chan]} {if {$tgplaying==0} {tggamemsg "[tgcolstart]$nick Jocul de Trivia Porneste!"tgnextqset tgplaying 1set tgstreak 0set tgmissed 0set tgpause 0set tgmaxacumulated 0set tgerrremindtimer [timer $tgerrremindtime tgerrremind]}}}#stops the game if it's running.proc tgstop {nick host hand chan text} {global tghinttimer tgnextqtimer tgplaying tgchan tgcurrentanswer tgstreak tgstreakminglobal tgpause tgerrremindtimer tgrebindhinttimerif {[strlwr $tgchan]==[strlwr $chan]} {if {$tgplaying==1} {tggamemsg "[tgcolstop] Jocul a fost oprit de $nick!"if {$tgstreakmin&gt;0&amp;&amp;[lindex [split $tgstreak ,] 1]&gt;=$tgstreakmin} { tgstreakend }set tgstreak 0set tgplaying 0set tgpause 0catch {unbind pubm -|- "$tgchan *" tgcheckanswer}if {[utimerexists tghint]!=""} {killutimer $tghinttimer}if {[utimerexists tgnextq]!=""} {killutimer $tgnextqtimer}if {[timerexists tgerrremind]!=""} {killtimer $tgerrremindtimer}if {[utimerexists tgrebindhinttimer]!=""} {killtimer $tgrebindhinttimer}} elseif {$tgpause==1} {tggamemsg "[tgcolstop] Jocul a fost oprit de $nick!"set tgstreak 0set tgplaying 0set tgpause 0}}}#pauses the game if it's running.proc tgpause {nick host hand chan text} {global tghinttimer tgnextqtimer tgplaying tgchan tgcurrentanswer tgstreak tgstreakminglobal tgpause tgerrremindtimer tgrebindhinttimerif {[strlwr $tgchan]==[strlwr $chan]} {if {$tgplaying==1} {tggamemsg "[tgcolstop] Jocul a fost pus in pauza de $nick!"if {$tgstreakmin&gt;0&amp;&amp;[lindex [split $tgstreak ,] 1]&gt;=$tgstreakmin} { tgstreakend }set tgstreak 0set tgplaying 0set tgpause 1catch {unbind pubm -|- "$tgchan *" tgcheckanswer}if {[utimerexists tghint]!=""} {killutimer $tghinttimer}if {[utimerexists tgnextq]!=""} {killutimer $tgnextqtimer}if {[timerexists tgerrremind]!=""} {killtimer $tgerrremindtimer}if {[utimerexists tgrebindhinttimer]!=""} {killtimer $tgrebindhinttimer}}}}#quiet pauses the game if max accumulated point are riched.proc tgquietpause {} {global tghinttimer tgnextqtimer tgplaying tgchan tgcurrentanswer tgstreak tgstreakminglobal tgpause tgerrremindtimer tgrebindhinttimerif {$tgplaying==1} {if {$tgstreakmin&gt;0&amp;&amp;[lindex [split $tgstreak ,] 1]&gt;=$tgstreakmin} { tgstreakend }set tgstreak 0set tgplaying 0set tgpause 1catch {unbind pubm -|- "$tgchan *" tgcheckanswer}if {[utimerexists tghint]!=""} {killutimer $tghinttimer}if {[utimerexists tgnextq]!=""} {killutimer $tgnextqtimer}if {[timerexists tgerrremind]!=""} {killtimer $tgerrremindtimer}if {[utimerexists tgrebindhinttimer]!=""} {killtimer $tgrebindhinttimer}} elseif {$tgpause==1} {set tgstreak 0set tgplaying 0set tgpause 0catch {unbind pubm -|- "$tgchan *" tgcheckanswer}if {[utimerexists tghint]!=""} {killutimer $tghinttimer}if {[utimerexists tgnextq]!=""} {killutimer $tgnextqtimer}if {[timerexists tgerrremind]!=""} {killtimer $tgerrremindtimer}if {[utimerexists tgrebindhinttimer]!=""} {killtimer $tgrebindhinttimer}}}#starts the game if it's paused.proc tgtrivia {nick host hand chan text} {global tgplaying tgstreak tgpause tgchan tgerrremindtime tgerrremindtimer tgmissed tgmaxacumulatedif {[strlwr $tgchan]==[strlwr $chan]} {if {$tgplaying==0 &amp;&amp; $tgpause==1} {tggamemsg "[tgcolstart]$nick Jocul de Trivia Continua!"tgnextqset tgplaying 1set tgstreak 0set tgmissed 0set tgpause 0set tgmaxacumulated 0set tgerrremindtimer [timer $tgerrremindtime tgerrremind]}}}#gives a hint if there is currently a question to answer.proc tgforcehint {nick host hand chan text} {global tghinttimer tgnextqtimer tgplaying tgchan tgcurrentanswer tgstreak tgstreakminglobal tgtempnohint tgmaxhintcurrent tghintnum tgrebindhinttimer tgtempnohintif {[strlwr $tgchan]==[strlwr $chan]} {if {$tgplaying==1&amp;&amp;[utimerexists tghint]!=""} {killutimer $tghinttimertghinttgunbindhintcmdif {$tghintnum&lt;$tgmaxhintcurrent} {set tgrebindhinttimer [utimer $tgtempnohint tgbindhintcmd]}}}}#skips the current question if one has been asked.proc tgskip {nick host hand chan text} {global tghinttimer tgnextqtimer tgplaying tgchan tgcurrentanswer tgstreakglobal tgstreakmin tgtimenext tgrebindhinttimerif {[strlwr $tgchan]==[strlwr $chan]} {if {$tgplaying==1&amp;&amp;[utimerexists tghint]!=""} {tggamemsg "[tgcolskip]Sar peste aceasta intrebare dupa cum m-a rugat [tgcolmisc2]$nick[tgcolskip]."if {$tgstreakmin&gt;0&amp;&amp;[lindex [split $tgstreak ,] 1]&gt;=$tgstreakmin&amp;&amp;[strlwr [lindex [split $tgstreak ,] 0]]==[strlwr $nick]} {tgstreakendset tgstreak 0}catch {unbind pubm -|- "$tgchan *" tgcheckanswer}killutimer $tghinttimerif {[utimerexists tgrebindhinttimer]!=""} {killtimer $tgrebindhinttimer}set tgnextqtimer [utimer $tgtimenext tgnextq]}}}#reminds channel how to report errors in questions/answersproc tgerrremind {} {global tgerrremindtimer tgerrremindtime botnick tgcmderrortggamemsg "[tgcolerr]Pentru a raporta erori, intrebari sau raspunsuri incorecte va rog sa folositi /msg $botnick $tgcmderror &lt;numar&gt; \[descriere\]"set tgerrremindtimer [timer $tgerrremindtime tgerrremind]}#bot got kicked. stop the game.proc tgbotgotkicked {nick host hand chan targ text} {tgquietstop}#bot got disconnected. stop the game.proc tgbotgotdisconnected {disconnect-server} {tgquietstop}#stops the game without telling the channel.proc tgquietstop {} {global tgplaying tgstreak tgchan tgcurrentanswer tghinttimer tgnextqtimer tgerrremindtimerglobal tgrebindhinttimerif {$tgplaying==1} {set tgstreak 0set tgplaying 0catch {unbind pubm -|- "$tgchan *" tgcheckanswer}if {[utimerexists tghint]!=""} {killutimer $tghinttimer}if {[utimerexists tgnextq]!=""} {killutimer $tgnextqtimer}if {[timerexists tgerrremind]!=""} {killtimer $tgerrremindtimer}if {[utimerexists tgrebindhinttimer]!=""} {killtimer $tgrebindhinttimer}}}#reads the question database.proc tgreadqdb {} {global tgqdb tgquestionstotal tgquestionslistset tgquestionstotal 0set tgquestionslist ""set qfile [open $tgqdb r]set tgquestionslist [split [read -nonewline $qfile] "\n"]set tgquestionstotal [llength $tgquestionslist]close $qfile}#selects the next question.proc tgnextq {} {global tgqdb tgcurrentquestion tgcurrentanswer tgquestionnumberglobal tgquestionstotal tghintnum tgchan tgquestionslist tgqdbsep tgqdbquestionfirstglobal tgcapsquestion tgcapsanswertgreadqdbset tgcurrentquestion ""set tgcurrentanswer ""while {$tgcurrentquestion == ""} {set tgquestionnumber [rand [llength $tgquestionslist]]set tgquestionselected [lindex $tgquestionslist $tgquestionnumber]set tgcurrentquestion [lindex [split $tgquestionselected $tgqdbsep] [expr $tgqdbquestionfirst^1]]if {$tgcapsquestion==1} {set tgcurrentquestion [strupr $tgcurrentquestion] }# set tgcurrentquestion "$tgcurrentquestion ?\n" set tgcurrentanswer [string trim [lindex [split $tgquestionselected $tgqdbsep] $tgqdbquestionfirst]]if {$tgcapsanswer==1} {set tgcurrentanswer [strupr $tgcurrentanswer]}}unset tghintnumtghintbind pubm -|- "$tgchan *" tgcheckanswerreturn}#shows timed hints.proc tghint {} {global tgmaxhint tghintnum tgcurrentanswer tghinttimer tgchanglobal tgtimehint tghintchar tgquestionnumber tgquestionstotalglobal tgcurrentquestion tghintcharsused tgnextqtimer tgtimenext tgstreak tgstreakminglobal tgnobodygotit tgtrythenextone tgmissed tgmaxmissed tgcmdstart tgshowanswerglobal tgtimestart tgtimeanswer tgalwaysshowq tgmaxhintcurrent tgtempnohint tgcapshintglobal tgmaxacumulated tgpointsperanswer tgmaxallowed tgcmdtriviaif {[catch {incr tghintnum}]!=0} {set tghintnum 0regsub -all -- "\[^A-Za-z0-9\]" $tgcurrentanswer "" _hintcharsset tgmaxhintcurrent [expr [strlen $_hintchars]&lt;=$tgmaxhint?[expr [strlen $_hintchars]-1]:$tgmaxhint]catch {tgunbindhintcmd}if {$tgmaxhintcurrent&gt;0} {set tgrebindhinttimer [utimer $tgtempnohint tgbindhintcmd]}}if {$tghintnum &gt;= [expr $tgmaxhintcurrent+1]} {incr tgmissedif {$tgmaxacumulated==0} {set tgmaxacumulated [expr $tgpointsperanswer]} else {set tgmaxacumulated [expr $tgmaxacumulated + $tgpointsperanswer]}set _msg ""append _msg "[tgcolmiss][lindex $tgnobodygotit [rand [llength $tgnobodygotit]]]"if {$tgshowanswer==1} {append _msg " Raspunsul corect era [tgcolmisc2]$tgcurrentanswer[tgcolmiss]. Puncte acumulate [tgcolmisc2]$tgmaxacumulated/$tgmissed[tgcolmiss]."}if {$tgmaxallowed&gt;0&amp;&amp;$tgmaxacumulated&gt;=$tgmaxallowed} {append _msg " Se pare ca va intreb dejeaba! Jocul se opreste din cauza aceasta... si pierdeti si punctele acumulate pana acum ([tgcolmisc2]$tgmaxacumulated[tgcolmiss]) Pentru a RePorni trivia folositi comanda [tgcolmisc2]$tgcmdtrivia [tgcolmiss]"  tgquietpause} elseif {$tgmaxmissed&gt;0&amp;&amp;$tgmissed&gt;=$tgmaxmissed} {append _msg " Se pare ca va intreb dejeaba! Sunt $tgmissed intrebari la care nu s-a raspuns! Jocul se opreste din cauza aceasta... Pentru a RePorni trivia folositi comanda [tgcolmisc2]$tgcmdtrivia [tgcolmiss]"tgquietpause} else {append _msg " [lindex $tgtrythenextone [rand [llength $tgtrythenextone]]]"}tggamemsg "[tgcolmiss]$_msg"if {$tgstreakmin&gt;0&amp;&amp;[lindex [split $tgstreak ,] 1]&gt;=$tgstreakmin} { tgstreakend }set tgstreak 0catch {unbind pubm -|- "$tgchan *" tgcheckanswer}if {($tgmaxmissed==0||$tgmissed&lt;$tgmaxmissed)&amp;&amp;($tgmaxallowed==0||$tgmaxacumulated&lt;$tgmaxallowed)} {set tgnextqtimer [utimer $tgtimenext tgnextq]}return} elseif {$tghintnum == 0} {set i 0set _hint {}set tghintcharsused {}foreach word [split $tgcurrentanswer] {regsub -all -- "\[A-Za-z0-9\]" $word $tghintchar _currentlappend _hint $_current}if {$tgtimeanswer==1} {set tgtimestart [clock clicks -milliseconds]}} elseif {$tghintnum == 1} {set i 0set _hint {}while {$i&lt;[llength [split $tgcurrentanswer]]} {set _word [lindex [split $tgcurrentanswer] $i]set j 0set _newword {}while {$j&lt;[strlen $_word]} {if {$j==0} {append _newword [stridx $_word $j]lappend tghintcharsused $i,$j} else {if {[string is alnum [stridx $_word $j]]} {append _newword $tghintchar} else {append _newword [stridx $_word $j]lappend tghintcharsused $i,$j}}incr j}lappend _hint $_newwordincr i}} else {set i 0set _hint {}while {$i&lt;[llength [split $tgcurrentanswer]]} {set _word [lindex [split $tgcurrentanswer] $i]set j 0set _newword {}set _selected [rand [strlen $_word]]regsub -all -- "\[^A-Za-z0-9\]" $_word "" _wordalnumif {[strlen $_wordalnum]&gt;=$tghintnum} {while {[lsearch $tghintcharsused $i,$_selected]!=-1||[string is alnum [stridx $_word $_selected]]==0} { set _selected [rand [strlen $_word]]}}lappend tghintcharsused $i,$_selectedwhile {$j&lt;[strlen $_word]} {if {[lsearch $tghintcharsused $i,$j]!=-1||[string is alnum [stridx $_word $j]]==0} {append _newword [stridx $_word $j]} else {if {[string is alnum [stridx $_word $j]]} {append _newword $tghintchar}}incr j}lappend _hint $_newwordincr i}}if {$tgcapshint==1} {set _hint [strupr $_hint]}tggamemsg "[tgcolqhead] = Intrebarea [expr $tgquestionnumber+1]/$tgquestionstotal [expr $tghintnum?"(Indiciul $tghintnum/$tgmaxhintcurrent)":""] = "if {$tgalwaysshowq==1||$tghintnum==0} {tggamemsg "[tgcolqbody]$tgcurrentquestion"}tggamemsg "[tgcolhint]Indiciu: [join $_hint]"set tghinttimer [utimer $tgtimehint tghint]}#triggered when someone uses !top commandproc tgshowtop10 {nick host hand chan text} {global tgscores tgchan tgscorestotalif {[strlwr $chan]==[strlwr $tgchan]} {tggetscoresif {$tgscorestotal&gt;0} {if {$tgscorestotal&gt;9} {set _max 9} else {set _max [expr $tgscorestotal-1]}set i 0while {$i&lt;=$_max} {set _item [lindex $tgscores $i]set _nick [join [lindex [split $_item ,] 2]]set _score [join [lindex [split $_item ,] 0]]if {$i==0} {append _scores "[tgcolscr1]$_nick $_score"} elseif {$i==1} {append _scores ", [tgcolscr2]$_nick $_score"} elseif {$i==2} {append _scores ", [tgcolscr3]$_nick $_score"} else {append _scores ", [tgcolmisc1]$_nick $_score"}incr i}tggamemsg "\00309,01 T\00311o\037\00309P\00308 10 \00309,01\00313General:\00300,01 $_scores"} else {tggamemsg "[tgcolmisc1]Nu este nimeni in Top."}}}#triggered when someone uses !top20 commandproc tgshowtop20 {nick host hand chan text} {global tgscores tgchan tgscorestotalif {[strlwr $chan]==[strlwr $tgchan]} {tggetscoresif {$tgscorestotal&gt;0} {if {$tgscorestotal&gt;19} {set _max 19} else {set _max [expr $tgscorestotal-1]}set i 0while {$i&lt;=$_max} {set _item [lindex $tgscores $i]set _nick [join [lindex [split $_item ,] 2]]set _score [join [lindex [split $_item ,] 0]]if {$i==0} {append _scores "[tgcolscr1]$_nick $_score"} elseif {$i==1} {append _scores ", [tgcolscr2]$_nick $_score"} elseif {$i==2} {append _scores ", [tgcolscr3]$_nick $_score"} else {append _scores ", [tgcolmisc1]$_nick $_score"}incr i}tggamemsg "\00309,01 T\00311o\037\00309P\00308 20 \00309,01\00313General:\00300,01 $_scores"} else {tggamemsg "[tgcolmisc1]Nu este nimeni in Top."}}}#checks if anyone has said the correct answer on channel.proc tgcheckanswer {nick host hand chan text} {global tgcurrentanswerif {[strlwr $tgcurrentanswer] == [tgstripcodes [strlwr [string trim $text]]]} {tgcorrectanswer $nick}}#triggered when someone says the correct answer.proc tgcorrectanswer {nick} {global tgcurrentanswer tghinttimer tgtimenext tgchan tgnextqtimer tgstreak tgstreakmin tgstreakplusglobal tgscoresbyname tgranksbyname tgranksbynum tgcongrats tgscorestotal tgmissed tgstreakpointsglobal tgtimestart tgshowallscores tgrealnames tgscoresbyrank tgtimeanswer tgmaxacumulatedtggetscoresif {![info exists tgranksbyname([strlwr $nick])]} {set _oldrank 0} else {set _oldrank $tgranksbyname([strlwr $nick])}tgincrscore $nicktggetscoresset _newrank $tgranksbyname([strlwr $nick])set _timetoanswer ""if {$tgtimeanswer==1} {set _timetoanswer [expr [expr [clock clicks -milliseconds]-$tgtimestart]/1000.00]}set _msg "[tgcolmisc1][lindex $tgcongrats [rand [llength $tgcongrats]]] [tgcolmisc2]$nick[tgcolmisc1]! Raspunsul corect este [tgcolmisc2]$tgcurrentanswer[tgcolmisc1].[expr $tgtimeanswer==1?" Lai dat in [tgcolmisc2]$_timetoanswer[tgcolmisc1] secunde.":""]"if {$_newrank&lt;$_oldrank} {if {$_newrank==1} {append _msg " Eshti pe primul loc!"} else {if {$tgshowallscores==0} {append _msg " Ai avansat inca un loc!"} else {append _msg " Esti pe locul [tgcolmisc2][ordnumber $tgranksbyname([strlwr $nick])][tgcolmisc1]  [tgcolmisc2]$tgscorestotal[tgcolmisc1] dogru cevap ile, senin onunde [tgcolmisc2]$tgrealnames($tgranksbynum([expr $_newrank-1]))[tgcolmisc1] var, [tgcolmisc2]$tgscoresbyrank([expr $_newrank-1])[tgcolmisc1] dogru cevap ile."}}}tggamemsg "$_msg"if {$tgstreak!=0} {if {[lindex [split $tgstreak ,] 0]==[strlwr $nick]} {set tgstreak [strlwr $nick],[expr [lindex [split $tgstreak ,] 1]+1]if {$tgstreakmin&gt;0&amp;&amp;[lindex [split $tgstreak ,] 1]&gt;=$tgstreakmin} {if {$tgstreakpoints&gt;0} { set tgstreakplus [expr [lindex [split $tgstreak ,] 1]*$tgstreakpoints]tggamemsg "[tgcolstrk][tgcolmisc2]$nick[tgcolstrk] e pus pe fapte mari! [tgcolmisc2][lindex [split $tgstreak ,] 1] [tgcolstrk]raspunsuri corecte consecutive pana acum! Bonus [tgcolmisc2]+$tgstreakplus [tgcolstrk]puncte."} else { set tgstreakplus 0tggamemsg "[tgcolstrk][tgcolmisc2]$nick[tgcolstrk] e pus pe fapte mari! [tgcolmisc2][lindex [split $tgstreak ,] 1] [tgcolstrk]raspunsuri corecte consecutive pana acum!"}}} else {if {$tgstreakmin&gt;0&amp;&amp;[lindex [split $tgstreak ,] 1]&gt;=$tgstreakmin} { tgstreakend }set tgstreakplus 0set tgstreak [strlwr $nick],1}} else {set tgstreakplus 0set tgstreak [strlwr $nick],1}set tgmissed 0set tgmaxacumulated 0 tgshowscores $nickcatch {unbind pubm -|- "$tgchan *" tgcheckanswer}killutimer $tghinttimerset tgnextqtimer [utimer $tgtimenext tgnextq]}#read current scores from file, sort and store in variable.proc tggetscores {} {global tgscf tgscorestotal tgscores tgscoresbyname tgranksbyname tgranksbynumglobal tgrealnames tgscoresbyrankif {[file exists $tgscf]&amp;&amp;[file size $tgscf]&gt;2} {set _sfile [open $tgscf r]set tgscores [lsort -dict -decreasing [split [gets $_sfile]]]close $_sfileset tgscorestotal [llength $tgscores]} else {set tgscores ""set tgscorestotal 0}if {[info exists tgscoresbyname]} {unset tgscoresbyname}if {[info exists tgranksbyname]} {unset tgranksbyname}if {[info exists tgrealnames]} {unset tgrealnames}if {[info exists tgranksbynum]} {unset tgranksbynum}set i 0while {$i&lt;[llength $tgscores]} {set _item [lindex $tgscores $i]set _nick [lindex [split $_item ,] 2]set _lwrnick [lindex [split $_item ,] 3]set _score [lindex [split $_item ,] 0]set tgscoresbyname($_lwrnick) $_scoreset tgrealnames($_lwrnick) $_nickset tgranksbyname($_lwrnick) [expr $i+1]set tgranksbynum([expr $i+1]) $_lwrnickset tgscoresbyrank([expr $i+1]) $_scoreincr i}return}#increment someone's score.proc tgincrscore {who} {global tgscores tgscf tgpointsperanswer tgscorestotal tgscoresbyname tgmaxacumulated tgstreakplustggetscoresif {$tgscorestotal&gt;0} {set i 0if {![info exists tgscoresbyname([strlwr $who])]} {append _newscores "1,[expr 1000000000000.0/[unixtime]],$who,[strlwr $who] "}while {$i&lt;[llength $tgscores]} {set _item [lindex $tgscores $i]set _nick [lindex [split $_item ,] 2]set _time [lindex [split $_item ,] 1]set _score [lindex [split $_item ,] 0]if {[strlwr $who]==[strlwr $_nick]} {append _newscores "[expr $_score+$tgpointsperanswer+$tgmaxacumulated+$tgstreakplus],[expr 1000000000000.0/[unixtime]],$who,[strlwr $who][expr [expr [llength $tgscores]-$i]==1?"":"\ "]"} else {append _newscores "$_score,$_time,$_nick,[strlwr $_nick][expr [expr [llength $tgscores]-$i]==1?"":"\ "]"}incr i}} else {append _newscores "1,[expr 1000000000000.0/[unixtime]],$who,[strlwr $who]"}set _sfile [open $tgscf w]puts $_sfile "$_newscores"close $_sfilereturn}#shows the current scores on channel.proc tgshowscores {nick} {global tgscores tgchan tgscorestotal tgshowallscores tgranksbyname tgranksbynumglobal tgscoresbyname tgrealnames tgscoresbyrank tgstreakplustggetscoresset i 0if {$tgshowallscores} {while {$i&lt;[llength $tgscores]} {set _item [lindex $tgscores $i]set _nick [lindex [split $_item ,] 2]set _score [lindex [split $_item ,] 0]if {$i==0} {append _scores "[tgcolscr1]$_nick $_score"} elseif {$i==1} {append _scores ", [tgcolscr2]$_nick $_score"} elseif {$i==2} {append _scores ", [tgcolscr3]$_nick $_score"} elseif {[onchan $_nick $tgchan]} {append _scores ", [tgcolmisc1]$_nick $_score"}incr i}tggamemsg "[tgcolmisc1]Sonuclar: $_scores"} else {if {$tgranksbyname([strlwr $nick])==1} {set _tgt "."} else {set _tgt ", in urma lui [tgcolmisc2]$tgrealnames($tgranksbynum([expr $tgranksbyname([strlwr $nick])-1]))[tgcolmisc1] cu [tgcolmisc2]$tgscoresbyrank([expr $tgranksbyname([strlwr $nick])-1])[tgcolmisc1]."}tggamemsg "[tgcolmisc3] $nick [tgcolmisc1]acum are [tgcolmisc2][expr $tgscoresbyname([strlwr $nick])+$tgstreakplus] [tgcolmisc1][expr $tgscoresbyname([strlwr $nick])==1?"punct":"puncte"] si este pe locul [tgcolmisc2][ordnumber $tgranksbyname([strlwr $nick])] [tgcolmisc1]din [tgcolmisc2]$tgscorestotal[tgcolmisc1]$_tgt"}}#reset current scores.proc tgresetscores {nick host hand text} {global tgscf tgscorestotal tgscores tgplaying tgresetreqpwif {($tgresetreqpw==1 &amp;&amp; [passwdok $hand $text]) || $tgresetreqpw==0} {if {[file exists $tgscf]&amp;&amp;[file size $tgscf]&gt;2} {set _sfile [open $tgscf w]puts $_sfile ""close $_sfileset tgscores ""set tgscorestotal 0}tggamemsg "[tgcolrset] = Tabela scorurilor a fost resetata de $nick! = "}}#triggered when a winning streak ends.proc tgstreakend {} {global tgstreak tgrealnamestggamemsg "[tgcolstend]Cam atata cu [tgcolmisc2]$tgrealnames([lindex [split $tgstreak ,] 0])' [tgcolstend] si castigul lui..."return}#triggered when someone joins trivia chan. proc tgjoinmsg {nick host hand chan} { global botnick tgplaying tgcmdhelp tgcmdstart tgflagsstart tgcmdstop tgflagsstop tgchan global tgscorelookupjoin tgscoresbyname tgranksbyname tgscorestotal tgrealnames global tgscoresbyrank tgscores tggetscores if {$nick != $botnick} { set _msg "" append _msg "Bine ai venit pe $chan. Trivia este ON in prezent" if {$tgplaying==1} { append _msg " \002pornita\002." } else { append _msg " \002oprita\002." } if {[matchattr $hand $tgflagsstart $tgchan]&amp;&amp;$tgplaying==0} { append _msg " Pentru a porni jocul foloseste comanda \002$tgcmdstart\002 ." } append _msg " Foloseste \002/MSG $botnick [strupr $tgcmdhelp]\002 daca ai nevoie de ajutor. Distractie placuta! :-) " [tgpriv] $nick "$_msg" if {![info exists tgscoresbyname([strlwr $nick])]} { # tggamemsg "[tgcolmisc1]Bun Venit [tgcolmisc2]$nick [tgcolmisc1]! I-mi pare rau dar nu eshti inca in Top. Sa ai un tipm minunat!!! " } else { # tggamemsg "[tgcolmisc1]Salut [tgcolmisc2]$nick ![tgcolmisc1] Tu ai -&gt; [tgcolmisc2]$tgscoresbyname([strlwr $nick]) [tgcolmisc1]&lt;- [expr $tgscoresbyname([strlwr $nick])==1?"punct":"puncte"] ! Eshti pe locul [tgcolmisc2][ordnumber $tgranksbyname([strlwr $nick])] [tgcolmisc1]din [tgcolmisc2]$tgscorestotal[tgcolmisc1], dupa [tgcolmisc2]$tgrealnames($tgranksbynum([expr $tgranksbyname([strlwr $nick])-1]))[tgcolmisc1] cu [tgcolmisc2]$tgscoresbyrank([expr $tgranksbyname([strlwr $nick])-1])[tgcolmisc1]." } set i 0 while {$i&lt;[llength $tgscores]} { set _item [lindex $tgscores $i] set _nick [lindex [split $_item ,] 2] set _score [lindex [split $_item ,] 0] if {$i&lt;=9&amp;&amp;$nick==$_nick&amp;&amp;[botisop $tgchan]} { putserv "MODE $tgchan +v $nick" putserv "PRIVMSG $tgchan :[tgcolmisc1] Atentie! [tgcolmisc2]$nick [tgcolmisc1] este un jucator bun de trivia deorece este in\00309,01 T\00311o\037\00309P\00308  10\00309,01[tgcolmisc1], el primeshte din acest motiv autovoice (\002+v\002)[tgcolmisc1]!!! " } incr i } } } #triggered when someone /msgs the bot with the score lookup command.proc tgscorelookup {nick host hand text} {global tgscoresbyname tgranksbyname tgscorestotal tgrealnamesif {$text==""} { set text $nick } else { set text [lindex [split $text] 0] }tggetscoresif {![info exists tgscoresbyname([strlwr $text])]} {if {[strlwr $text]==[strlwr $nick]} {set _who "[tgcolmisc1]You are"} else {set _who "[tgcolmisc2]$text [tgcolmisc1]is"}[tgpriv] $nick "[tgbold]$_who [tgcolmisc1]not on the score list."} else {if {[strlwr $text]==[strlwr $nick]} {set _who "[tgcolmisc1]You have"} else {set _who "[tgcolmisc2]$tgrealnames([strlwr $text]) [tgcolmisc1]has"}[tgpriv] $nick "[tgbold]$_who [tgcolmisc2]$tgscoresbyname([strlwr $text])[tgcolmisc1] points, ranked [tgcolmisc2][ordnumber $tgranksbyname([strlwr $text])] [tgcolmisc1]of [tgcolmisc2]$tgscorestotal[tgcolmisc1]."}}#triggered when someone /msgs the bot with the target lookup command.proc tgtargetlookup {nick host hand text} {global tgscoresbyname tgranksbyname tgscorestotal tgranksbynum tgrealnamestggetscoresif {![info exists tgscoresbyname([strlwr $nick])]} {[tgpriv] $nick "[tgbold][tgcolmisc1]You are not on the score list yet."} elseif {$tgranksbyname([strlwr $nick])==1} {[tgpriv] $nick "[tgbold][tgcolmisc1]You are in first place!"} else {[tgpriv] $nick "[tgbold][tgcolmisc1]You are on [tgcolmisc2]$tgscoresbyname([strlwr $nick])[tgcolmisc1]. Your next target is [tgcolmisc2]$tgrealnames($tgranksbynum([expr $tgranksbyname([strlwr $nick])-1])) [tgcolmisc1]with [tgcolmisc2]$tgscoresbyname($tgranksbynum([expr $tgranksbyname([strlwr $nick])-1]))[tgcolmisc1], ranked [tgcolmisc2][ordnumber [expr $tgranksbyname([strlwr $nick])-1]] [tgcolmisc1]of [tgcolmisc2]$tgscorestotal[tgcolmisc1]."}}#triggered when someone /msgs the bot with the error reporting command.proc tgerror {nick host hand text} {global tgquestionstotal tgquestionslist tgerrmethod tgerrfil tgerremail tgerrmailtmpif {$text==""||![string is int [lindex [split $text] 0]]} {[tgpriv] $nick "[tgbold][tgcolmisc1]You need to specify the number of the question."return}tgreadqdbset _qnum [lindex [split $text] 0]if {$_qnum&gt;$tgquestionstotal} {[tgpriv] $nick "[tgbold][tgcolmisc1]No such question."return}set _qques [lindex [split [lindex $tgquestionslist [expr $_qnum-1]] |] 1]set _qans [lindex [split [lindex $tgquestionslist [expr $_qnum-1]] |] 0]set _desc [join [lrange [split $text] 1 end]]if {$_desc==""} { set _desc "No further info given for this error." }if {$tgerrmethod==1} {set _fname $tgerrmailtmp\trivia[rand 100000].tmpset _file [open $_fname w]} else {set _file [open $tgerrfil a]}puts $_file ""puts $_file "Error report generated [strftime %A,\ %d\ %B\ %Y\ @\ %H:%M:%S]"puts $_file "Reported by:\t$nick!$host"puts $_file "Question #:\t$_qnum"puts $_file "Question:\t$_qques"puts $_file "Answer:\t\t$_qans"puts $_file "Comments:\t$_desc"puts $_file "------------------------------"close $_fileif {$tgerrmethod==1} {exec mail -s "trivia.tcl error report from $nick" $tgerremail &lt; $_fnamefile delete $_fname[tgpriv] $nick "[tgbold][tgcolmisc1]Thanks! Your error report has been e-mailed to my owner."} else {[tgpriv] $nick "[tgbold][tgcolmisc1]Thanks! Your error report has been logged and will be looked at as soon as possible."}}#triggered when someone /msgs the bot with the rules command.proc tgrulesmsg {nick host hand text} {global tgrules[tgpriv] $nick "The channel's rules are as follows: $tgrules"}#triggered when someone /msgs the bot with the help command.proc tggivehelp {nick host hand {text ""}} {global botnick tgcmdlookup tgcmdhelp tgcmdstart tgcmdstop tgchan tgflagsstopglobal tgcmdstop tgflagshint tgcmdhint tgflagsskip tgcmdskip tgflagsreset tgcmdresetglobal tgcmdtarget tgcmderror tgcmdrules tgflagsstartif {$text==""} {[tgpriv] $nick "You have access to the following /MSG commands:"[tgpriv] $nick "To use, /MSG $botnick &lt;command&gt;"[tgpriv] $nick "  \002[strupr $tgcmdrules]\002"[tgpriv] $nick "   -- Lists the channel rules."[tgpriv] $nick "  \002[strupr $tgcmdlookup]\002 \[nick\]"[tgpriv] $nick "   -- Shows you the rank &amp; score of \[nick\], if specified,"[tgpriv] $nick "    otherwise, shows you your own rank &amp; score."[tgpriv] $nick "  \002[strupr $tgcmdtarget]\002"[tgpriv] $nick "   -- Shows you the rank &amp; score of the person ranked"[tgpriv] $nick "    one above you."[tgpriv] $nick "  \002[strupr $tgcmderror]\002 &lt;number&gt; \[description\]"[tgpriv] $nick "   -- Reports an error in question &lt;number&gt;"[tgpriv] $nick "    The description is optional, but helpful."if {[matchattr $hand $tgflagsreset $tgchan]} {[tgpriv] $nick "  \002[strupr $tgcmdreset]\002"[tgpriv] $nick "   -- Resets the score table."}[tgpriv] $nick "For a list of channel commands, /MSG $botnick [strupr $tgcmdhelp] PUBCMDS"}if {[strlwr $text]=="pubcmds"} {[tgpriv] $nick "You have access to the following channel commands:"if {[matchattr $hand $tgflagsstart $tgchan]} {[tgpriv] $nick "  \002$tgcmdstart\002 -- starts the trivia game."}if {[matchattr $hand $tgflagsstop $tgchan]} {[tgpriv] $nick "  \002$tgcmdstop\002 -- stops the trivia game."}if {[matchattr $hand $tgflagshint $tgchan]} {[tgpriv] $nick "  \002$tgcmdhint\002 -- shows a hint."}if {[matchattr $hand $tgflagsskip $tgchan]} {[tgpriv] $nick "  \002$tgcmdskip\002 -- skips current question."}[tgpriv] $nick "For a list of /MSG commands, /MSG $botnick [strupr $tgcmdhelp]"}}# Returns text without colour, bold, etc. control codes.# This is a stripped down version of the proc in MC_8's mc.moretools.tcl.proc tgstripcodes {text} {regsub -all -- "\003(\[0-9\]\[0-9\]?(,\[0-9\]\[0-9\]?)?)?" $text "" textset text "[string map -nocase [list \002 "" \017 "" \026 "" \037 ""] $text]"return $text}proc tggamemsg {what} {global tgchanputquick "PRIVMSG $tgchan :[tgbold]$what"}proc tgbold {} {global tguseboldif {$tgusebold==1} { return "\002" }}proc tgcolstart {} {global tgcolourstartif {$tgcolourstart!=""} { return "\003$tgcolourstart" }}proc tgcolstop {} {global tgcolourstopif {$tgcolourstop!=""} { return "\003$tgcolourstop" }}proc tgcolskip {} {global tgcolourskipif {$tgcolourskip!=""} { return "\003$tgcolourskip" }}proc tgcolerr {} {global tgcolourerrif {$tgcolourerr!=""} { return "\003$tgcolourerr" }}proc tgcolmiss {} {global tgcolourmissif {$tgcolourmiss!=""} { return "\003$tgcolourmiss" }}proc tgcolqhead {} {global tgcolourqheadif {$tgcolourqhead!=""} { return "\003$tgcolourqhead" }}proc tgcolqbody {} {global tgcolourqbodyif {$tgcolourqbody!=""} { return "\003$tgcolourqbody" }}proc tgcolhint {} {global tgcolourhintif {$tgcolourhint!=""} { return "\003$tgcolourhint" }}proc tgcolstrk {} {global tgcolourstrkif {$tgcolourstrk!=""} { return "\003$tgcolourstrk" }}proc tgcolscr1 {} {global tgcolourscr1if {$tgcolourscr1!=""} { return "\003$tgcolourscr1" }}proc tgcolscr2 {} {global tgcolourscr2if {$tgcolourscr2!=""} { return "\003$tgcolourscr2" }}proc tgcolscr3 {} {global tgcolourscr3if {$tgcolourscr3!=""} { return "\003$tgcolourscr3" }}proc tgcolrset {} {global tgcolourrsetif {$tgcolourrset!=""} { return "\003$tgcolourrset" }}proc tgcolstend {} {global tgcolourstendif {$tgcolourstend!=""} { return "\003$tgcolourstend" }}proc tgcolmisc1 {} {global tgcolourmisc1if {$tgcolourmisc1!=""} { return "\003$tgcolourmisc1" }}proc tgcolmisc2 {} {global tgcolourmisc2if {$tgcolourmisc2!=""} { return "\003$tgcolourmisc2" }}proc tgcolmisc3 {} {global tgcolourmisc3if {$tgcolourmisc3!=""} { return "\003$tgcolourmisc3" }}proc tgpriv {} {global tgpriv2msgif {$tgpriv2msg==1} { return "putmsg" } else { return "putnotc" }}#this generates an html file with all the people on the chan with#their score, as well as a list of all scores, sorted by rankproc tghtml {} {global tgchan botnick tghtmlfile tghtmlrefresh server tgscoresbyname tgranksbynameglobal tgscorestotal tgranksbyname tgrealnames tgscoresbyrank tgranksbynum tgplayingglobal tgquestionstotal tghtmlrefreshtimer tghtmlfonttggetscorestgreadqdbset _file [open $tghtmlfile~new w]puts $_file "&lt;!DOCTYPE HTML PUBLIC \"-/W3C/DTD HTML 4.01 Transitional/EN\"&gt;"puts $_file "&lt;html&gt;"puts $_file " &lt;head&gt;"puts $_file "  &lt;title&gt;$botnick's trivia channel: $tgchan on [lindex [split $server :] 0]&lt;/title&gt;"puts $_file "  &lt;meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"&gt;"puts $_file "  &lt;meta http-equiv=\"refresh\" content=\"$tghtmlrefresh\"&gt;"puts $_file "  &lt;meta name=\"generator\" content=\"trivia.tcl script for eggdrop. http://www.eggdrop.za.net/\"&gt;"puts $_file "  &lt;style type=\"text/css\"&gt;"puts $_file "  &lt;!--"puts $_file "  body,td{font-family:$tghtmlfont;font-size:13px;}"puts $_file "  a{text-decoration:none;color:#09f;}"puts $_file "  --&gt;"puts $_file "  &lt;/style&gt;"puts $_file " &lt;/head&gt;"puts $_file " &lt;body&gt;"puts $_file "  &lt;h1&gt;$tgchan on [lindex [split $server :] 0]&lt;/h1&gt;"puts $_file "  &lt;hr size=\"1\" noshade&gt;"if {![onchan $botnick $tgchan]} {puts $_file "  &lt;p&gt;Hmmm... for some reason I'm not on $tgchan at the moment. Please try again later.&lt;/p&gt;"} else {puts $_file "  &lt;p&gt;Trivia game is currently &lt;b&gt;[expr $tgplaying==1?"on":"off"]&lt;/b&gt;. There are &lt;b&gt;$tgquestionstotal&lt;/b&gt; questions in the database."puts $_file "  &lt;p&gt;People on $tgchan right now:&lt;br&gt;"puts $_file "  &lt;table width=\"50%\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\"&gt;&lt;tr&gt;&lt;td&gt;&lt;table width=\"100%\" cellspacing=\"3\" border=\"0\"&gt;"puts $_file "   &lt;tr&gt;"puts $_file "    &lt;td&gt;&lt;b&gt;Nick&lt;/b&gt;&lt;/td&gt;"puts $_file "    &lt;td&gt;&lt;b&gt;Score&lt;/b&gt;&lt;/td&gt;"puts $_file "    &lt;td&gt;&lt;b&gt;Rank&lt;/b&gt;&lt;/td&gt;"puts $_file "    &lt;td&gt;&lt;b&gt;Idle&lt;/b&gt;&lt;/td&gt;"puts $_file "   &lt;/tr&gt;"foreach nick [lsort [chanlist $tgchan]] {puts $_file "   &lt;tr&gt;"puts $_file "    &lt;td&gt;[expr [isop $nick $tgchan]?"@":""][expr [isvoice $nick $tgchan]?"+":""]$nick[expr [string match $nick $botnick]?" (that's me!)":""]&lt;/td&gt;"if {[info exists tgscoresbyname([strlwr $nick])]} {puts $_file "    &lt;td&gt;$tgscoresbyname([strlwr $nick])&lt;/td&gt;"} else {puts $_file "    &lt;td&gt;-&lt;/td&gt;"}if {[info exists tgranksbyname([strlwr $nick])]} {puts $_file "    &lt;td&gt;$tgranksbyname([strlwr $nick])&lt;/td&gt;"} else {puts $_file "    &lt;td&gt;-&lt;/td&gt;"}puts $_file "   &lt;td&gt;[expr [getchanidle $nick $tgchan]&gt;10?"[getchanidle $nick $tgchan]m":"-"]&lt;/td&gt;"puts $_file "   &lt;/tr&gt;"}puts $_file "  &lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;"}if {$tgscorestotal&gt;0} {puts $_file "  &lt;p&gt;&lt;small&gt;Exista [expr $tgscorestotal==1?"":""] &lt;b&gt;$tgscorestotal&lt;/b&gt; [expr $tgscorestotal==1?"nick":"nickuri"] in tabela de scor:&lt;br&gt;"set _rank 1while {$_rank&lt;=$tgscorestotal} {puts $_file "  &lt;b&gt;$_rank&lt;/b&gt;. $tgrealnames($tgranksbynum($_rank)) $tgscoresbyrank($_rank)&lt;br&gt;"incr _rank}} else {puts $_file "  &lt;p&gt;&lt;small&gt;Nu exista nici un nick in tabela de scor.&lt;br&gt;"}puts $_file "  &lt;/small&gt;&lt;/p&gt;"puts $_file "  &lt;hr size=\"1\" noshade&gt;"puts $_file "  &lt;small&gt;Generated on [strftime %A,\ %d\ %B\ %Y\ @\ %H:%M:%S] by &lt;a href=\"http://www.eggdrop.za.net/\"&gt;trivia.tcl&lt;/a&gt; for &lt;a href=\"http://www.eggheads.org\"&gt;eggdrop&lt;/a&gt;.&lt;br&gt;"puts $_file "  This page is automatically updated (and refreshed if supported by your browser) every [expr $tghtmlrefresh==1?"second":"$tghtmlrefresh seconds"].&lt;/small&gt;"puts $_file " &lt;/body&gt;"puts $_file "&lt;/html&gt;"close $_filefile rename -force $tghtmlfile~new $tghtmlfileset tghtmlrefreshtimer [utimer $tghtmlrefresh tghtml]}putlog "======================================================="putlog "* Sorubotu $tgver ($tgrel) by WwW.IRCTurk.OrG "putlog "* Yazan: Stonkeep, Org written by Souperman"putlog "* SoruCevap Kanali: $tgchan"tgreadqdbputlog "* Toplam $tgquestionstotal soru $tgqdb ([file size $tgqdb] bytes) yuklendi."putlog "======================================================="</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12921">mabrook</a> — Thu Aug 26, 2021 9:27 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[mabrook]]></name></author>
		<updated>2021-08-26T09:31:40-04:00</updated>

		<published>2021-08-26T08:10:48-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=110251#p110251</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=110251#p110251"/>
		<title type="html"><![CDATA[error trivia tcl]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=110251#p110251"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>&lt;user&gt; .errorInfo&lt;BOT&gt; [08:33:38] ----------------&lt;BOT&gt; [08:33:38] can't read "tgmaxhintcurrent": no such variable&lt;BOT&gt;     while executing&lt;BOT&gt; "expr $tgmaxhintcurrent+1"&lt;BOT&gt;     (procedure "tghint" line 17)&lt;BOT&gt;     invoked from within&lt;BOT&gt; "tghint"&lt;BOT&gt;     (procedure "tgnextq" line 22)&lt;BOT&gt;     invoked from within&lt;BOT&gt; "tgnextq"&lt;BOT&gt;     (procedure "tgstart" line 6)&lt;BOT&gt;     invoked from within&lt;BOT&gt; "tgstart $_pubm1 $_pubm2 $_pubm3 $_pubm4 $_pubm5"&lt;BOT&gt; [08:33:38] errorCode : TCL READ VARNAME&lt;BOT&gt; [08:33:38] ---------------- </code></pre></div><br><br>ORIGINAL SCRIPT<div class="codebox"><p>Code: </p><pre><code>http://paste.tclhelp.net/?id=6psa</code></pre></div><br><br>having issue pasting the entire code in here..<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12921">mabrook</a> — Thu Aug 26, 2021 8:10 am</p><hr />
]]></content>
	</entry>
	</feed>
