set tkqdb "eggdrop/scripts/quess.txt"
set tkqdbsep "|"

#  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<seperator>answer
#  If set to 0, bot expects lines in the format:
#    answer<seperator>question
set tkqdbquestionfirst 1
set tkerrmethod 0
set tkerremail "krishna.82@hotmail.com"
set tkerrmailtmp "/tmp"
set tkhtmlrefresh 0
set tkhtmlfont "verdana,helvetica,arial"
set tkchan "#Lombok"
set tkpointsperanswer 40
set tkmaxhint 3

#  Should the bot show the question on each hint (1) or only on the first (0)?
set tkalwaysshowq 0
set tkcapsquestion 0
set tkcapsanswer 0
set tkcapshint 0
set tkstreakmin 0
set tkmaxmissed 2
set tkhintchar "?"
set tktimehint 20
set tktimenext 5
set tkcongrats [list "Nice" "Well done" "Nice going" "VeryWeLL" "Good" "Excelent" "Bravo" "Yes"]
set tknobodygotit [list "Time is Up." "No Body Answer" "Try harder!" "Ohh No" "NoBody?"]
set tktrythenextone [list "Next.." "Get ready..." "Move on..." "Try next one..." "Next one..."]
set tktimeanswer 1
set tkshowanswer 1
set tkshowallscores 0
set tkusebold 0
set tkpriv2msg 0
set tkcmdstart "!game4"
set tkflagsstart "-|-"
set tkcmdnostop "!nostop"
set tkflagsnostop "m|m"
set tkcmdhint "!hint"
set tkflagshint "m|m"
set tktempnohint 10
set tkcmdskip "!skip"
set tkflagsskip "m|m"
set tkcmdtop10 "!top10tk"
set tkflagnostop10 "m|m"
set tkcmdreset "reset"
set tkflagsreset "m|m"
set tkresetreqpw 1

set tkcolourstart "03"          ;#Game has started.
set tkcolournostop "04"         ;#Game has nostopped.
set tkcolourskip "10"           ;#Question has been skipped.
set tkcolourerr "04"            ;#How to report errors.
set tkcolourmiss "10"           ;#Nobody answered the question.
set tkcolourqhead "04"          ;#Question heading.
set tkcolourqbody "12"          ;#Question text
set tkcolourhint "03"           ;#Hint.
set tkcolourstrk "12"           ;#Person is on a winning streak.
set tkcolourscr1 "04"           ;#Score of person in first place.
set tkcolourscr2 "12"           ;#Score of person in second place.
set tkcolourscr3 "03"           ;#Score of person in third place.
set tkcolourrset "04"           ;#Scores have been reset.
set tkcolourstend "12"          ;#Winning streak ended.
set tkcolourmisc1 "06"          ;#Miscellaneous colour #1.
set tkcolourmisc2 "04"          ;#Miscellaneous colour #2.


# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#                                                                   #
#    Any editing done beyond this point is done at your own risk!   #
#                                                                   #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#Misc checks & var initialisations
set tkver "1.3.4"
set tkrel "release"
if {[info tclversion]<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 {$tktimeanswer==1&&[info tclversion]<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 tktimeanswer 0
}
if {![info exists alltools_loaded]||$allt_version<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 tkhtml]!=""} {killutimer $tkhtmlrefreshtimer}
if {$tkhtmlrefresh>0} {
        set tkhtmlrefreshtimer [utimer $tkhtmlrefresh tkhtml]
}
if {![file exists $tkqdb]} {
        putlog "\002[file tail [info script]]\002 failed to load: $tkqdb does not exist."
        return
}
if {[llength [split $tkchan]]!=1} {
        putlog "\002[file tail [info script]]\002 failed to load: too many channels specified."
        return
}
if {![info exists tkplaying]} {
        set ctcp-version "${ctcp-version} (with Teka-Teki.tcl)"
        set tkplaying 0
}
if {![info exists tkhintnum]} {set tkhintnum 0}
if {![info exists tkmissed]} {set tkmissed 0}

