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

	<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>2012-03-25T20:41:36-04:00</updated>

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

		<entry>
		<author><name><![CDATA[janii]]></name></author>
		<updated>2012-03-25T20:41:36-04:00</updated>

		<published>2012-03-25T20:41:36-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=99121#p99121</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=99121#p99121"/>
		<title type="html"><![CDATA[hi]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=99121#p99121"><![CDATA[
The Above Code will give top10 players auto voice u can change it to top100 or above as well .... do lemme know if u want it to be autoop to top players enjoyyyy<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11746">janii</a> — Sun Mar 25, 2012 8:41 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[janii]]></name></author>
		<updated>2012-03-25T20:36:39-04:00</updated>

		<published>2012-03-25T20:36:39-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=99120#p99120</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=99120#p99120"/>
		<title type="html"><![CDATA[modified with voice top10 players!!! enjoy]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=99120#p99120"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>set tgchan "#modele" # Set this to how many players you like to voice. set topplayer 10 set tgpointsperanswer 1000 set tgmaxhint 7 set tgqdb "scripts/intrebari.txt" set tgqdbsep "*" set tgqdbquestionfirst 1 set tgscf "scripts/trivia.score" set tgerrmethod 0 set tgerrfil "scripts/trivia.errors" set tgerremail "none@none.com" set tgerrmailtmp "/tmp" set tghtmlfile "public_html/mychan.html" set tghtmlrefresh 0 set tghtmlfont "verdana,helvetica,arial" set tgalwaysshowq 0 set tgcapsquestion 0 set tgcapsanswer 0 set tgcapshint 0 set tgstreakmin 3 set tgmaxmissed 0 set tgcongrats [list "Norocosule" "Bravo Creiere" "Ce norocos esti" "Bun asa" "Raspuns corect" "Ma uimesti" "Bineee" "Bravo" "Felicitãri" "Cam asa se joacã trivia" "Da-i bice" "Mama ce creier are" "Zi le ca le zici bine" "Fiti atenti ce cap mare are" "Ai nimerit-o" "Moaaa, ce le stie" "Aratã-le cum se joacã trivia" "Ai ghicit-o"] set tgnobodygotit [list "Nimeni n`are noroc." "Bahh!!!Mai traieste cineva?" "Mai bagatzi o fisa si mai incearctzi odata!" "Nu mai este nici un dexter on line?" "Mdea... ce frumos e sa intrebi si sa nu primesti raspuns" "Un pic de strãduintzã n-ar strica" "Mai puneti mana pe carte!" "Ce varza sunteti!" "Nimeni nu a stiut" "Vorbesc cumva singur?" "Nu cred ca se pot castiga puncte in felul asta!" "Chiar asa de grele sunt întrebãrile?" "Chiar nu mai joacã nimeni" "N-ati stiut. Vine una mai usoarã" "Asa mai greu faceti punctaj!"] set tgtrythenextone [list "Ia sa vad daca sunteti in stare sa raspundeti la urmatoarea..." "Sunt Pregatit sa ma uimitzi la urmatoarea intrebare..." "Off, hai ca va mai dau o shansa" "Hai ca mai vine una :P " "Poate o stiti pe urmãtoarea" "Pregãtiti-vã dejtele pentru urmãtoarea" "Nu-i nimic, nu-i nimic! Cãstigatzi la loz in plic :P" "Poate, poate rãspundetzi la asta. Mira-m-ash! :D" "Vine una mai simplã pe mãsurile voastre.."] set tgtimeanswer 1 set tgshowanswer 1 set tgshowallscores 0 set tgusebold 0 set tgpriv2msg 1 set tgcmdhelp "?" set tgcmdstart "!start" set tgflagsstart "-|-" set tgcmdstop "!stop" set tgflagsstop "-|-" set tgcmdhint "!hint" set tgflagshint "-|-" set tgtempnohint 4 set tgcmdskip "!next" set tgflagsskip "-|-" set tgcmdtop10 "!top10" set tgflagstop10 "-|-" set tgcmdreset "!reset" set tgflagsreset "o|o" set tgresetreqpw 1 set tgcmdlookup "score" set tgcmdtarget "target" set tgcmderror "error" set tgcmdrules "rules" set tgrules "Nu injura, nu te purta urat cu ceilalti, respecta operatorii, nu floda.Aici e tirania cozi de maimutza. Have fun. :-)" set tgerrremindtime 15 set tghintchar "*" set tgtimehint 12 set tgtimenext 7 # 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 set tgcolourstart "03" ;#Game has started. set tgcolourstop "12" ;#Game has stopped. set tgcolourskip "10" ;#Question has been skipped. set tgcolourerr "02" ;#How to report errors. set tgcolourmiss "01" ;#Nobody answered the question. set tgcolourqhead "02" ;#Question heading. set tgcolourqbody "05,09" ;#Question text set tgcolourhint "03" ;#Hint. set tgcolourstrk "12" ;#Person is on a winning streak. set tgcolourscr1 "02" ;#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 "06" ;#Miscellaneous colour #1. set tgcolourmisc2 "04" ;#Miscellaneous colour #2. # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Any editing done beyond this point is done at your own risk! # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #Misc checks &amp; var initialisations set tgver "Fotomodelu" set tgrel "" if {[info tclversion]&lt;8.2} { putlog "\002[file tail [info script]]\002 failed to load: in order to use this script, eggdrop needs to be compiled to use tcl 8.2 or higher (recommended: latest stable version)." return } if {$tgtimeanswer==1&amp;&amp;[info tclversion]&lt;8.3} { putlog "\002[file tail [info script]]\002 warning: timing of answers has been automatically disabled. this feature requires tcl 8.3 or higher." set tgtimeanswer 0 } if {![info exists alltools_loaded]||$allt_version&lt;205} { putlog "\002[file tail [info script]]\002 failed to load: please load alltools.tcl v1.14 or higher (available with eggdrop 1.6.13 or higher) before attempting to load this script." 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} (with trivia.tcl $tgver ($tgrel) from www.eggdrop.za)" set tgplaying 0 } if {![info exists tghintnum]} {set tghintnum 0} if {![info exists tgmissed]} {set tgmissed 0} #Binds bind pubm $tgflagsstart "$tgchan %$tgcmdstart" tgstart bind pubm $tgflagsstop "$tgchan %$tgcmdstop" tgstop proc tgbindhintcmd {} { global tgflagshint tgcmdhint bind pubm $tgflagshint "$::tgchan %$tgcmdhint" tgforcehint } proc tgunbindhintcmd {} { global tgflagshint tgcmdhint unbind pubm $tgflagshint "$::tgchan %$tgcmdhint" tgforcehint } tgbindhintcmd bind pubm $tgflagsskip "$tgchan %$tgcmdskip" tgskip bind pubm $tgflagstop10 "$tgchan %$tgcmdtop10" tgshowtop10 bind join -|- "$tgchan *" tgjoinmsg bind msg - $tgcmdhelp tggivehelp bind msg - $tgcmdlookup tgscorelookup bind msg - $tgcmdtarget tgtargetlookup bind msg - $tgcmderror tgerror bind msg - $tgcmdrules tgrulesmsg bind msg $tgflagsreset "$tgcmdreset" tgresetscores bind kick - "$tgchan $botnick" tgbotgotkicked bind evnt - disconnect-server tgbotgotdisconnected #starts the game if it isn't running. proc tgstart {nick host hand chan text} { global tgplaying tgstreak tgchan tgerrremindtime tgerrremindtimer tgmissed if {[strlwr $tgchan]==[strlwr $chan]} { if {$tgplaying==0} { tggamemsg "[tgcolstart]Multumesc pentru !start $nick Succes La Puncte!" tgnextq set tgplaying 1 set tgstreak 0 set tgmissed 0 set 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 tgstreakmin global tgerrremindtimer tgrebindhinttimer if {[strlwr $tgchan]==[strlwr $chan]} { if {$tgplaying==1} { tggamemsg "[tgcolstop]Trivia a fost oprita de un(o) bulangiu(ie) numit(a) $nick!" if {$tgstreakmin&gt;0&amp;&amp;[lindex [split $tgstreak ,] 1]&gt;=$tgstreakmin} { tgstreakend } set tgstreak 0 set tgplaying 0 catch {unbind pubm -|- "$tgchan *" tgcheckanswer} if {[utimerexists tghint]!=""} {killutimer $tghinttimer} if {[utimerexists tgnextq]!=""} {killutimer $tgnextqtimer} if {[timerexists tgerrremind]!=""} {killtimer $tgerrremindtimer} if {[utimerexists tgrebindhinttimer]!=""} {killtimer $tgrebindhinttimer} } } } #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 tgstreakmin global tgtempnohint tgmaxhintcurrent tghintnum tgrebindhinttimer tgtempnohint if {[strlwr $tgchan]==[strlwr $chan]} { if {$tgplaying==1&amp;&amp;[utimerexists tghint]!=""} { killutimer $tghinttimer tghint tgunbindhintcmd if {$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 tgstreak global tgstreakmin tgtimenext tgrebindhinttimer if {[strlwr $tgchan]==[strlwr $chan]} { if {$tgplaying==1&amp;&amp;[utimerexists tghint]!=""} { tggamemsg "[tgcolskip]Se sare la urmatoarea intrebare ca asha vrea [tgcolmisc2]$nick [tgcolskip]" if {$tgstreakmin&gt;0&amp;&amp;[lindex [split $tgstreak ,] 1]&gt;=$tgstreakmin&amp;&amp;[strlwr [lindex [split $tgstreak ,] 0]]==[strlwr $nick]} { tgstreakend set tgstreak 0 } catch {unbind pubm -|- "$tgchan *" tgcheckanswer} killutimer $tghinttimer if {[utimerexists tgrebindhinttimer]!=""} {killtimer $tgrebindhinttimer} set tgnextqtimer [utimer $tgtimenext tgnextq] } } } #reminds channel how to report errors in questions/answers proc tgerrremind {} { global tgerrremindtimer tgerrremindtime botnick tgcmderror tggamemsg "[tgcolerr]Anuntz: pentru a raporta erori, scrieti /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 tgerrremindtimer global tgrebindhinttimer if {$tgplaying==1} { set tgstreak 0 set tgplaying 0 catch {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 tgquestionslist set tgquestionstotal 0 set 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 tgquestionnumber global tgquestionstotal tghintnum tgchan tgquestionslist tgqdbsep tgqdbquestionfirst global tgcapsquestion tgcapsanswer tgreadqdb set 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 tgcurrentanswer [string trim [lindex [split $tgquestionselected $tgqdbsep] $tgqdbquestionfirst]] if {$tgcapsanswer==1} { set tgcurrentanswer [strupr $tgcurrentanswer] } } unset tghintnum tghint bind pubm -|- "$tgchan *" tgcheckanswer return } #shows timed hints. proc tghint {} { global tgmaxhint tghintnum tgcurrentanswer tghinttimer tgchan global tgtimehint tghintchar tgquestionnumber tgquestionstotal global tgcurrentquestion tghintcharsused tgnextqtimer tgtimenext tgstreak tgstreakmin global tgnobodygotit tgtrythenextone tgmissed tgmaxmissed tgcmdstart tgshowanswer global tgtimestart tgtimeanswer tgalwaysshowq tgmaxhintcurrent tgtempnohint tgcapshint if {![info exists tghintnum]} { set tghintnum 0 regsub -all -- "\[^A-Za-z0-9\]" $tgcurrentanswer "" _hintchars set tgmaxhintcurrent [expr [strlen $_hintchars]&lt;=$tgmaxhint?[expr [strlen $_hintchars]-1]:$tgmaxhint] catch {tgunbindhintcmd} if {$tgmaxhintcurrent&gt;0} { set tgrebindhinttimer [utimer $tgtempnohint tgbindhintcmd] } } else { incr tghintnum } if {$tghintnum &gt;= [expr $tgmaxhintcurrent+1]} { incr tgmissed set _msg "" append _msg "[tgcolmiss][lindex $tgnobodygotit [rand [llength $tgnobodygotit]]]" if {$tgshowanswer==1} { append _msg " Uite si raspunsul adormitzilor : [tgcolmisc2]$tgcurrentanswer[tgcolmiss]." } if {$tgmaxmissed&gt;0&amp;&amp;$tgmissed&gt;=$tgmaxmissed} { append _msg " Este intrebarea cu nr $tgmissed care a fost neraspunsa! Jocul este inchis automat.Pentru a porni scrieti $tgcmdstart" tgquietstop } 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 0 catch {unbind pubm -|- "$tgchan *" tgcheckanswer} if {$tgmaxmissed==0||$tgmissed&lt;$tgmaxmissed} { set tgnextqtimer [utimer $tgtimenext tgnextq] } return } elseif {$tghintnum == 0} { set i 0 set _hint {} set tghintcharsused {} foreach word [split $tgcurrentanswer] { regsub -all -- "\[A-Za-z0-9\]" $word $tghintchar _current lappend _hint $_current } if {$tgtimeanswer==1} { set tgtimestart [clock clicks -milliseconds] } } elseif {$tghintnum == 1} { set i 0 set _hint {} while {$i&lt;[llength [split $tgcurrentanswer]]} { set _word [lindex [split $tgcurrentanswer] $i] set j 0 set _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 $_newword incr i } } else { set i 0 set _hint {} while {$i&lt;[llength [split $tgcurrentanswer]]} { set _word [lindex [split $tgcurrentanswer] $i] set j 0 set _newword {} set _selected [rand [strlen $_word]] regsub -all -- "\[^A-Za-z0-9\]" $_word "" _wordalnum if {[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,$_selected while {$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 $_newword incr i } } if {$tgcapshint==1} { set _hint [strupr $_hint] } tggamemsg "[tgcolqhead] Intrebarea [expr $tgquestionnumber+1]/$tgquestionstotal [expr $tghintnum?"(Hint $tghintnum/$tgmaxhintcurrent)":""] " if {$tgalwaysshowq==1||$tghintnum==0} { tggamemsg "[tgcolqbody]$tgcurrentquestion" } tggamemsg "[tgcolhint]Indiciu: [join $_hint]" set tghinttimer [utimer $tgtimehint tghint] } #triggered when someone uses !top10 command proc tgshowtop10 {nick host hand chan text} { global tgscores tgchan tgscorestotal if {[strlwr $chan]==[strlwr $tgchan]} { tggetscores if {$tgscorestotal&gt;0} { if {$tgscorestotal&gt;9} { set _max 9 } else { set _max [expr $tgscorestotal-1] } set i 0 while {$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 "[tgcolmisc1]Primi 10 dexteri : $_scores" } else { tggamemsg "[tgcolmisc1]Score Lista cu scoruri e goala." } } } #checks if anyone has said the correct answer on channel. proc tgcheckanswer {nick host hand chan text} { global tgcurrentanswer if {[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 global tgscoresbyname tgranksbyname tgranksbynum tgcongrats tgscorestotal tgmissed global tgtimestart tgshowallscores tgrealnames tgscoresbyrank tgtimeanswer tggetscores if {![info exists tgranksbyname([strlwr $nick])]} { set _oldrank 0 } else { set _oldrank $tgranksbyname([strlwr $nick]) } tgincrscore $nick tggetscores set _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 era [tgcolmisc2]$tgcurrentanswer[tgcolmisc1].[expr $tgtimeanswer==1?" Ai nimerit-o in [tgcolmisc2]$_timetoanswer[tgcolmisc1] secunde.":""]" if {$_newrank&lt;$_oldrank} { if {$_newrank==1} { append _msg " Acum esti pe locul intâi!" } else { if {$tgshowallscores==0} { append _msg " Ai urcat o pozitie in top , dar mai ai pana la primul loc!" } else { append _msg " Acum esti pe locul [tgcolmisc2][ordnumber $tgranksbyname([strlwr $nick])][tgcolmisc1] din [tgcolmisc2]$tgscorestotal[tgcolmisc1], in urma lui [tgcolmisc2]$tgrealnames($tgranksbynum([expr $_newrank-1]))[tgcolmisc1] cu [tgcolmisc2]$tgscoresbyrank([expr $_newrank-1])[tgcolmisc1] ." } } } 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} { tggamemsg "[tgcolstrk][tgcolmisc2]$nick[tgcolstrk] e multiplu castigator! [tgcolmisc2][lindex [split $tgstreak ,] 1] [tgcolstrk] raspunsuri la rand ! Bravo creiere ;)" } } else { if {$tgstreakmin&gt;0&amp;&amp;[lindex [split $tgstreak ,] 1]&gt;=$tgstreakmin} { tgstreakend } set tgstreak [strlwr $nick],1 } } else { set tgstreak [strlwr $nick],1 } set tgmissed 0 tgshowscores $nick catch {unbind pubm -|- "$tgchan *" tgcheckanswer} killutimer $tghinttimer set tgnextqtimer [utimer $tgtimenext tgnextq] } #read current scores from file, sort and store in variable. proc tggetscores {} { global tgscf tgscorestotal tgscores tgscoresbyname tgranksbyname tgranksbynum global tgrealnames tgscoresbyrank if {[file exists $tgscf]&amp;&amp;[file size $tgscf]&gt;2} { set _sfile [open $tgscf r] set tgscores [lsort -dict -decreasing [split [gets $_sfile]]] close $_sfile set 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 0 while {$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) $_score set tgrealnames($_lwrnick) $_nick set tgranksbyname($_lwrnick) [expr $i+1] set tgranksbynum([expr $i+1]) $_lwrnick set tgscoresbyrank([expr $i+1]) $_score incr i } return } #increment someone's score. proc tgincrscore {who} { global tgscores tgscf tgpointsperanswer tgscorestotal tgscoresbyname tggetscores if {$tgscorestotal&gt;0} { set i 0 if {![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],[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 $_sfile return } #shows the current scores on channel. proc tgshowscores {nick} { global tgscores tgchan tgscorestotal tgshowallscores tgranksbyname tgranksbynum global tgscoresbyname tgrealnames tgscoresbyrank tggetscores set i 0 if {$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]The scores: $_scores" } else { if {$tgranksbyname([strlwr $nick])==1} { set _tgt "." } else { set _tgt ", si se afla in urma lu` [tgcolmisc2]$tgrealnames($tgranksbynum([expr $tgranksbyname([strlwr $nick])-1]))[tgcolmisc1] care are [tgcolmisc2]$tgscoresbyrank([expr $tgranksbyname([strlwr $nick])-1])[tgcolmisc1] ." } tggamemsg "[tgcolmisc2]$nick [tgcolmisc1]acum are [tgcolmisc2]$tgscoresbyname([strlwr $nick]) [tgcolmisc1][expr $tgscoresbyname([strlwr $nick])==1?"punct":"puncte"] si e pe locul [tgcolmisc2][ordnumber $tgranksbyname([strlwr $nick])] [tgcolmisc1]din [tgcolmisc2]$tgscorestotal[tgcolmisc1]$_tgt" } } #reset current scores. proc tgresetscores {nick host hand text} { exec rm -rf scripts/trivia.score exec touch scripts/trivia.score } #triggered when a winning streak ends. proc tgstreakend {} { global tgstreak tgrealnames tggamemsg "[tgcolstend]Cam atat pentru [tgcolmisc2]$tgrealnames([lindex [split $tgstreak ,] 0]) [tgcolstend] castigator a multe intrebari la rand." return } # Joining trivia chan. proc tgjoinmsg {nick host hand chan} {     global tgranksbyname topplayer tgscoresbyname tgchan        tggetscores       if {![info exists tgscoresbyname([strlwr $nick])]} {          tggamemsg ""      } else {         if {$tgranksbyname([strlwr $nick])&lt;=$topplayer&amp;&amp;[botisop $tgchan]} {            putserv "MODE $tgchan +v $nick"            putserv ""       }    } } #triggered when someone /msgs the bot with the score lookup command. proc tgscorelookup {nick host hand text} { global tgscoresbyname tgranksbyname tgscorestotal tgrealnames if {$text==""} { set text $nick } else { set text [lindex [split $text] 0] } tggetscores if {![info exists tgscoresbyname([strlwr $text])]} { if {[strlwr $text]==[strlwr $nick]} { set _who "[tgcolmisc1]Esti" } else { set _who "[tgcolmisc2]$text [tgcolmisc1]is" } [tgpriv] $nick "[tgbold]$_who [tgcolmisc1] nu este in lista de scoruri." } else { if {[strlwr $text]==[strlwr $nick]} { set _who "[tgcolmisc1]Ai" } else { set _who "[tgcolmisc2]$tgrealnames([strlwr $text]) [tgcolmisc1]are" } [tgpriv] $nick "[tgbold]$_who [tgcolmisc2]$tgscoresbyname([strlwr $text])[tgcolmisc1] puncte, locul [tgcolmisc2][ordnumber $tgranksbyname([strlwr $text])] [tgcolmisc1]din [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 tgrealnames tggetscores if {![info exists tgscoresbyname([strlwr $nick])]} { [tgpriv] $nick "[tgbold][tgcolmisc1]Nu esti in lista de scoruri inca." } elseif {$tgranksbyname([strlwr $nick])==1} { [tgpriv] $nick "[tgbold][tgcolmisc1]Esti cel mai voinic de pe canal , primu`n top!" } else { [tgpriv] $nick "[tgbold][tgcolmisc1]Esti pe locul [tgcolmisc2]$tgscoresbyname([strlwr $nick])[tgcolmisc1]. Tinta ta este [tgcolmisc2]$tgrealnames($tgranksbynum([expr $tgranksbyname([strlwr $nick])-1])) [tgcolmisc1]cu [tgcolmisc2]$tgscoresbyname($tgranksbynum([expr $tgranksbyname([strlwr $nick])-1]))[tgcolmisc1], locul [tgcolmisc2][ordnumber [expr $tgranksbyname([strlwr $nick])-1]] [tgcolmisc1]din [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 tgerrmailtmp if {$text==""||![string is int [lindex [split $text] 0]]} { [tgpriv] $nick "[tgbold][tgcolmisc1]Trebuie specificat numarul intrebarii!." return } tgreadqdb set _qnum [lindex [split $text] 0] if {$_qnum&gt;$tgquestionstotal} { [tgpriv] $nick "[tgbold][tgcolmisc1]Intrebare inexistenta." 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 "Nu exista detalii privind eroarea" } if {$tgerrmethod==1} { set _fname $tgerrmailtmp\trivia[rand 100000].tmp set _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 $_file if {$tgerrmethod==1} { exec mail -s "trivia.tcl error report from $nick" $tgerremail &lt; $_fname file delete $_fname [tgpriv] $nick "[tgbold][tgcolmisc1]Mersi! Eroarea raportata de tine este trimisa sefului!" } else { [tgpriv] $nick "[tgbold][tgcolmisc1]Mersi! Ma voi uita cit de repede pot pe eroare!" } } #triggered when someone /msgs the bot with the rules command. proc tgrulesmsg {nick host hand text} { global tgrules [tgpriv] $nick "Regulile canalului sunt: $tgrules" } #triggered when someone /msgs the bot with the help command. proc tggivehelp {nick host hand {text ""}} { global botnick tgcmdlookup tgcmdhelp tgcmdstart tgcmdstop tgchan tgflagsstop global tgcmdstop tgflagshint tgcmdhint tgflagsskip tgcmdskip tgflagsreset tgcmdreset global tgcmdtarget tgcmderror tgcmdrules tgflagsstart if {$text==""} { [tgpriv] $nick "Ai acces la urmatoarele comenzi:" [tgpriv] $nick "Sa folosesti, /MSG $botnick &lt;command&gt;" [tgpriv] $nick " \002[strupr $tgcmdrules]\002" [tgpriv] $nick " -- Regulile canalului." [tgpriv] $nick " \002[strupr $tgcmdlookup]\002 \[nick\]" [tgpriv] $nick " -- Arata locul si scorul \[nick\], daca este specificat," [tgpriv] $nick " in caz contrar arata scorul si pozitia ta." [tgpriv] $nick " \002[strupr $tgcmdtarget]\002" [tgpriv] $nick " -- Arata scorul si locul" [tgpriv] $nick " celui din fata ta." [tgpriv] $nick " \002[strupr $tgcmderror]\002 &lt;number&gt; \[description\]" [tgpriv] $nick " -- Raporteaza eroare in cazul intrebarii &lt;number&gt;" [tgpriv] $nick " Descrierea nu este obligatorie, dar ajutatoare" if {[matchattr $hand $tgflagsreset $tgchan]} { [tgpriv] $nick " \002[strupr $tgcmdreset]\002" [tgpriv] $nick " -- Reseteaza tabelul de scoruri." } [tgpriv] $nick "Pentru lista comenzilor publice , /MSG $botnick [strupr $tgcmdhelp] PUBCMDS" } if {[strlwr $text]=="pubcmds"} { [tgpriv] $nick "Ai acces la urmatoarele comenzi publice:" if {[matchattr $hand $tgflagsstart $tgchan]} { [tgpriv] $nick " \002$tgcmdstart\002 -- porneste trivia." } if {[matchattr $hand $tgflagsstop $tgchan]} { [tgpriv] $nick " \002$tgcmdstop\002 -- opreste trivia." } if {[matchattr $hand $tgflagshint $tgchan]} { [tgpriv] $nick " \002$tgcmdhint\002 -- Hint." } if {[matchattr $hand $tgflagsskip $tgchan]} { [tgpriv] $nick " \002$tgcmdskip\002 -- sare peste intrebare." } [tgpriv] $nick "Pentru o lista a comenzilor private, /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 "" text set text "[string map -nocase [list \002 "" \017 "" \026 "" \037 ""] $text]" return $text } proc tggamemsg {what} { global tgchan putquick "PRIVMSG $tgchan :[tgbold]$what" } proc tgbold {} { global tgusebold if {$tgusebold==1} { return "\002" } } proc tgcolstart {} { global tgcolourstart if {$tgcolourstart!=""} { return "\003$tgcolourstart" } } proc tgcolstop {} { global tgcolourstop if {$tgcolourstop!=""} { return "\003$tgcolourstop" } } proc tgcolskip {} { global tgcolourskip if {$tgcolourskip!=""} { return "\003$tgcolourskip" } } proc tgcolerr {} { global tgcolourerr if {$tgcolourerr!=""} { return "\003$tgcolourerr" } } proc tgcolmiss {} { global tgcolourmiss if {$tgcolourmiss!=""} { return "\003$tgcolourmiss" } } proc tgcolqhead {} { global tgcolourqhead if {$tgcolourqhead!=""} { return "\003$tgcolourqhead" } } proc tgcolqbody {} { global tgcolourqbody if {$tgcolourqbody!=""} { return "\003$tgcolourqbody" } } proc tgcolhint {} { global tgcolourhint if {$tgcolourhint!=""} { return "\003$tgcolourhint" } } proc tgcolstrk {} { global tgcolourstrk if {$tgcolourstrk!=""} { return "\003$tgcolourstrk" } } proc tgcolscr1 {} { global tgcolourscr1 if {$tgcolourscr1!=""} { return "\003$tgcolourscr1" } } proc tgcolscr2 {} { global tgcolourscr2 if {$tgcolourscr2!=""} { return "\003$tgcolourscr2" } } proc tgcolscr3 {} { global tgcolourscr3 if {$tgcolourscr3!=""} { return "\003$tgcolourscr3" } } proc tgcolrset {} { global tgcolourrset if {$tgcolourrset!=""} { return "\003$tgcolourrset" } } proc tgcolstend {} { global tgcolourstend if {$tgcolourstend!=""} { return "\003$tgcolourstend" } } proc tgcolmisc1 {} { global tgcolourmisc1 if {$tgcolourmisc1!=""} { return "\003$tgcolourmisc1" } } proc tgcolmisc2 {} { global tgcolourmisc2 if {$tgcolourmisc2!=""} { return "\003$tgcolourmisc2" } } proc tgpriv {} { global tgpriv2msg if {$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 rank proc tghtml {} { global tgchan botnick tghtmlfile tghtmlrefresh server tgscoresbyname tgranksbyname global tgscorestotal tgranksbyname tgrealnames tgscoresbyrank tgranksbynum tgplaying global tgquestionstotal tghtmlrefreshtimer tghtmlfont tggetscores tgreadqdb set _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;There [expr $tgscorestotal==1?"is":"are"] currently &lt;b&gt;$tgscorestotal&lt;/b&gt; [expr $tgscorestotal==1?"nick":"nicks"] in the score table:&lt;br&gt;" set _rank 1 while {$_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;There are currently no nicks in the score table.&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?"secunda":"$tghtmlrefresh secunde"].&lt;/small&gt;" puts $_file " &lt;/body&gt;" puts $_file "&lt;/html&gt;" close $_file file rename -force $tghtmlfile~new $tghtmlfile set tghtmlrefreshtimer [utimer $tghtmlrefresh tghtml] } putlog "=======================================================" putlog "* trivia.tcl $tgver ($tgrel) loaded." tgreadqdb putlog "* $tgquestionstotal questions in $tgqdb ([file size $tgqdb] bytes)" putlog "======================================================="</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11746">janii</a> — Sun Mar 25, 2012 8:36 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[rdstm]]></name></author>
		<updated>2012-01-02T11:01:53-04:00</updated>

		<published>2012-01-02T11:01:53-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=98446#p98446</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=98446#p98446"/>
		<title type="html"><![CDATA[Trivia tcl editing]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=98446#p98446"><![CDATA[
Hello . I have this trivia.tcl and I need help if you have the time to add a feature to it. I would like that the top10 users to recive autovoice or autoop. Best regards. <br>Here goes the code:<br>[code]<br>set tgchan "#modele"<br><br>set tgpointsperanswer 1000<br>set tgmaxhint 7<br>set tgqdb "scripts/intrebari.txt"<br>set tgqdbsep "*"<br>set tgqdbquestionfirst 1<br>set tgscf "scripts/trivia.score"<br>set tgerrmethod 0<br>set tgerrfil "scripts/trivia.errors"<br>set tgerremail "<a href="mailto:none@none.com">none@none.com</a>"<br>set tgerrmailtmp "/tmp"<br>set tghtmlfile "public_html/mychan.html"<br>set tghtmlrefresh 0<br>set tghtmlfont "verdana,helvetica,arial"<br>set tgalwaysshowq 0<br>set tgcapsquestion 0<br>set tgcapsanswer 0<br>set tgcapshint 0<br>set tgstreakmin 3<br>set tgmaxmissed 0<br>set tgcongrats [list "Norocosule" "Bravo Creiere" "Ce norocos esti" "Bun asa" "Raspuns corect" "Ma uimesti" "Bineee" "Bravo" "Felicitãri" "Cam asa se joacã trivia" "Da-i bice" "Mama ce creier are" "Zi le ca le zici bine" "Fiti atenti ce cap mare are" "Ai nimerit-o" "Moaaa, ce le stie" "Aratã-le cum se joacã trivia" "Ai ghicit-o"]<br>set tgnobodygotit [list "Nimeni n`are noroc." "Bahh!!!Mai traieste cineva?" "Mai bagatzi o fisa si mai incearctzi odata!" "Nu mai este nici un dexter on line?" "Mdea... ce frumos e sa intrebi si sa nu primesti raspuns" "Un pic de strãduintzã n-ar strica" "Mai puneti mana pe carte!" "Ce varza sunteti!" "Nimeni nu a stiut" "Vorbesc cumva singur?" "Nu cred ca se pot castiga puncte in felul asta!" "Chiar asa de grele sunt întrebãrile?" "Chiar nu mai joacã nimeni" "N-ati stiut. Vine una mai usoarã" "Asa mai greu faceti punctaj!"]<br>set tgtrythenextone [list "Ia sa vad daca sunteti in stare sa raspundeti la urmatoarea..." "Sunt Pregatit sa ma uimitzi la urmatoarea intrebare..." "Off, hai ca va mai dau o shansa" "Hai ca mai vine una :P " "Poate o stiti pe urmãtoarea" "Pregãtiti-vã dejtele pentru urmãtoarea" "Nu-i nimic, nu-i nimic! Cãstigatzi la loz in plic :P" "Poate, poate rãspundetzi la asta. Mira-m-ash! :D" "Vine una mai simplã pe mãsurile voastre.."]<br>set tgtimeanswer 1<br>set tgshowanswer 1<br>set tgshowallscores 0<br>set tgusebold 0<br>set tgpriv2msg 1<br>set tgcmdhelp "?"<br>set tgcmdstart "!start"<br>set tgflagsstart "-|-"<br>set tgcmdstop "!stop"<br>set tgflagsstop "-|-"<br>set tgcmdhint "!hint"<br>set tgflagshint "-|-"<br>set tgtempnohint 4<br>set tgcmdskip "!next"<br>set tgflagsskip "-|-"<br>set tgcmdtop10 "!top10"<br>set tgflagstop10 "-|-"<br>set tgcmdreset "!reset"<br>set tgflagsreset "o|o"<br>set tgresetreqpw 1<br>set tgcmdlookup "score"<br>set tgcmdtarget "target"<br>set tgcmderror "error"<br>set tgcmdrules "rules"<br>set tgrules "Nu injura, nu te purta urat cu ceilalti, respecta operatorii, nu floda.Aici e tirania cozi de maimutza. Have fun. :-)"<br>set tgerrremindtime 15<br>set tghintchar "*"<br>set tgtimehint 12<br>set tgtimenext 7<br><br>#  COLOURS<br>#  The colour codes used are the same as those used by mIRC:<br>#  00:white        01:black        02:dark blue    03:dark green<br>#  04:red          05:brown        06:purple       07:orange<br>#  08:yellow       09:light green  10:turquoise    11:cyan<br>#  12:light blue   13:magenta      14:dark grey    15:light grey<br><br>set tgcolourstart "03"          ;#Game has started.<br>set tgcolourstop "12"           ;#Game has stopped.<br>set tgcolourskip "10"           ;#Question has been skipped.<br>set tgcolourerr "02"            ;#How to report errors.<br>set tgcolourmiss "01"           ;#Nobody answered the question.<br>set tgcolourqhead "02"          ;#Question heading.<br>set tgcolourqbody "05,09"          ;#Question text<br>set tgcolourhint "03"           ;#Hint.<br>set tgcolourstrk "12"           ;#Person is on a winning streak.<br>set tgcolourscr1 "02"           ;#Score of person in first place.<br>set tgcolourscr2 "12"           ;#Score of person in second place.<br>set tgcolourscr3 "03"           ;#Score of person in third place.<br>set tgcolourrset "04"           ;#Scores have been reset.<br>set tgcolourstend "12"          ;#Winning streak ended.<br>set tgcolourmisc1 "06"          ;#Miscellaneous colour #1.<br>set tgcolourmisc2 "04"          ;#Miscellaneous colour #2.<br><br><br># # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #<br>#                                                                   #<br>#    Any editing done beyond this point is done at your own risk!   #<br>#                                                                   #<br># # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #<br>#Misc checks &amp; var initialisations<br>set tgver "Fotomodelu"<br>set tgrel ""<br>if {[info tclversion]&lt;8.2} {<br>putlog "\002[file tail [info script]]\002 failed to load: in order to use this script, eggdrop needs to be compiled to use tcl 8.2 or higher (recommended: latest stable version)."<br>return<br>}<br>if {$tgtimeanswer==1&amp;&amp;[info tclversion]&lt;8.3} {<br>putlog "\002[file tail [info script]]\002 warning: timing of answers has been automatically disabled. this feature requires tcl 8.3 or higher."<br>set tgtimeanswer 0<br>}<br>if {![info exists alltools_loaded]||$allt_version&lt;205} {<br>putlog "\002[file tail [info script]]\002 failed to load: please load alltools.tcl v1.14 or higher (available with eggdrop 1.6.13 or higher) before attempting to load this script."<br>return<br>}<br>if {[utimerexists tghtml]!=""} {killutimer $tghtmlrefreshtimer}<br>if {$tghtmlrefresh&gt;0} {<br>set tghtmlrefreshtimer [utimer $tghtmlrefresh tghtml]<br>}<br>if {![file exists $tgqdb]} {<br>putlog "\002[file tail [info script]]\002 failed to load: $tgqdb does not exist."<br>return<br>}<br>if {[llength [split $tgchan]]!=1} {<br>putlog "\002[file tail [info script]]\002 failed to load: too many channels specified."<br>return<br>}<br>if {![info exists tgplaying]} {<br>set ctcp-version "${ctcp-version} (with trivia.tcl $tgver ($tgrel) from <a href="http://www.eggdrop.za" class="postlink">www.eggdrop.za</a>)"<br>set tgplaying 0<br>}<br>if {![info exists tghintnum]} {set tghintnum 0}<br>if {![info exists tgmissed]} {set tgmissed 0}<br><br>#Binds<br>bind pubm $tgflagsstart "$tgchan %$tgcmdstart" tgstart<br>bind pubm $tgflagsstop "$tgchan %$tgcmdstop" tgstop<br>proc tgbindhintcmd {} {<br>global tgflagshint tgcmdhint<br>bind pubm $tgflagshint "$::tgchan %$tgcmdhint" tgforcehint<br>}<br>proc tgunbindhintcmd {} {<br>global tgflagshint tgcmdhint<br>unbind pubm $tgflagshint "$::tgchan %$tgcmdhint" tgforcehint<br>}<br>tgbindhintcmd<br>bind pubm $tgflagsskip "$tgchan %$tgcmdskip" tgskip<br>bind pubm $tgflagstop10 "$tgchan %$tgcmdtop10" tgshowtop10<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 - $tgcmdrules tgrulesmsg<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 "[tgcolstart]Multumesc pentru !start $nick Succes La Puncte!"<br>tgnextq<br>set tgplaying 1<br>set tgstreak 0<br>set tgmissed 0<br>set tgerrremindtimer [timer $tgerrremindtime tgerrremind]<br>}<br>}<br>}<br><br>#stops the game if it's running.<br>proc tgstop {nick host hand chan text} {<br>global tghinttimer tgnextqtimer tgplaying tgchan tgcurrentanswer tgstreak tgstreakmin<br>global tgerrremindtimer tgrebindhinttimer<br>if {[strlwr $tgchan]==[strlwr $chan]} {<br>if {$tgplaying==1} {<br>tggamemsg "[tgcolstop]Trivia a fost oprita de un(o) bulangiu(ie) numit(a) $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 *" tgcheckanswer}<br>if {[utimerexists tghint]!=""} {killutimer $tghinttimer}<br>if {[utimerexists tgnextq]!=""} {killutimer $tgnextqtimer}<br>if {[timerexists tgerrremind]!=""} {killtimer $tgerrremindtimer}<br>if {[utimerexists tgrebindhinttimer]!=""} {killtimer $tgrebindhinttimer}<br>}<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 tgnextqtimer tgplaying tgchan tgcurrentanswer tgstreak tgstreakmin<br>global tgtempnohint tgmaxhintcurrent tghintnum tgrebindhinttimer tgtempnohint<br>if {[strlwr $tgchan]==[strlwr $chan]} {<br>if {$tgplaying==1&amp;&amp;[utimerexists tghint]!=""} {<br>killutimer $tghinttimer<br>tghint<br>tgunbindhintcmd<br>if {$tghintnum&lt;$tgmaxhintcurrent} {<br>set tgrebindhinttimer [utimer $tgtempnohint tgbindhintcmd]<br>}<br>}<br>}<br>}<br><br>#skips the current question if one has been asked.<br>proc tgskip {nick host hand chan text} {<br>global tghinttimer tgnextqtimer tgplaying tgchan tgcurrentanswer tgstreak<br>global tgstreakmin tgtimenext tgrebindhinttimer<br>if {[strlwr $tgchan]==[strlwr $chan]} {<br>if {$tgplaying==1&amp;&amp;[utimerexists tghint]!=""} {<br>tggamemsg "[tgcolskip]Se sare la urmatoarea intrebare ca asha vrea [tgcolmisc2]$nick [tgcolskip]"<br>if {$tgstreakmin&gt;0&amp;&amp;[lindex [split $tgstreak ,] 1]&gt;=$tgstreakmin&amp;&amp;[strlwr [lindex [split $tgstreak ,] 0]]==[strlwr $nick]} {<br>tgstreakend<br>set tgstreak 0<br>}<br>catch {unbind pubm -|- "$tgchan *" tgcheckanswer}<br>killutimer $tghinttimer<br>if {[utimerexists tgrebindhinttimer]!=""} {killtimer $tgrebindhinttimer}<br>set tgnextqtimer [utimer $tgtimenext tgnextq]<br>}<br>}<br>}<br><br>#reminds channel how to report errors in questions/answers<br>proc tgerrremind {} {<br>global tgerrremindtimer tgerrremindtime botnick tgcmderror<br>tggamemsg "[tgcolerr]Anuntz: pentru a raporta erori, scrieti /msg $botnick $tgcmderror &lt;numar&gt; \[descriere\]"<br>set tgerrremindtimer [timer $tgerrremindtime tgerrremind]<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 without telling the channel.<br>proc tgquietstop {} {<br>global tgplaying tgstreak tgchan tgcurrentanswer tghinttimer tgnextqtimer tgerrremindtimer<br>global tgrebindhinttimer<br>if {$tgplaying==1} {<br>set tgstreak 0<br>set tgplaying 0<br>catch {unbind pubm -|- "$tgchan *" tgcheckanswer}<br>if {[utimerexists tghint]!=""} {killutimer $tghinttimer}<br>if {[utimerexists tgnextq]!=""} {killutimer $tgnextqtimer}<br>if {[timerexists tgerrremind]!=""} {killtimer $tgerrremindtimer}<br>if {[utimerexists tgrebindhinttimer]!=""} {killtimer $tgrebindhinttimer}<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>set tgquestionslist [split [read -nonewline $qfile] "\n"]<br>set tgquestionstotal [llength $tgquestionslist]<br>close $qfile<br>}<br><br>#selects the next question.<br>proc tgnextq {} {<br>global tgqdb tgcurrentquestion tgcurrentanswer tgquestionnumber<br>global tgquestionstotal tghintnum tgchan tgquestionslist tgqdbsep tgqdbquestionfirst<br>global tgcapsquestion tgcapsanswer<br>tgreadqdb<br>set tgcurrentquestion ""<br>set tgcurrentanswer ""<br>while {$tgcurrentquestion == ""} {<br>set tgquestionnumber [rand [llength $tgquestionslist]]<br>set tgquestionselected [lindex $tgquestionslist $tgquestionnumber]<br>set tgcurrentquestion [lindex [split $tgquestionselected $tgqdbsep] [expr $tgqdbquestionfirst^1]]<br>if {$tgcapsquestion==1} {<br>set tgcurrentquestion [strupr $tgcurrentquestion]<br>}<br>set tgcurrentanswer [string trim [lindex [split $tgquestionselected $tgqdbsep] $tgqdbquestionfirst]]<br>if {$tgcapsanswer==1} {<br>set tgcurrentanswer [strupr $tgcurrentanswer]<br>}<br>}<br>unset tghintnum<br>tghint<br>bind pubm -|- "$tgchan *" tgcheckanswer<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 tgnextqtimer tgtimenext tgstreak tgstreakmin<br>global tgnobodygotit tgtrythenextone tgmissed tgmaxmissed tgcmdstart tgshowanswer<br>global tgtimestart tgtimeanswer tgalwaysshowq tgmaxhintcurrent tgtempnohint tgcapshint<br>if {![info exists tghintnum]} { <br>          set tghintnum 0 <br>          regsub -all -- "\[^A-Za-z0-9\]" $tgcurrentanswer "" _hintchars <br>          set tgmaxhintcurrent [expr [strlen $_hintchars]&lt;=$tgmaxhint?[expr [strlen $_hintchars]-1]:$tgmaxhint] <br>          catch {tgunbindhintcmd} <br>          if {$tgmaxhintcurrent&gt;0} { <br>             set tgrebindhinttimer [utimer $tgtempnohint tgbindhintcmd] <br>          } <br>       } else { incr tghintnum } <br>if {$tghintnum &gt;= [expr $tgmaxhintcurrent+1]} {<br>incr tgmissed<br>set _msg ""<br>append _msg "[tgcolmiss][lindex $tgnobodygotit [rand [llength $tgnobodygotit]]]"<br>if {$tgshowanswer==1} {<br>append _msg " Uite si raspunsul adormitzilor : [tgcolmisc2]$tgcurrentanswer[tgcolmiss]."<br>}<br>if {$tgmaxmissed&gt;0&amp;&amp;$tgmissed&gt;=$tgmaxmissed} {<br>append _msg " Este intrebarea cu nr $tgmissed care a fost neraspunsa! Jocul este inchis automat.Pentru a porni scrieti $tgcmdstart"<br>tgquietstop<br>} else {<br>append _msg " [lindex $tgtrythenextone [rand [llength $tgtrythenextone]]]"<br>}<br>tggamemsg "[tgcolmiss]$_msg"<br>if {$tgstreakmin&gt;0&amp;&amp;[lindex [split $tgstreak ,] 1]&gt;=$tgstreakmin} { tgstreakend }<br>set tgstreak 0<br>catch {unbind pubm -|- "$tgchan *" tgcheckanswer}<br>if {$tgmaxmissed==0||$tgmissed&lt;$tgmaxmissed} {<br>set tgnextqtimer [utimer $tgtimenext tgnextq]<br>}<br>return<br>} elseif {$tghintnum == 0} {<br>set i 0<br>set _hint {}<br>set tghintcharsused {}<br>foreach word [split $tgcurrentanswer] {<br>regsub -all -- "\[A-Za-z0-9\]" $word $tghintchar _current<br>lappend _hint $_current<br>}<br>if {$tgtimeanswer==1} {<br>set tgtimestart [clock clicks -milliseconds]<br>}<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>if {$tgcapshint==1} {<br>set _hint [strupr $_hint]<br>}<br>tggamemsg "[tgcolqhead] Intrebarea [expr $tgquestionnumber+1]/$tgquestionstotal [expr $tghintnum?"(Hint $tghintnum/$tgmaxhintcurrent)":""] "<br>if {$tgalwaysshowq==1||$tghintnum==0} {<br>tggamemsg "[tgcolqbody]$tgcurrentquestion"<br>}<br>tggamemsg "[tgcolhint]Indiciu: [join $_hint]"<br>set tghinttimer [utimer $tgtimehint tghint]<br>}<br><br>#triggered when someone uses !top10 command<br>proc tgshowtop10 {nick host hand chan text} {<br>global tgscores tgchan tgscorestotal<br>if {[strlwr $chan]==[strlwr $tgchan]} {<br>tggetscores<br>if {$tgscorestotal&gt;0} {<br>if {$tgscorestotal&gt;9} {<br>set _max 9<br>} else {<br>set _max [expr $tgscorestotal-1]<br>}<br>set i 0<br>while {$i&lt;=$_max} {<br>set _item [lindex $tgscores $i]<br>set _nick [join [lindex [split $_item ,] 2]]<br>set _score [join [lindex [split $_item ,] 0]]<br>if {$i==0} {<br>append _scores "[tgcolscr1]$_nick $_score"<br>} elseif {$i==1} {<br>append _scores ", [tgcolscr2]$_nick $_score"<br>} elseif {$i==2} {<br>append _scores ", [tgcolscr3]$_nick $_score"<br>} else {<br>append _scores ", [tgcolmisc1]$_nick $_score"<br>}<br>incr i<br>}<br>tggamemsg "[tgcolmisc1]Primi 10 dexteri : $_scores"<br>} else {<br>tggamemsg "[tgcolmisc1]Score Lista cu scoruri e goala."<br>}<br>}<br>}<br><br>#checks if anyone has said the correct answer on channel.<br>proc tgcheckanswer {nick host hand chan text} {<br>global tgcurrentanswer<br>if {[strlwr $tgcurrentanswer] == [tgstripcodes [strlwr [string trim $text]]]} {<br>tgcorrectanswer $nick<br>}<br>}<br><br>#triggered when someone says the correct answer.<br>proc tgcorrectanswer {nick} {<br>global tgcurrentanswer tghinttimer tgtimenext tgchan tgnextqtimer tgstreak tgstreakmin<br>global tgscoresbyname tgranksbyname tgranksbynum tgcongrats tgscorestotal tgmissed<br>global tgtimestart tgshowallscores tgrealnames tgscoresbyrank tgtimeanswer<br>tggetscores<br>if {![info exists tgranksbyname([strlwr $nick])]} {<br>set _oldrank 0<br>} else {<br>set _oldrank $tgranksbyname([strlwr $nick])<br>}<br>tgincrscore $nick<br>tggetscores<br>set _newrank $tgranksbyname([strlwr $nick])<br>set _timetoanswer ""<br>if {$tgtimeanswer==1} {<br>set _timetoanswer [expr [expr [clock clicks -milliseconds]-$tgtimestart]/1000.00]<br>}<br>set _msg "[tgcolmisc1][lindex $tgcongrats [rand [llength $tgcongrats]]] [tgcolmisc2]$nick[tgcolmisc1]! Raspunsul era [tgcolmisc2]$tgcurrentanswer[tgcolmisc1].[expr $tgtimeanswer==1?" Ai nimerit-o in [tgcolmisc2]$_timetoanswer[tgcolmisc1] secunde.":""]"<br>if {$_newrank&lt;$_oldrank} {<br>if {$_newrank==1} {<br>append _msg " Acum esti pe locul intâi!"<br>} else {<br>if {$tgshowallscores==0} {<br>append _msg " Ai urcat o pozitie in top , dar mai ai pana la primul loc!"<br>} else {<br>append _msg " Acum esti pe locul [tgcolmisc2][ordnumber $tgranksbyname([strlwr $nick])][tgcolmisc1] din [tgcolmisc2]$tgscorestotal[tgcolmisc1], in urma lui [tgcolmisc2]$tgrealnames($tgranksbynum([expr $_newrank-1]))[tgcolmisc1] cu [tgcolmisc2]$tgscoresbyrank([expr $_newrank-1])[tgcolmisc1] ."<br>}<br>}<br>}<br>tggamemsg "$_msg"<br>if {$tgstreak!=0} {<br>if {[lindex [split $tgstreak ,] 0]==[strlwr $nick]} {<br>set tgstreak [strlwr $nick],[expr [lindex [split $tgstreak ,] 1]+1]<br>if {$tgstreakmin&gt;0&amp;&amp;[lindex [split $tgstreak ,] 1]&gt;=$tgstreakmin} {<br>tggamemsg "[tgcolstrk][tgcolmisc2]$nick[tgcolstrk] e multiplu castigator! [tgcolmisc2][lindex [split $tgstreak ,] 1] [tgcolstrk] raspunsuri la rand ! Bravo creiere ;)"<br>}<br>} else {<br>if {$tgstreakmin&gt;0&amp;&amp;[lindex [split $tgstreak ,] 1]&gt;=$tgstreakmin} { tgstreakend }<br>set tgstreak [strlwr $nick],1<br>}<br>} else {<br>set tgstreak [strlwr $nick],1<br>}<br>set tgmissed 0<br>tgshowscores $nick<br>catch {unbind pubm -|- "$tgchan *" tgcheckanswer}<br>killutimer $tghinttimer<br>set tgnextqtimer [utimer $tgtimenext tgnextq]<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>global tgrealnames tgscoresbyrank<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 tgrealnames]} {unset tgrealnames}<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 _lwrnick [lindex [split $_item ,] 3]<br>set _score [lindex [split $_item ,] 0]<br>set tgscoresbyname($_lwrnick) $_score<br>set tgrealnames($_lwrnick) $_nick<br>set tgranksbyname($_lwrnick) [expr $i+1]<br>set tgranksbynum([expr $i+1]) $_lwrnick<br>set tgscoresbyrank([expr $i+1]) $_score<br>incr i<br>}<br>return<br>}<br><br>#increment someone's score.<br>proc tgincrscore {who} {<br>global tgscores tgscf tgpointsperanswer tgscorestotal tgscoresbyname<br>tggetscores<br>if {$tgscorestotal&gt;0} {<br>set i 0<br>if {![info exists tgscoresbyname([strlwr $who])]} {<br>append _newscores "1,[expr 1000000000000.0/[unixtime]],$who,[strlwr $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,[strlwr $who][expr [expr [llength $tgscores]-$i]==1?"":"\ "]"<br>} else {<br>append _newscores "$_score,$_time,$_nick,[strlwr $_nick][expr [expr [llength $tgscores]-$i]==1?"":"\ "]"<br>}<br>incr i<br>}<br>} else {<br>append _newscores "1,[expr 1000000000000.0/[unixtime]],$who,[strlwr $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 {nick} {<br>global tgscores tgchan tgscorestotal tgshowallscores tgranksbyname tgranksbynum<br>global tgscoresbyname tgrealnames tgscoresbyrank<br>tggetscores<br>set i 0<br>if {$tgshowallscores} {<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 "[tgcolscr1]$_nick $_score"<br>} elseif {$i==1} {<br>append _scores ", [tgcolscr2]$_nick $_score"<br>} elseif {$i==2} {<br>append _scores ", [tgcolscr3]$_nick $_score"<br>} elseif {[onchan $_nick $tgchan]} {<br>append _scores ", [tgcolmisc1]$_nick $_score"<br>}<br>incr i<br>}<br>tggamemsg "[tgcolmisc1]The scores: $_scores"<br>} else {<br>if {$tgranksbyname([strlwr $nick])==1} {<br>set _tgt "."<br>} else {<br>set _tgt ", si se afla in urma lu` [tgcolmisc2]$tgrealnames($tgranksbynum([expr $tgranksbyname([strlwr $nick])-1]))[tgcolmisc1] care are [tgcolmisc2]$tgscoresbyrank([expr $tgranksbyname([strlwr $nick])-1])[tgcolmisc1] ."<br>}<br>tggamemsg "[tgcolmisc2]$nick [tgcolmisc1]acum are [tgcolmisc2]$tgscoresbyname([strlwr $nick]) [tgcolmisc1][expr $tgscoresbyname([strlwr $nick])==1?"punct":"puncte"] si e pe locul [tgcolmisc2][ordnumber $tgranksbyname([strlwr $nick])] [tgcolmisc1]din [tgcolmisc2]$tgscorestotal[tgcolmisc1]$_tgt"<br>}<br>}<br><br>#reset current scores.<br>proc tgresetscores {nick host hand text} {<br>exec rm -rf scripts/trivia.score<br>exec touch scripts/trivia.score<br>}<br><br>#triggered when a winning streak ends.<br>proc tgstreakend {} {<br>global tgstreak tgrealnames<br>tggamemsg "[tgcolstend]Cam atat pentru [tgcolmisc2]$tgrealnames([lindex [split $tgstreak ,] 0]) [tgcolstend] castigator a multe intrebari la rand."<br>return<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 tgrealnames<br>if {$text==""} { set text $nick } else { set text [lindex [split $text] 0] }<br>tggetscores<br>if {![info exists tgscoresbyname([strlwr $text])]} {<br>if {[strlwr $text]==[strlwr $nick]} {<br>set _who "[tgcolmisc1]Esti"<br>} else {<br>set _who "[tgcolmisc2]$text [tgcolmisc1]is"<br>}<br>[tgpriv] $nick "[tgbold]$_who [tgcolmisc1] nu este in lista de scoruri."<br>} else {<br>if {[strlwr $text]==[strlwr $nick]} {<br>set _who "[tgcolmisc1]Ai"<br>} else {<br>set _who "[tgcolmisc2]$tgrealnames([strlwr $text]) [tgcolmisc1]are"<br>}<br>[tgpriv] $nick "[tgbold]$_who [tgcolmisc2]$tgscoresbyname([strlwr $text])[tgcolmisc1] puncte, locul [tgcolmisc2][ordnumber $tgranksbyname([strlwr $text])] [tgcolmisc1]din [tgcolmisc2]$tgscorestotal[tgcolmisc1]."<br>}<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 tgrealnames<br>tggetscores<br>if {![info exists tgscoresbyname([strlwr $nick])]} {<br>[tgpriv] $nick "[tgbold][tgcolmisc1]Nu esti in lista de scoruri inca."<br>} elseif {$tgranksbyname([strlwr $nick])==1} {<br>[tgpriv] $nick "[tgbold][tgcolmisc1]Esti cel mai voinic de pe canal , primu`n top!"<br>} else {<br>[tgpriv] $nick "[tgbold][tgcolmisc1]Esti pe locul [tgcolmisc2]$tgscoresbyname([strlwr $nick])[tgcolmisc1]. Tinta ta este [tgcolmisc2]$tgrealnames($tgranksbynum([expr $tgranksbyname([strlwr $nick])-1])) [tgcolmisc1]cu [tgcolmisc2]$tgscoresbyname($tgranksbynum([expr $tgranksbyname([strlwr $nick])-1]))[tgcolmisc1], locul [tgcolmisc2][ordnumber [expr $tgranksbyname([strlwr $nick])-1]] [tgcolmisc1]din [tgcolmisc2]$tgscorestotal[tgcolmisc1]."<br>}<br>}<br><br>#triggered when someone /msgs the bot with the error reporting command.<br>proc tgerror {nick host hand text} {<br>global tgquestionstotal tgquestionslist tgerrmethod tgerrfil tgerremail tgerrmailtmp<br>if {$text==""||![string is int [lindex [split $text] 0]]} {<br>[tgpriv] $nick "[tgbold][tgcolmisc1]Trebuie specificat numarul intrebarii!."<br>return<br>}<br>tgreadqdb<br>set _qnum [lindex [split $text] 0]<br>if {$_qnum&gt;$tgquestionstotal} {<br>[tgpriv] $nick "[tgbold][tgcolmisc1]Intrebare inexistenta."<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 [join [lrange [split $text] 1 end]]<br>if {$_desc==""} { set _desc "Nu exista detalii privind eroarea" }<br>if {$tgerrmethod==1} {<br>set _fname $tgerrmailtmp\trivia[rand 100000].tmp<br>set _file [open $_fname w]<br>} else {<br>set _file [open $tgerrfil a]<br>}<br>puts $_file ""<br>puts $_file "Error report generated [strftime %A,\ %d\ %B\ %Y\ @\ %H:%M:%S]"<br>puts $_file "Reported by:\t$nick!$host"<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>if {$tgerrmethod==1} {<br>exec mail -s "trivia.tcl error report from $nick" $tgerremail &lt; $_fname<br>file delete $_fname<br>[tgpriv] $nick "[tgbold][tgcolmisc1]Mersi! Eroarea raportata de tine este trimisa sefului!"<br>} else {<br>[tgpriv] $nick "[tgbold][tgcolmisc1]Mersi! Ma voi uita cit de repede pot pe eroare!"<br>}<br>}<br><br>#triggered when someone /msgs the bot with the rules command.<br>proc tgrulesmsg {nick host hand text} {<br>global tgrules<br>[tgpriv] $nick "Regulile canalului sunt: $tgrules"<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 tgcmdrules tgflagsstart<br>if {$text==""} {<br>[tgpriv] $nick "Ai acces la urmatoarele comenzi:"<br>[tgpriv] $nick "Sa folosesti, /MSG $botnick &lt;command&gt;"<br>[tgpriv] $nick "  \002[strupr $tgcmdrules]\002"<br>[tgpriv] $nick "   -- Regulile canalului."<br>[tgpriv] $nick "  \002[strupr $tgcmdlookup]\002 \[nick\]"<br>[tgpriv] $nick "   -- Arata locul si scorul \[nick\], daca este specificat,"<br>[tgpriv] $nick "    in caz contrar arata scorul si pozitia ta."<br>[tgpriv] $nick "  \002[strupr $tgcmdtarget]\002"<br>[tgpriv] $nick "   -- Arata scorul si locul"<br>[tgpriv] $nick "    celui din fata ta."<br>[tgpriv] $nick "  \002[strupr $tgcmderror]\002 &lt;number&gt; \[description\]"<br>[tgpriv] $nick "   -- Raporteaza eroare in cazul intrebarii &lt;number&gt;"<br>[tgpriv] $nick "    Descrierea nu este obligatorie, dar ajutatoare"<br>if {[matchattr $hand $tgflagsreset $tgchan]} {<br>[tgpriv] $nick "  \002[strupr $tgcmdreset]\002"<br>[tgpriv] $nick "   -- Reseteaza tabelul de scoruri."<br>}<br>[tgpriv] $nick "Pentru lista comenzilor publice , /MSG $botnick [strupr $tgcmdhelp] PUBCMDS"<br>}<br>if {[strlwr $text]=="pubcmds"} {<br>[tgpriv] $nick "Ai acces la urmatoarele comenzi publice:"<br>if {[matchattr $hand $tgflagsstart $tgchan]} {<br>[tgpriv] $nick "  \002$tgcmdstart\002 -- porneste trivia."<br>}<br>if {[matchattr $hand $tgflagsstop $tgchan]} {<br>[tgpriv] $nick "  \002$tgcmdstop\002 -- opreste trivia."<br>}<br>if {[matchattr $hand $tgflagshint $tgchan]} {<br>[tgpriv] $nick "  \002$tgcmdhint\002 -- Hint."<br>}<br>if {[matchattr $hand $tgflagsskip $tgchan]} {<br>[tgpriv] $nick "  \002$tgcmdskip\002 -- sare peste intrebare."<br>}<br>[tgpriv] $nick "Pentru o lista a comenzilor private, /MSG $botnick [strupr $tgcmdhelp]"<br>}<br>}<br><br># Returns text without colour, bold, etc. control codes.<br># This is a stripped down version of the proc in MC_8's mc.moretools.tcl.<br>proc tgstripcodes {text} {<br>regsub -all -- "\003(\[0-9\]\[0-9\]?(,\[0-9\]\[0-9\]?)?)?" $text "" text<br>set text "[string map -nocase [list \002 "" \017 "" \026 "" \037 ""] $text]"<br>return $text<br>}<br><br>proc tggamemsg {what} {<br>global tgchan<br>putquick "PRIVMSG $tgchan :[tgbold]$what"<br>}<br><br>proc tgbold {} {<br>global tgusebold<br>if {$tgusebold==1} { return "\002" }<br>}<br>proc tgcolstart {} {<br>global tgcolourstart<br>if {$tgcolourstart!=""} { return "\003$tgcolourstart" }<br>}<br>proc tgcolstop {} {<br>global tgcolourstop<br>if {$tgcolourstop!=""} { return "\003$tgcolourstop" }<br>}<br>proc tgcolskip {} {<br>global tgcolourskip<br>if {$tgcolourskip!=""} { return "\003$tgcolourskip" }<br>}<br>proc tgcolerr {} {<br>global tgcolourerr<br>if {$tgcolourerr!=""} { return "\003$tgcolourerr" }<br>}<br>proc tgcolmiss {} {<br>global tgcolourmiss<br>if {$tgcolourmiss!=""} { return "\003$tgcolourmiss" }<br>}<br>proc tgcolqhead {} {<br>global tgcolourqhead<br>if {$tgcolourqhead!=""} { return "\003$tgcolourqhead" }<br>}<br>proc tgcolqbody {} {<br>global tgcolourqbody<br>if {$tgcolourqbody!=""} { return "\003$tgcolourqbody" }<br>}<br>proc tgcolhint {} {<br>global tgcolourhint<br>if {$tgcolourhint!=""} { return "\003$tgcolourhint" }<br>}<br>proc tgcolstrk {} {<br>global tgcolourstrk<br>if {$tgcolourstrk!=""} { return "\003$tgcolourstrk" }<br>}<br>proc tgcolscr1 {} {<br>global tgcolourscr1<br>if {$tgcolourscr1!=""} { return "\003$tgcolourscr1" }<br>}<br>proc tgcolscr2 {} {<br>global tgcolourscr2<br>if {$tgcolourscr2!=""} { return "\003$tgcolourscr2" }<br>}<br>proc tgcolscr3 {} {<br>global tgcolourscr3<br>if {$tgcolourscr3!=""} { return "\003$tgcolourscr3" }<br>}<br>proc tgcolrset {} {<br>global tgcolourrset<br>if {$tgcolourrset!=""} { return "\003$tgcolourrset" }<br>}<br>proc tgcolstend {} {<br>global tgcolourstend<br>if {$tgcolourstend!=""} { return "\003$tgcolourstend" }<br>}<br>proc tgcolmisc1 {} {<br>global tgcolourmisc1<br>if {$tgcolourmisc1!=""} { return "\003$tgcolourmisc1" }<br>}<br>proc tgcolmisc2 {} {<br>global tgcolourmisc2<br>if {$tgcolourmisc2!=""} { return "\003$tgcolourmisc2" }<br>}<br>proc tgpriv {} {<br>global tgpriv2msg<br>if {$tgpriv2msg==1} { return "putmsg" } else { return "putnotc" }<br>}<br><br>#this generates an html file with all the people on the chan with<br>#their score, as well as a list of all scores, sorted by rank<br>proc tghtml {} {<br>global tgchan botnick tghtmlfile tghtmlrefresh server tgscoresbyname tgranksbyname<br>global tgscorestotal tgranksbyname tgrealnames tgscoresbyrank tgranksbynum tgplaying<br>global tgquestionstotal tghtmlrefreshtimer tghtmlfont<br>tggetscores<br>tgreadqdb<br>set _file [open $tghtmlfile~new w]<br>puts $_file "&lt;!DOCTYPE HTML PUBLIC \"-/W3C/DTD HTML 4.01 Transitional/EN\"&gt;"<br>puts $_file "&lt;html&gt;"<br>puts $_file " &lt;head&gt;"<br>puts $_file "  &lt;title&gt;$botnick's trivia channel: $tgchan on [lindex [split $server :] 0]&lt;/title&gt;"<br>puts $_file "  &lt;meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"&gt;"<br>puts $_file "  &lt;meta http-equiv=\"refresh\" content=\"$tghtmlrefresh\"&gt;"<br>puts $_file "  &lt;meta name=\"generator\" content=\"trivia.tcl script for eggdrop. <a href="http://www.eggdrop.za.net/" class="postlink">http://www.eggdrop.za.net/</a>\"&gt;"<br>puts $_file "  &lt;style type=\"text/css\"&gt;"<br>puts $_file "  &lt;!--"<br>puts $_file "  body,td{font-family:$tghtmlfont;font-size:13px;}"<br>puts $_file "  a{text-decoration:none;color:#09f;}"<br>puts $_file "  --&gt;"<br>puts $_file "  &lt;/style&gt;"<br>puts $_file " &lt;/head&gt;"<br>puts $_file " &lt;body&gt;"<br>puts $_file "  &lt;h1&gt;$tgchan on [lindex [split $server :] 0]&lt;/h1&gt;"<br>puts $_file "  &lt;hr size=\"1\" noshade&gt;"<br>if {![onchan $botnick $tgchan]} {<br>puts $_file "  &lt;p&gt;Hmmm... for some reason I'm not on $tgchan at the moment. Please try again later.&lt;/p&gt;"<br>} else {<br>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."<br>puts $_file "  &lt;p&gt;People on $tgchan right now:&lt;br&gt;"<br>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;"<br>puts $_file "   &lt;tr&gt;"<br>puts $_file "    &lt;td&gt;&lt;b&gt;Nick&lt;/b&gt;&lt;/td&gt;"<br>puts $_file "    &lt;td&gt;&lt;b&gt;Score&lt;/b&gt;&lt;/td&gt;"<br>puts $_file "    &lt;td&gt;&lt;b&gt;Rank&lt;/b&gt;&lt;/td&gt;"<br>puts $_file "    &lt;td&gt;&lt;b&gt;Idle&lt;/b&gt;&lt;/td&gt;"<br>puts $_file "   &lt;/tr&gt;"<br>foreach nick [lsort [chanlist $tgchan]] {<br>puts $_file "   &lt;tr&gt;"<br>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;"<br>if {[info exists tgscoresbyname([strlwr $nick])]} {<br>puts $_file "    &lt;td&gt;$tgscoresbyname([strlwr $nick])&lt;/td&gt;"<br>} else {<br>puts $_file "    &lt;td&gt;-&lt;/td&gt;"<br>}<br>if {[info exists tgranksbyname([strlwr $nick])]} {<br>puts $_file "    &lt;td&gt;$tgranksbyname([strlwr $nick])&lt;/td&gt;"<br>} else {<br>puts $_file "    &lt;td&gt;-&lt;/td&gt;"<br>}<br>puts $_file "   &lt;td&gt;[expr [getchanidle $nick $tgchan]&gt;10?"[getchanidle $nick $tgchan]m":"-"]&lt;/td&gt;"<br>puts $_file "   &lt;/tr&gt;"<br>}<br>puts $_file "  &lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;"<br>}<br>if {$tgscorestotal&gt;0} {<br>puts $_file "  &lt;p&gt;&lt;small&gt;There [expr $tgscorestotal==1?"is":"are"] currently &lt;b&gt;$tgscorestotal&lt;/b&gt; [expr $tgscorestotal==1?"nick":"nicks"] in the score table:&lt;br&gt;"<br>set _rank 1<br>while {$_rank&lt;=$tgscorestotal} {<br>puts $_file "  &lt;b&gt;$_rank&lt;/b&gt;. $tgrealnames($tgranksbynum($_rank)) $tgscoresbyrank($_rank)&lt;br&gt;"<br>incr _rank<br>}<br>} else {<br>puts $_file "  &lt;p&gt;&lt;small&gt;There are currently no nicks in the score table.&lt;br&gt;"<br>}<br>puts $_file "  &lt;/small&gt;&lt;/p&gt;"<br>puts $_file "  &lt;hr size=\"1\" noshade&gt;"<br>puts $_file "  &lt;small&gt;Generated on [strftime %A,\ %d\ %B\ %Y\ @\ %H:%M:%S] by &lt;a href=\"<a href="http://www.eggdrop.za.net/%5C%22%3Etrivia.tcl%3C/a" class="postlink">http://www.eggdrop.za.net/\"&gt;trivia.tcl&lt;/a</a>&gt; for &lt;a href=\"http://www.eggheads.org\"&gt;eggdrop&lt;/a&gt;.&lt;br&gt;"<br>puts $_file "  This page is automatically updated (and refreshed if supported by your browser) every [expr $tghtmlrefresh==1?"secunda":"$tghtmlrefresh secunde"].&lt;/small&gt;"<br>puts $_file " &lt;/body&gt;"<br>puts $_file "&lt;/html&gt;"<br>close $_file<br>file rename -force $tghtmlfile~new $tghtmlfile<br>set tghtmlrefreshtimer [utimer $tghtmlrefresh tghtml]<br>}<br><br>putlog "======================================================="<br>putlog "* trivia.tcl $tgver ($tgrel) loaded."<br>tgreadqdb<br>putlog "* $tgquestionstotal questions in $tgqdb ([file size $tgqdb] bytes)"<br>putlog "======================================================="<br>[/code]<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11867">rdstm</a> — Mon Jan 02, 2012 11:01 am</p><hr />
]]></content>
	</entry>
	</feed>