#Binds
bind pubm $tkflagsstart "$tkchan %$tkcmdstart" tkstart
bind pubm $tkflagsnostop "$tkchan %$tkcmdnostop" tknostop
proc tkbindhintcmd {} {
        global tkflagshint tkcmdhint
        bind pubm $tkflagshint "$::tkchan %$tkcmdhint" tkforcehint
}
proc tkunbindhintcmd {} {
        global tkflagshint tkcmdhint
        unbind pubm $tkflagshint "$::tkchan %$tkcmdhint" tkforcehint
}
tkbindhintcmd
bind pubm $tkflagsskip "$tkchan %$tkcmdskip" tkskip
bind pubm $tkflagnostop10 "$tkchan %$tkcmdtop10" tkshowtop10
bind msg $tkflagsreset "$tkcmdreset" tkresetscores
bind kick - "$tkchan $botnick" tkbotgotkicked
bind evnt - disconnect-server tkbotgotdisconnected



#starts the game if it isn't running.
proc tkstart {nick host hand chan text} {
        global tkplaying tkstreak tkchan  tkmissed
#tkerrremindtime tkerrremindtimer
        if {[strlwr $tkchan]==[strlwr $chan]} {
                if {$tkplaying==0} {
#                       tkgamemsg "[tkcolstart]Teka-Teki game started by $nick!"
                        tknextq
                        set tkplaying 1
                        set tkstreak 0
                        set tkmissed 0
#                       set tkerrremindtimer [timer $tkerrremindtime tkerrremind]
                }
        }
}

#nostops the game if it's running.
proc tknostop {nick host hand chan text} {
        global tkhinttimer tknextqtimer tkplaying tkchan tkcurrentanswer tkstreak tkstreakmin
#       global tkerrremindtimer tkrebindhinttimer
        if {[strlwr $tkchan]==[strlwr $chan]} {
                if {$tkplaying==1} {
#                       tkgamemsg ""
                        if {$tkstreakmin>0&&[lindex [split $tkstreak ,] 1]>=$tkstreakmin} { tkstreakend }
                        set tkstreak 0
                        set tkplaying 0
                        catch {unbind pubm -|- "$tkchan *" tkcheckanswer}
                        if {[utimerexists tkhint]!=""} {killutimer $tkhinttimer}
                        if {[utimerexists tknextq]!=""} {killutimer $tknextqtimer}
#                       if {[timerexists tkerrremind]!=""} {killtimer $tkerrremindtimer}
                        if {[utimerexists tkrebindhinttimer]!=""} {killtimer $tkrebindhinttimer}
                }
        }
}

#gives a hint if there is currently a question to answer.
proc tkforcehint {nick host hand chan text} {
        global tkhinttimer tknextqtimer tkplaying tkchan tkcurrentanswer tkstreak tkstreakmin
        global tktempnohint tkmaxhintcurrent tkhintnum tkrebindhinttimer tktempnohint
        if {[strlwr $tkchan]==[strlwr $chan]} {
                if {$tkplaying==1&&[utimerexists tkhint]!=""} {
                        killutimer $tkhinttimer
                        tkhint
                        tkunbindhintcmd
                        if {$tkhintnum<$tkmaxhintcurrent} {
                                set tkrebindhinttimer [utimer $tktempnohint tkbindhintcmd]
                        }
                }
        }
}

#skips the current question if one has been asked.
proc tkskip {nick host hand chan text} {
        global tkhinttimer tknextqtimer tkplaying tkchan tkcurrentanswer tkstreak
        global tkstreakmin tktimenext tkrebindhinttimer
        #global tccurrentanswer tchinttimer tctimenext tcchan tcnextqtimer tcstreak tcstreakmin
        #global tcscoresbyname tcranksbyname tcranksbynum tccongrats tcscorestotal tcmissed
        #global tctimestart tcshowallscores tcrealnames tcscoresbyrank
        global LETTERChannel LETTERRunning LETTERQCount LETTERQNumber LETTERQuestionFile LETTERAdNumber LETTERVersion KDebug CountAnswer CountNoAnswer

        if {[strlwr $tkchan]==[strlwr $chan]} {
                if {$tkplaying==1&&[utimerexists tkhint]!=""} {
                        tkgamemsg "\0030,1 :: Skipping to next question by $nick's request :: "
                        if {$tkstreakmin>0&&[lindex [split $tkstreak ,] 1]>=$tkstreakmin&&[strlwr [lindex [split $tkstreak ,] 0]]==[strlwr $nick]} {
                                tkstreakend
                                set tkstreak 0
                        }
                        catch {unbind pubm -|- "$tkchan *" tkcheckanswer}
                        killutimer $tkhinttimer
                        if {[utimerexists tkrebindhinttimer]!=""} {killtimer $tkrebindhinttimer}
#                       set tknextqtimer [utimer $tktimenext tknextq]

set LETTERQCount 0
set LETTERAdNumber 0
LETTER_ReadCFG
set LETTERQCount [LETTER_ReadQuestionFile]
set LETTERAskedFileLen [LETTER_ReadAskedFile]
LETTER_ResetAsked
set LETTERRunning 1
bind pubm - "*" LETTERCheckGuess
LETTERAskQuestion

                }
        }
}


#bot got kicked. nostop the game.
proc tkbotgotkicked {nick host hand chan targ text} {
        tkquietnostop
}

#bot got disconnected. nostop the game.
proc tkbotgotdisconnected {disconnect-server} {
        tkquietnostop
}

#nostops the game without telling the channel.
proc tkquietnostop {} {
        global tkplaying tkstreak tkchan tkcurrentanswer tkhinttimer tknextqtimer
#tkerrremindtimer
        global tkrebindhinttimer
        if {$tkplaying==1} {
                set tkstreak 0
                set tkplaying 0
                catch {unbind pubm -|- "$tkchan *" tkcheckanswer}
                if {[utimerexists tkhint]!=""} {killutimer $tkhinttimer}
                if {[utimerexists tknextq]!=""} {killutimer $tknextqtimer}
#               if {[timerexists tkerrremind]!=""} {killtimer $tkerrremindtimer}
                if {[utimerexists tkrebindhinttimer]!=""} {killtimer $tkrebindhinttimer}
        }
}

#reads the question database.
proc tkreadqdb {} {
        global tkqdb tkquestionstotal tkquestionslist
        set tkquestionstotal 0
        set tkquestionslist ""
        set qfile [open $tkqdb r]
        set tkquestionslist [split [read -nonewline $qfile] "\n"]
        set tkquestionstotal [llength $tkquestionslist]
        close $qfile
}

#selects the next question.
proc tknextq {} {
        global tkqdb tkcurrentquestion tkcurrentanswer tkquestionnumber
        global tkquestionstotal tkhintnum tkchan tkquestionslist tkqdbsep tkqdbquestionfirst
        global tkcapsquestion tkcapsanswer
        tkreadqdb
        set tkcurrentquestion ""
        set tkcurrentanswer ""
        while {$tkcurrentquestion == ""} {
                set tkquestionnumber [rand [llength $tkquestionslist]]
                set tkquestionselected [lindex $tkquestionslist $tkquestionnumber]
                set tkcurrentquestion [lindex [split $tkquestionselected $tkqdbsep] [expr $tkqdbquestionfirst^1]]
                if {$tkcapsquestion==1} {
                        set tkcurrentquestion [strupr $tkcurrentquestion]
                }
                set tkcurrentanswer [string trim [lindex [split $tkquestionselected $tkqdbsep] $tkqdbquestionfirst]]
                if {$tkcapsanswer==1} {
                        set tkcurrentanswer [strupr $tkcurrentanswer]
                }
        }
        unset tkhintnum
        tkhint
        bind pubm -|- "$tkchan *" tkcheckanswer
        return
}

#shows timed hints.
proc tkhint {} {
        global tkmaxhint tkhintnum tkcurrentanswer tkhinttimer tkchan
        global tktimehint tkhintchar tkquestionnumber tkquestionstotal
        global tkcurrentquestion tkhintcharsused tknextqtimer tktimenext tkstreak tkstreakmin
        global tknobodygotit tktrythenextone tkmissed tkmaxmissed tkcmdstart tkshowanswer
        global tktimestart tktimeanswer tkalwaysshowq tkmaxhintcurrent tktempnohint tkcapshint
        global LETTERChannel LETTERRunning LETTERQCount LETTERQNumber LETTERQuestionFile LETTERAdNumber LETTERVersion KDebug CountAnswer CountNoAnswer
        #global tccurrentanswer tchinttimer tctimenext tcchan tcnextqtimer tcstreak tcstreakmin
        #global tcscoresbyname tcranksbyname tcranksbynum tccongrats tcscorestotal tcmissed
        #global tctimestart tcshowallscores tcrealnames tcscoresbyrank tctimeanswer

                if {[catch {incr tkhintnum}]!=0} {
                set tkhintnum 0
                regsub -all -- "\[^A-Za-z0-9\]" $tkcurrentanswer "" _hintchars
                set tkmaxhintcurrent [expr [strlen $_hintchars]<=$tkmaxhint?[expr [strlen $_hintchars]-1]:$tkmaxhint]
                catch {tkunbindhintcmd}
                if {$tkmaxhintcurrent>0} {
                        set tkrebindhinttimer [utimer $tktempnohint tkbindhintcmd]
                }
        }
        if {$tkhintnum >= [expr $tkmaxhintcurrent+1]} {
                incr tkmissed
                set _msg ""
                append _msg "\0032Nobody Got it Right... "
                if {$tkshowanswer==1} {
                        append _msg "Answer Was \0036$tkcurrentanswer"
                }
                if {$tkmaxmissed>0&&$tkmissed>=$tkmaxmissed} {
                        append _msg " That's $tkmissed questions gone by unanswered! The game is now automatically disabled. To start the game again, type !start"
                        tkquietnostop
                } else {
                        append _msg ""
                }
                tkgamemsg "[tkcolmiss]$_msg"
                if {$tkstreakmin>0&&[lindex [split $tkstreak ,] 1]>=$tkstreakmin} { tkstreakend }
                set tkstreak 0
                catch {unbind pubm -|- "$tkchan *" tkcheckanswer}
                if {$tkmaxmissed==0||$tkmissed<$tkmaxmissed} {

                #set tcnextqtimer [utimer $tctimenext tcnextq]
                        #set tcplaying 1
                        #set tcstreak 0
                        #set tcmissed 0

set LETTERQCount 0
set LETTERAdNumber 0
LETTER_ReadCFG
set LETTERQCount [LETTER_ReadQuestionFile]
set LETTERAskedFileLen [LETTER_ReadAskedFile]
LETTER_ResetAsked
set LETTERRunning 1
bind pubm - "*" LETTERCheckGuess
LETTERAskQuestion
                }
                return
        } elseif {$tkhintnum == 0} {
                set i 0
                set _hint {}
                set tkhintcharsused {}
                foreach word [split $tkcurrentanswer] {
                        regsub -all -- "\[A-Za-z0-9\]" $word $tkhintchar _current
                        lappend _hint $_current
                }
                if {$tktimeanswer==1} {
                        set tktimestart [clock clicks -milliseconds]
                }
        } elseif {$tkhintnum == 1} {
                set i 0
                set _hint {}
                while {$i<[llength [split $tkcurrentanswer]]} {
                        set _word [lindex [split $tkcurrentanswer] $i]
                        set j 0
                        set _newword {}
                        while {$j<[strlen $_word]} {
                                if {$j==0} {
                                        append _newword [stridx $_word $j]
                                        lappend tkhintcharsused $i,$j
                                } else {
                                        if {[string is alnum [stridx $_word $j]]} {
                                                append _newword $tkhintchar
                                        } else {
                                                append _newword [stridx $_word $j]
                                                lappend tkhintcharsused $i,$j
                                        }
                                }
                                incr j
                        }
                        lappend _hint $_newword
                        incr i
                }
                } else {
                        set i 0
                        set _hint {}
                        while {$i<[llength [split $tkcurrentanswer]]} {
                                set _word [lindex [split $tkcurrentanswer] $i]
                                set j 0
                                set _newword {}
                                set _selected [rand [strlen $_word]]
                                regsub -all -- "\[^A-Za-z0-9\]" $_word "" _wordalnum
                                if {[strlen $_wordalnum]>=$tkhintnum} {
                                        while {[lsearch $tkhintcharsused $i,$_selected]!=-1||[string is alnum [stridx $_word $_selected]]==0} {
                                         set _selected [rand [strlen $_word]]
                                        }
                                }
                                lappend tkhintcharsused $i,$_selected
                                while {$j<[strlen $_word]} {
                                        if {[lsearch $tkhintcharsused $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 $tkhintchar
                                                }
                                }
                                incr j
                        }
                        lappend _hint $_newword
                        incr i
                }
        }
        if {$tkcapshint==1} {
                set _hint [strupr $_hint]
        }
        if {$tkalwaysshowq==1||$tkhintnum==0} {
        tkgamemsg "\0030,2 :: Question no $tkquestionnumber\/$tkquestionstotal \0038\[\00311 ®Teka-Teki®\0038 \] \0030tpi@DALnet :: \003"
        tkgamemsg "\0032\037\002Question\002\037: $tkcurrentquestion\003"
        tkgamemsg "\0032\037\002Hint\002\037: $_hint"
        tkgamemsg "\0030,2 :: \00311+40 \0030Points Bila Anda Menjawab Dengan Benar :: \037-= GudLuck =-\037 :: \003"
        }
        tkgamemsg "\0032\037\002Hint\002\037: [join $_hint]\003"
        #tkgamemsg "[tkinfoadv]"
        set tkhinttimer [utimer $tktimehint tkhint]
}

#checks if anyone has said the correct answer on channel.
proc tkcheckanswer {nick host hand chan text} {
        global tkcurrentanswer
        if {[strlwr $tkcurrentanswer] == [tkstripcodes [strlwr [string trim $text]]]} {
                tkcorrectanswer $nick
        }
}

#triggered when someone says the correct answer.
proc tkcorrectanswer {nick} {
        global tkcurrentanswer tkhinttimer tktimenext tkchan tknextqtimer tkstreak tkstreakmin
        global tkcongrats tkmissed
        global tktimestart tkrealnames tktimeanswer tkpointsperanswer
        global LETTERChannel LETTERRunning LETTERQCount LETTERQNumber LETTERQuestionFile LETTERAdNumber LETTERVersion KDebug CountAnswer CountNoAnswer
        #global tccurrentanswer tchinttimer tctimenext tcchan tcnextqtimer tcstreak tcstreakmin
        #global tcscoresbyname tcranksbyname tcranksbynum tccongrats tcscorestotal tcmissed
        #global tcimestart tcshowallscores tcrealnames tcscoresbyrank tctimeanswer

        global lastwinner lastwinnercount botnick userlist quizconf rankfile timerankreset



    variable bestscore 0 lastbestscore 0 lastbest ""
    variable userarray
    variable waitforrank 0 gameend 0

    mx_getcreate_userentry $nick $nick
    array set userarray $userlist($nick)
#    set hostmask $userarray(mask)

            set lastbest [lindex [lsort -command mx_sortrank [array names userlist]] 0]
            if {$lastbest == ""} {
                set lastbestscore 0
            } else {
                array set aa $userlist($lastbest)
                set lastbestscore $aa(score)
            }
            incr userarray(score) $tkpointsperanswer
            if {$userarray(score) == 1} {
                set userarray(started) [unixtime]
            }
            set userlist($nick) [array get userarray]

        set _timetoanswer ""
        if {$tktimeanswer==1} {
                set _timetoanswer [expr [expr [clock clicks -milliseconds]-$tktimestart]/1000.00]
        }
        set _msg "\0032Jawaban Benar: \0036 $tkcurrentanswer \0032Oleh \0036 $nick \0032setelah \0036 $_timetoanswer \0032Detik - Score: \0036+40 \0032Points. Total Score:\0036 $userarray(score) \0032Points - Rank:\0036 [mx_get_rank_pos $nick]"
        tkgamemsg "$_msg"
#       pushmode $tkchan +v $nick
        if {$tkstreak!=0} {
                if {[lindex [split $tkstreak ,] 0]==[strlwr $nick]} {
                        set tkstreak [strlwr $nick],[expr [lindex [split $tkstreak ,] 1]+1]
                        if {$tkstreakmin>0&&[lindex [split $tkstreak ,] 1]>=$tkstreakmin} {
                                tkgamemsg "[tkcolstrk][tkcolmisc2]$nick[tkcolstrk] is on a winning streak! [tkcolmisc2][lindex [split $tkstreak ,] 1] [tkcolstrk]in a row so far!"
                        }
                } else {
                        if {$tkstreakmin>0&&[lindex [split $tkstreak ,] 1]>=$tkstreakmin} { tkstreakend }
                        set tkstreak [strlwr $nick],1
                }
        } else {
                set tkstreak [strlwr $nick],1
        }
        set tkmissed 0
        catch {unbind pubm -|- "$tkchan *" tkcheckanswer}
        killutimer $tkhinttimer
        tmcquiz_rank_save {} {} {}

        #set tcnextqtimer [utimer $tctimenext tcnextq]
                        #set tcplaying 1
                        #set tcstreak 0
                        #set tcmissed 0
set LETTERQCount 0
set LETTERAdNumber 0
LETTER_ReadCFG
set LETTERQCount [LETTER_ReadQuestionFile]
set LETTERAskedFileLen [LETTER_ReadAskedFile]
LETTER_ResetAsked
set LETTERRunning 1
bind pubm - "*" LETTERCheckGuess
LETTERAskQuestion

}


#triggered when someone joins Teka-Teki chan.
proc tkjoinmsg {nick host hand chan} {
        global botnick tkplaying tkcmdstart tkflagsstart tkcmdnostop tkflagsnostop tkchan
        if {$nick != $botnick} {
                set _msg ""
                append _msg "Welcome to $botnick's Teka-Teki channel. Teka-Teki game is currently"
                if {$tkplaying==1} {
                        append _msg " \002on\002."
                } else {
                        append _msg " \002off\002."
                }
                if {[matchattr $hand $tkflagsstart $tkchan]&&$tkplaying==0} {
                        append _msg " To start the game, type \002$tkcmdstart\002 on $tkchan."
                }
                append _msg " Please type \002/MSG $botnick if you need help. Enjoy your stay! :-)"
#               [tkpriv] $nick "$_msg"
        }
}

# 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 tkstripcodes {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 tkgamemsg {what} {
        global tkchan
        putquick "PRIVMSG $tkchan :[tkbold]$what"
}

proc tkbold {} {
        global tkusebold
        if {$tkusebold==1} { return "\002" }
}
proc tkcolstart {} {
        global tkcolourstart
        if {$tkcolourstart!=""} { return "\003$tkcolourstart" }
}
proc tkcolnostop {} {
        global tkcolournostop
        if {$tkcolournostop!=""} { return "\003$tkcolournostop" }
}
proc tkcolskip {} {
        global tkcolourskip
        if {$tkcolourskip!=""} { return "\003$tkcolourskip" }
}
proc tkcolerr {} {
        global tkcolourerr
        if {$tkcolourerr!=""} { return "\003$tkcolourerr" }
}
proc tkcolmiss {} {
        global tkcolourmiss
        if {$tkcolourmiss!=""} { return "\003$tkcolourmiss" }
}
proc tkcolqhead {} {
        global tkcolourqhead
        if {$tkcolourqhead!=""} { return "\003$tkcolourqhead" }
}
proc tkcolqbody {} {
        global tkcolourqbody
        if {$tkcolourqbody!=""} { return "\003$tkcolourqbody" }
}
proc tkcolhint {} {
        global tkcolourhint
        if {$tkcolourhint!=""} { return "\003$tkcolourhint" }
}
proc tkcolstrk {} {
        global tkcolourstrk
        if {$tkcolourstrk!=""} { return "\003$tkcolourstrk" }
}
proc tkcolscr1 {} {
        global tkcolourscr1
        if {$tkcolourscr1!=""} { return "\003$tkcolourscr1" }
}
proc tkcolscr2 {} {
        global tkcolourscr2
        if {$tkcolourscr2!=""} { return "\003$tkcolourscr2" }
}
proc tkcolscr3 {} {
        global tkcolourscr3
        if {$tkcolourscr3!=""} { return "\003$tkcolourscr3" }
}
proc tkcolrset {} {
        global tkcolourrset
        if {$tkcolourrset!=""} { return "\003$tkcolourrset" }
}
proc tkcolstend {} {
        global tkcolourstend
        if {$tkcolourstend!=""} { return "\003$tkcolourstend" }
}
proc tkcolmisc1 {} {
        global tkcolourmisc1
        if {$tkcolourmisc1!=""} { return "\003$tkcolourmisc1" }
}
proc tkcolmisc2 {} {
        global tkcolourmisc2
        if {$tkcolourmisc2!=""} { return "\003$tkcolourmisc2" }
}
proc tkpriv {} {
        global tkpriv2msg
        if {$tkpriv2msg==1} { return "putmsg" } else { return "putnotc" }
}

#
putlog "Teka-Teki tpi DALnet ® Succesfully LoaDeD..."
