This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

BogusTrivia multiple choice/multiple line questions

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
s
stevejobs
Voice
Posts: 3
Joined: Sat Jan 07, 2017 1:28 pm
Location: NY

BogusTrivia multiple choice/multiple line questions

Post by stevejobs »

I would like to have the possibility of posting multiple choice questions.
I would like to have like 3-4 possible answers displayed with only one good choice.
I was speaking with Spike^^ - the owner of Bogus trivia -which seems to be one of the very few out there still being maintained, and it was suggested to include the answers in the question.
Now that brings me to my next request:
Is it possible to change the questions format to multiple lines so it gets more proper formatting in the channel?
The current setup seen in many trivia bots only offers a single line with some delimiter for the answer.

Many thanks
there is no spoon
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Write new questions for BogusTrivia

Post by SpiKe^^ »

stevejobs wrote:I would like to have the possibility of posting multiple choice questions.
I would like to have like 3-4 possible answers displayed with only one good choice.
I was speaking with Spike^^ - the owner of Bogus trivia -which seems to be one of the very few out there still being maintained, and it was suggested to include the answers in the question.
To have BogusTrivia do anything near a true "multiple choice question", you would need to write some multiple choice questions for the game to read. Each of those questions need to include the "3-4 possible answers" to display.

To write new questions for BogusTrivia:

Make a new blank plain text file.
Each question goes on its own line, with its answer(s)
The correct format for each question/answer line in the file is: <question>*<answer>
or for more than one correct answer: <question>*<answer>*<answer2>*<answer3>

The simplest multiple choice questions for BogusTrivia might look something like these...

Code: Select all

Capital of Brazil is: [Toledo] [Salvador] [Brasilia] [Rio de Janeiro]*Brasilia
Capital of Canada is: [Toronto] [Ottawa] [Vancouver] [Montreal]*Ottawa

Write 5 or more new multiple choice question lines to the text file.
Note: /msg bot .add will not add a file with fewer than 3 lines.

Please play with that concept some and tell me if it's of any use without modifying the script.

Your "next request" requires quite a bit more thought.
I'll get back to you on that:)
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
s
stevejobs
Voice
Posts: 3
Joined: Sat Jan 07, 2017 1:28 pm
Location: NY

Feedback

Post by stevejobs »

Hi, I followed your advice, and here is my feedback so far:
I was feeding the bot some questions for testing, and I noticed that the bogustrivia script ( or maybe eggdrop) has a limit of roughly 400 characters before it breaks down the line.
Now if we could decrease that number, that might be helpful, it would take som extra effort fo "fill" the blank spaces for the row completion. but it will definitely help.
It would be nice if we could set up a special character inside the questions file so eggdrop would send it as a new line.

Thanks a lot
there is no spoon
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

stevejobs wrote:I was feeding the bot some questions for testing, and I noticed that the bogustrivia script ( or maybe eggdrop) has a limit of roughly 400 characters before it breaks down the line.
Some max character limit basics:
1) All irc servers have a maximum character limit allowed in any single message handled by the server.
2) The maximum character limit for most irc servers is 512 total characters per message. (your results may vary:)
3) The 512 total characters includes the message header info, as well as the message text.
4) Messages that excede the maximum character limit will be truncated or ignored by the server.

BogusTrivia has several settings that control how the script deals with questions that may be too long.
The defaults, in the t-2.settings.tcl file are...

Code: Select all

# max character limit per question line (usually 512 minus the message header info) #
# Note:  leave this at default, unless you are having long questions missing or truncated. #
#        you may be able to set this larger if your botnick and channel name are very short. #
#        if you're still noticing missing/truncated question lines, lower this setting some. #
set t2(maxchar) "410"

# anti-theft #  random letter fill of spaces in questions ?? #
# turning this on will cause long questions to be over the server max char limit of 512 #
set t2(randfil) "0"   ;# anti-theft on ?? (1=yes | 0=no) #

# over max disables antitheft #
# if a question is over the max character limit, and anti-theft is on, #
# temporarily disable anti-theft to try to stay under the character limit ?? #
# 0 = no: never disable anti-theft if it's on #
# 1 = yes: disable anti-theft for very long questions #
set t2(maxanti) "0"

# what should bogustrivia do if a question is over the max character limit ?? #
# 1 = cut the question to what will fit on one question line #
# 2 = send the remaining question text on a 2nd line #
set t2(maxhow) "2"

stevejobs wrote:Now if we could decrease that number, that might be helpful, it would take som extra effort fo "fill" the blank spaces for the row completion. but it will definitely help.
You can "decrease that number" to anything you want, in the BogusTrivia settings file.
I do not think the t2(maxchar) setting is of any use for a reliable split of a multi-line question.

stevejobs wrote:It would be nice if we could set up a special character inside the questions file so eggdrop would send it as a new line.
The Eggdrop bot won't do this for you, but BogusTrivia can be made to split multi-line questions in the correct place.
I will be working up a patch that will try to address this request.
The "special character" we will be using is: <br>

Write some new questions to add, using this new format: 1st question line<br>2nd question line*answer

Note: No further checking will be done for the length of each line of a multi-line question.
Be sure to keep each line of a multi-line question under 410 characters long or so. (including color codes)


I'll let you know when we have some code to test.
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Multi-Line Questions patch for BogusTrivia

Post by SpiKe^^ »

### Multi-Line Questions patch for BogusTrivia ###

Got some New Code for Testing.
This patch requires some questions formatted like: 1st question line<br>2nd question line*answer

This patch is for BogusTrivia 2.06.4.7 but may also work on some earlier versions.
All patch edits are done in the t-2.tcl file.


1) Search for this line in the t-2.tcl file...

Code: Select all

  putquick "PRIVMSG $t2(chan) :$t2(-questn)"

....and replace that 1 line with these 17 lines...

Code: Select all

  if {[string first "<br>" $t2(-questn)]>"-1"} {
    set ques $t2(-questn)  ;  set mlcnt 0  ;  set isml 1 
    while {$ques ne ""} {
     if {[set 1st [string first "<br>" $t2(-questn)]]=="0"} {
       set ques [string replace $ques 0 3]  ;  continue
     }
     if {$1st>"0"} {  set nxt [string range $ques 0 [incr 1st -1]]
       set ques [string replace $ques 0 [incr 1st 4]]
     } else {  set nxt $ques  ;  set ques ""  }
     if {$nxt ne ""} {  incr mlcnt
       putquick "PRIVMSG $t2(chan) :$nxt"
     }
    }
    if {$mlcnt=="0"} {  set isml 0
      putquick "PRIVMSG $t2(chan) :$t2(-questn)"
    }
  } else {  putquick "PRIVMSG $t2(chan) :$t2(-questn)"  ;  set isml 0  }


2) Search for this line in the t-2.tcl file...

Code: Select all

  if {$t2(usrqes)>="1" && $t2(-uqes)!=""} { TBind q }

....and replace that 1 line with this 1 line...

Code: Select all

  if {$t2(usrqes)>="1" && $t2(-uqes)!="" && $isml=="0"} { TBind q }


3) Search for this line in the t-2.tcl file...

Code: Select all

   if {$t2(randfil)=="1"} {  set stridx 0  ;  set ln1cnt 0  ;  set uln1cnt 0

....and replace that 1 line with these 2 lines...

Code: Select all

   if {$t2(randfil)=="1" && [string first "<br>" $tqes]=="-1"} {
    set stridx 0  ;  set ln1cnt 0  ;  set uln1cnt 0


4) Search for this line in the t-2.tcl file...

Code: Select all

    if {$ln1cnt<=$t2(maxchar)} {  append t2(-questn) "$tqes ? $end"

....and replace that 1 line with these 2 lines...

Code: Select all

    if {[string first "<br>" $tqes]>"-1"} {  append t2(-questn) $tqes
    } elseif {$ln1cnt<=$t2(maxchar)} {  append t2(-questn) "$tqes ? $end"


5) Search for this line in the t-2.tcl file...

Code: Select all

  if {$t2(usrqes)>="1" && $t2(-uqes) eq ""} {  set t2(-uqes) "$tclr(-qt) "

....and replace that 1 line with these 2 lines...

Code: Select all

  if {$t2(usrqes)>="1" && $t2(-uqes) eq "" && [string first "<br>" $tqes]=="-1"} {
    set t2(-uqes) "$tclr(-qt) "


6) Search for this line in the t-2.tcl file...

Code: Select all

    set t2(-hint) "$tclr(-hint) 1st Hint:$tclr(-hint2) $t2(-hint) $t2(-endclr) "

....and replace that 1 line with these 2 lines...

Code: Select all

    if {[string first "<br>" $tqes]=="-1"} {
      set t2(-hint) "$tclr(-hint) 1st Hint:$tclr(-hint2) $t2(-hint) $t2(-endclr) "
    } else {  set t2(-hint) ""  }



...and that's it:) (maybe)

Please test this code and let me know.
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
s
stevejobs
Voice
Posts: 3
Joined: Sat Jan 07, 2017 1:28 pm
Location: NY

Post by stevejobs »

Hi sorry for not responding sooner:
So far it seems like i broke it :
First I got this:

Code: Select all

 missing close-brace: possible unbalanced brace in comment
    while executing
"proc TMkLines {} {"
the whole line looks like this :
proc TMkLines {} {  global t2 tclr botnick nick ;  set t2(-otimer) "" ;  set doques 1 ;  set isbon 0
If i put a curly bracket at the end it complains about the next line :
if {$doques=="1"} {  set qfline [gets $t2(-opnfil)]

can't read "doques": no such variable.
Few thoughts : does tcl care about epmty lines in the code (i left some after the one i pasted so it's easier on the eye).
Other than that pretty much everything else seems fine

Thank you
there is no spoon
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Multi-Line Questions Mod. ver 0.1 for BogusTrivia 2.06.4.7

Post by SpiKe^^ »

Yes, doing multiple edits in a large script can be tricky.
Use a desktop or laptop when editing scripts. Never use a cellphone!

Let's try a much easier route...
Use a working install of BogusTrivia 2.06.4.7 (DO NOT edit the t-2.tcl file as above!)

Paste all the following code to a new plain text document, name it something like: t-2.multiline.tcl
Put the new tcl file in /scripts/ and source that file AFTER source scripts/t-2.tcl

Code in next post...
Last edited by SpiKe^^ on Tue Jan 31, 2017 10:08 pm, edited 1 time in total.
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Multi-Line Questions Mod. ver 0.1 for BogusTrivia 2.06.4.7

Post by SpiKe^^ »

Code: Select all

## Multi-Line Questions Mod. ver 0.1  for  BogusTrivia 2.06.4.7  ##

proc TShoTriv { {expect unk} } {  global t2 tclr botnick
 if {$t2(-ison)=="0"} {  return 0  }  ;  set iskaos 0
 if {$expect ne "unk"} {
   if {$expect!=$t2(-hntnum)} {  return 0  }
 }
 if {$t2(kaos)>"0" && $t2(-iskaos)==$t2(kaos)} {  set iskaos 1  }
 if {$t2(-hntnum)>=$t2(hntcnt) || $t2(-hntnum)=="-1" || $t2(-hntnum)=="-2"} {  set istop 0
   if {$t2(-hntnum)=="-1"} {
     if {![info exists t2(-aon)]} {  set t2(-qtimer) [utimer 8 [list TShoTriv 0]]
     } else {  set t2(-qtimer) [utimer $t2(-aon) [list TShoTriv 0]]  ;  unset t2(-aon)  }
   } elseif {$t2(-hntnum)=="-2"} {  return 0
   } else {
     if {$t2(-utrigd)=="0" && ($t2(qslow)=="0" || $t2(rest)=="0")} {  set x $t2(-udead)  ;  incr x
       if {$x>=$t2(rqcnt) || ($x>=$t2(sqcnt) && $t2(qslow)=="0")} { set istop 1 }
     }
     if {$istop=="0"} {  set t2(-qtimer) [utimer $t2(-ptime) [list TShoTriv 0]]  }
     if {$iskaos=="1"} {  set kleft [expr {[llength $t2(-kansls)]/4}]
       set kgot [expr {$t2(-kanstot)-$kleft}]  ;  set kusrs [expr {[llength $t2(-kusrls)]/5}]
       if {$t2(givkaos)!="0"} {  set ktutmp "$tclr(-ktu) Times up! $tclr(-ktu2) No one got $tclr(-kng) "
         foreach {kans hn2 hn3 kvar} $t2(-kansls) {  append ktutmp "\[$kans\] "  }
       } else {  set ktutmp "$tclr(-ktu2) Times up! "  }
       putquick "PRIVMSG $t2(chan) :$ktutmp"
       if {$kgot>"0"} {
         set ktutm2 "$tclr(-kstat) Correctly Answered:$tclr(-ksta2) $kgot of $t2(-kanstot) "
         if {$t2(-kgotpnts)=="1"} {  set point Point  } else {  set point Points  }
         append ktutm2 "$tclr(-kstat) Total Awarded:$tclr(-ksta2) $t2(-kgotpnts) $point "
         if {$kusrs>"1"} {  append ktutm2 "$tclr(-kstat)to $kusrs Players "  }
         putquick "PRIVMSG $t2(chan) :$ktutm2"
       }
     } else {  set ansr ""
       if {$t2(givansr)!="0"} { set ansr "$tclr(-tu2) The answer was -> $tclr(-tu1) $t2(-answer) $tclr(-tu2) <- " }
       putquick "PRIVMSG $t2(chan) :$tclr(-tu1) Times up! $ansr"
   } }
   if {$t2(-hntnum)>"-1" && $iskaos=="1" && $kgot>"0"} {
     set t2(-otimer) [utimer $t2(-stime) [list TSavActiv nk u@h hn apnt 1 1]]
   } else {
     if {$istop=="0"} {  set t2(-otimer) [utimer $t2(-stime) [list TMkLines]]  }
     if {$t2(-hntnum)>"-1" && $iskaos=="1"} {  unset t2(-kusrls)  }
   }
   if {$t2(-abound)=="1"} { TBind a u }
   if {$t2(-qbound)=="1"} { TBind q u } ;  if {$t2(-hbound)=="1"} { TBind h u }
   array set t2 {-hint "" -hnt2 "" -hnt3 "" -uhint "" -uhnt2 "" -uhnt3 ""}
   array set t2 {-points "" -questn "" -quesn2 "" -answer "" -uqes "" -uqs2 "" -hntnum 0}
   set t2(-allansls) ""
   if {$iskaos=="1"} {
      if {[info exists t2(-kanstot)]} { unset t2(-kanstot) }
      if {[info exists t2(-kansls)]} { unset t2(-kansls) }
      if {[info exists t2(-kgotpnts)]} { unset t2(-kgotpnts) }
      if {[info exists t2(-kbon)]} { unset t2(-kbon) }
   }
   if {$t2(dobonus)>"0"} {
     if {$t2(-lastbns)<$t2(dobonus)} {  incr t2(-lastbns)
     } else {  set t2(-lastbns) 0  ;  incr t2(-shobons)  }
   }
   if {$t2(kaos)>"0"} {
     if {$t2(-iskaos)>=$t2(kaos)} {  set t2(-iskaos) 1
     } else {
       if {$t2(krest)=="1"} {
         if {$t2(-udead)<$t2(rqcnt)} {  incr t2(-iskaos)  }
       } elseif {$t2(krest)>"1"} {
         if {$t2(-udead)<$t2(sqcnt)} {  incr t2(-iskaos)  }
       } else {  incr t2(-iskaos)  }
   } }
   if {$istop=="1"} {
     if {$t2(autostart)>"0"} {  set t2(-aoff) 1  }
     TOnOff $botnick idle stop $t2(chan) 0 4
   }
 } elseif {$t2(-hntnum)=="0" || $t2(-hntnum)=="-3"} {
  if {$t2(-preqes) ne ""} {
      putquick "PRIVMSG $t2(chan) :$tclr(-randad) $t2(-preqes) "  ;  set t2(-preqes) ""  }
  if {[string first "<br>" $t2(-questn)]>"-1"} {
    set ques $t2(-questn)  ;  set mlcnt 0  ;  set isml 1 
    while {$ques ne ""} {
     if {[set 1st [string first "<br>" $ques]]=="0"} {
       set ques [string replace $ques 0 3]  ;  continue
     }
     if {$1st>"0"} {  set nxt [string range $ques 0 [incr 1st -1]]
       set ques [string replace $ques 0 [incr 1st 4]]
     } else {  set nxt $ques  ;  set ques ""  }
     if {$nxt ne ""} {  incr mlcnt
       putquick "PRIVMSG $t2(chan) :$nxt"
     }
    }
    if {$mlcnt=="0"} {  set isml 0
      putquick "PRIVMSG $t2(chan) :$t2(-questn)"
    }
  } else {  putquick "PRIVMSG $t2(chan) :$t2(-questn)"  ;  set isml 0  }
  if {$t2(-quesn2) ne ""} {  putquick "PRIVMSG $t2(chan) :$t2(-quesn2)"  }
  putquick "PRIVMSG $t2(chan) :$t2(-hint)"
  if {$t2(-uhint) ne ""} { TBind h } ;  TBind a ;  set t2(-qstart) [clock clicks -milliseconds]
  if {$iskaos=="1"} {  incr t2(-kcount)  ;  set tkcntfil [open $t2(sfpath)t2.kcount w]
    puts $tkcntfil "$t2(-kcount)"  ;  close $tkcntfil  ;  set sec $t2(ktime)
    if {$t2(-udead)>=$t2(sqcnt) && $t2(-htime)>$t2(ktime)} {  set sec $t2(-htime)  }
    set t2(-qtimer) [utimer $sec [list TShoTriv 1]]
  } else {  incr t2(-qcount)  ;  set tqcntfil [open $t2(sfpath)t2.qcount w]
    puts $tqcntfil "$t2(-qcount)" ; close $tqcntfil
    set t2(-qtimer) [utimer $t2(-htime) [list TShoTriv 1]]
  }
  set t2(-hntnum) 1
 } elseif {$t2(-hntnum)=="1"} {  set t2(-hntnum) 2
  if {$iskaos=="1"} {  set sec $t2(ktime)  ;  set doshort 0
    if {$t2(-udead)>=$t2(sqcnt) && $t2(-htime)>$t2(ktime)} {  set sec $t2(-htime)  }
    set t2(-qtimer) [utimer $sec [list TShoTriv 2]]
    if {$t2(krest)=="1" && $t2(-udead)>=$t2(rqcnt)} {  set doshort 1
    } elseif {$t2(krest)>"1" && $t2(-udead)>=$t2(sqcnt)} {  set doshort 1  }
    set t2(-hnt2) "$tclr(-khnt) 2nd Hint:$tclr(-khnt2)"
    if {$t2(kstyle)>"1" || $doshort=="1"} {  set kleft [expr {[llength $t2(-kansls)]/4}]
      if {$kleft==$t2(-kanstot)} {  append t2(-hnt2) " All Answers Remaining at "
      } elseif {$kleft=="1"} {  append t2(-hnt2) " One Answer Remaining at "
      } else { append t2(-hnt2) " $kleft of $t2(-kanstot) Answers Remaining at "  }
      if {$t2(-points)=="1"} {  set point Point  } else {  set point Points  }
      if {$kleft=="1"} {  append t2(-hnt2) "$t2(-points) $point $t2(-endclr) $tclr(-kpnt1) "
      } else {  append t2(-hnt2) "$t2(-points) $point Each $t2(-endclr) $tclr(-kpnt1) "  }
      putquick "PRIVMSG $t2(chan) :$t2(-hnt2)[expr {$sec*2}] seconds "
    } else {
      if {$t2(descend)=="1"} {  set t2(-points) [expr {round($t2(-points)/2.0)}]  }
      foreach {kans hn2 hn3 kvar} $t2(-kansls) {  append t2(-hnt2) " $hn2"  }
      append t2(-hnt2) " $t2(-endclr) $tclr(-kpnt1) [expr {$sec*2}] seconds "
      putquick "PRIVMSG $t2(chan) :$t2(-hnt2)"
    }
  } else {  set t2(-qtimer) [utimer $t2(-htime) [list TShoTriv 2]]
    set t2(-hnt2) "$tclr(-hint) 2nd Hint:$tclr(-hint2) $t2(-hnt2) $t2(-endclr) "
    if {$t2(descend)=="1"} {  set givpnt [expr {round($t2(-points)/2.0)}]
      if {$givpnt=="1"} {  set point Point  } else {  set point Points  }
      append t2(-hnt2) "$tclr(-pnt1) [expr {$t2(-htime)*2}] secs &$tclr(-pnt2) $givpnt"
      putquick "PRIVMSG $t2(chan) :$t2(-hnt2) $point $tclr(-pnt1)Remaining "
    } else {  append t2(-hnt2) "$tclr(-pnt1) [expr {$t2(-htime)*2}] secs remaining.  Value:"
      if {$t2(-points)=="1"} {  set point Point  } else {  set point Points  }
      putquick "PRIVMSG $t2(chan) :$t2(-hnt2)$tclr(-pnt2) $t2(-points) $point "
    }
  }
  if {$t2(usrqes)>="1" && $t2(-uqes)!="" && $isml=="0"} { TBind q }
  if {$t2(-uhnt2)!=""} {
   if {$t2(-hbound)=="0"} { TBind h }
  } else {
   if {$t2(-hbound)=="1"} { TBind h u }
  }
 } elseif {$t2(-hntnum)=="2"} {  set t2(-hntnum) 3
  if {$iskaos=="1"} {  set sec $t2(ktime)  ;  set doshort 0
    if {$t2(-udead)>=$t2(sqcnt) && $t2(-htime)>$t2(ktime)} {  set sec $t2(-htime)  }
    set t2(-qtimer) [utimer $sec [list TShoTriv 3]]
    if {$t2(krest)=="1" && $t2(-udead)>=$t2(rqcnt)} {  set doshort 1
    } elseif {$t2(krest)>"1" && $t2(-udead)>=$t2(sqcnt)} {  set doshort 1  }
    set t2(-hnt3) "$tclr(-khnt) 3rd Hint:$tclr(-khnt2)"
    if {$t2(kstyle)>"2" || $doshort=="1"} {  set kleft [expr {[llength $t2(-kansls)]/4}]
      if {$kleft==$t2(-kanstot)} {  append t2(-hnt3) " All Answers Remaining at "
      } elseif {$kleft=="1"} {  append t2(-hnt3) " One Answer Remaining at "
      } else { append t2(-hnt3) " $kleft of $t2(-kanstot) Answers Remaining at "  }
      if {$t2(-points)=="1"} {  set point Point  } else {  set point Points  }
      if {$kleft=="1"} {  append t2(-hnt3) "$t2(-points) $point $t2(-endclr) $tclr(-kpnt1) "
      } else {  append t2(-hnt3) "$t2(-points) $point Each $t2(-endclr) $tclr(-kpnt1) "  }
      putquick "PRIVMSG $t2(chan) :$t2(-hnt3)$sec seconds "
    } else {
      if {$t2(descend)=="1"} {  set t2(-points) [expr {round($t2(-points)/2.0)}]  }
      foreach {kans hn2 hn3 kvar} $t2(-kansls) {  append t2(-hnt3) " $hn3"  }
      append t2(-hnt3) " $t2(-endclr) $tclr(-kpnt1) $sec seconds "
      putquick "PRIVMSG $t2(chan) :$t2(-hnt3)"
    }
  } else {  set t2(-qtimer) [utimer $t2(-htime) [list TShoTriv 3]]
    set t2(-hnt3) "$tclr(-hint) 3rd Hint:$tclr(-hint2) $t2(-hnt3) $t2(-endclr) "
    if {$t2(descend)=="1"} {
      set givpnt [expr {round([expr {round($t2(-points)/2.0)}]/2.0)}]
      if {$givpnt=="1"} {  set point Point  } else {  set point Points  }
      append t2(-hnt3) "$tclr(-pnt1) $t2(-htime) secs &$tclr(-pnt2) $givpnt"
      putquick "PRIVMSG $t2(chan) :$t2(-hnt3) $point $tclr(-pnt1)Remaining "
    } else {  append t2(-hnt3) "$tclr(-pnt1) $t2(-htime) secs remaining.  Value:"
      if {$t2(-points)=="1"} {  set point Point  } else {  set point Points  }
      putquick "PRIVMSG $t2(chan) :$t2(-hnt3)$tclr(-pnt2) $t2(-points) $point "
    }
  }
  if {$t2(-uhnt3)!=""} {
   if {$t2(-hbound)=="0"} { TBind h }
  } else {
   if {$t2(-hbound)=="1"} { TBind h u }
}}}

proc TMkLines {} {  global t2 tclr botnick nick ;  set t2(-otimer) "" ;  set doques 1 ;  set isbon 0
 if {[info exists t2(S-akp)] && $t2(S-akp)>"0"} {
   if {[expr {$t2(S-aut)+300}]<[unixtime]} {  TSetStat 1  }
 }
 if {$t2(kaos)>"0" && $t2(-iskaos)==$t2(kaos)} {  set qfline [gets $t2(-opnkfil)]
  if {$qfline eq ""} {
    close $t2(-opnkfil) ; set temp [lsearch -exact $t2(-kfills) $t2(-kflnow)]
    if {$t2(-kflnow) eq [lindex $t2(-kfills) end]} {
      set tmp2 [lindex $t2(-kfills) 0]  ;  set tkcntfil [open $t2(sfpath)t2.kcount w]
      puts $tkcntfil "0"  ;  close $tkcntfil  ;  set t2(-kcount) 0
    } else {  set tmp2 [lindex $t2(-kfills) [expr {$temp+1}]]  }
    if {[file exists $tmp2]} { set t2(-opnkfil) [open $tmp2] ; set qfline [gets $t2(-opnkfil)]
      if {$qfline ne ""} {  set t2(-kflnow) $tmp2  ;  set doques 0
      } else {  set t2(kaos) 0  ;  close $t2(-opnkfil)  }
    } else {  set t2(kaos) 0  }
  } else {  set doques 0  }
 }
 if {$doques=="1"} {  set qfline [gets $t2(-opnfil)]
  if {$qfline eq ""} {
    close $t2(-opnfil) ; set temp [lsearch -exact $t2(-qfills) $t2(-qflnow)]
    if {$t2(-qflnow) eq [lindex $t2(-qfills) end]} {
      lappend tmpls $t2(-qfills)  ;  set startovr 1
    } else {  lappend tmpls [lrange $t2(-qfills) [expr {$temp+1}] end]
      lappend tmpls [lrange $t2(-qfills) 0 $temp]  ;  set startovr 0
    }
    set tmpcnt 0  ;  set missng 0  ;  set delfiles ""
    foreach tls $tmpls {  incr tmpcnt
     foreach qfile $tls {
      if {[file exists $qfile]} { set t2(-opnfil) [open $qfile] ; set t2(-qflnow) $qfile
       while {![eof $t2(-opnfil)]} {
        set qfline [gets $t2(-opnfil)]  ;  if {$qfline ne ""} { break }
       }
       if {$qfline eq ""} {  close $t2(-opnfil)  ;  file delete $qfile
         lappend  delfiles $qfile  ;  incr t2(-qfcnt) -1
         if {[set tfidx [lsearch $t2(-qfills) $qfile]]!="-1"} {
             set t2(-qfills) [lreplace $t2(-qfills) $tfidx $tfidx] }
       } else { break }
      } else {  incr missng  ;  incr t2(-qfcnt) -1
       if {[set tfidx [lsearch $t2(-qfills) $qfile]]!="-1"} {
           set t2(-qfills) [lreplace $t2(-qfills) $tfidx $tfidx] }
      }
     }
     if {$qfline ne ""} {  break  }
    }
    if {$tmpcnt=="2" || $startovr=="1"} {  set tqcntfil [open $t2(sfpath)t2.qcount w]
      puts $tqcntfil "0"  ;  close $tqcntfil  ;  set t2(-qcount) 0
 }} }
 if {$qfline ne ""} {  set qls [split $qfline *] ;  set t2(-allansls) [TStrLo [lrange $qls 1 end]]
  if {$t2(-test)=="1"} {  putlog "\00310$t2(-allansls)"  }
  set tqes [lindex $qls 0]  ;  set t2(-answer) [lindex $qls 1]
  if {[llength $qls]>"2"} {  set tmpcnt 1
    foreach altansr [lrange $qls 2 end] { incr tmpcnt ; set t2(-answr$tmpcnt) $altansr }
  }
  if {$t2(shonum)=="0"} {  set tqnum ""
  } else {
   if {$doques=="1"} {
    if {[string length $t2(-qcount)]=="1"} {  set tqnum ".000$t2(-qcount). "
    } elseif {[string length $t2(-qcount)]=="2"} { set tqnum ".00$t2(-qcount). "
    } elseif {[string length $t2(-qcount)]=="3"} { set tqnum ".0$t2(-qcount). "
    } else {  set tqnum ".$t2(-qcount). "  }
   } else {
    if {[string length $t2(-kcount)]=="1"} {  set tqnum ".K00$t2(-kcount). "
    } elseif {[string length $t2(-kcount)]=="2"} { set tqnum ".K0$t2(-kcount). "
    } else {  set tqnum ".K$t2(-kcount). "  }
  }}
  set t2(-quesn2) ""  ;  set t2(-uqes) ""  ;  set t2(-uqs2) ""  ;  set isml 0
  set dun 0  ;  set tq2 ""  ;  set tq3 ""  ;  set uq2 ""  ;  set uq3 ""
  if {$t2(randfil)=="1"} {  set tc [lindex [split $tclr(-qt) ,] 0]
      set sc [lindex [split $tclr(-qs) ,] 0]  }
  if {[TStrLo $tqes]=="scramble" || [TStrLo $tqes]=="uword"} {  set temp [TStrLo $t2(-answer)]
   if {$t2(randfil)=="1"} {  append tq2 "UnScramble$sc[TRandL]$tc"
     append tq2 "this$sc[TRandL]${tc}Word:"
   } else {  append tq2 "UnScramble this Word:"  }
   while {$dun=="0"} {
    if {[string length $temp]>"1"} {  set tem2 [rand [string length $temp]]
     if {$t2(randfil)=="1"} {  append tq2 "$sc[TRandL]$tc[string index $temp $tem2]"
     } else {  append tq2 " [string index $temp $tem2]"  }
     set temp [string replace $temp $tem2 $tem2]
    } else {
     if {$t2(randfil)=="1"} {  append tq2 "$sc[TRandL]$tc$temp"  } else {  append tq2 " $temp"  }
     set dun 1  ;  break
    }
   }
   set t2(-questn) "$tclr(-qt) $tqnum$tq2 ? $t2(-endclr)"
   if {$t2(usrqes)>="1"} {  set t2(-uqes) "$tclr(-qt) $tq2 ? $t2(-endclr)"  }
  } else {
   if {[string first "<br>" $tqes]>="0"} {  set isml 1  }
   if {$t2(randfil)=="1" && $isml=="0"} {  set stridx 0  ; set ln1cnt 0  ; set uln1cnt 0
    set charcnt [expr {[string length $tqnum]+7}]  ;  set pubqcnt 7
    while {$dun=="0"} {  set temp [string first " " $tqes $stridx]
     if {$temp!="-1"} {  set nxword [string range $tqes $stridx [expr {$temp-1}]]
     } else {  set nxword [string range $tqes $stridx end]  }
     set nxlen [expr {$charcnt+[string length $nxword]+3}]
     if {$tq3 ne "" || $uq3 ne ""} {
       if {$nxlen>=$t2(maxchar)} {  set dun 2  ;  break  }
       if {$tq3 eq ""} {  append tq2 $nxword  ;  incr charcnt [string length $nxword]
         set ln1cnt $charcnt  ;  set tq3 "$tclr(-qt) "  ;  set charcnt 3
       } else {  append tq3 $nxword  ;  incr charcnt [string length $nxword]
         if {$temp!="-1"} {  append tq3 " "  ;  incr charcnt  }
       }
       if {$t2(usrqes)>="1"} {
         if {$uq3 eq ""} {  append uq2 $nxword  ;  incr pubqcnt [string length $nxword]
           set uln1cnt $pubqcnt  ;  set uq3 "$tclr(-qt) " ;  set pubqcnt 3
         } else {  append uq3 $nxword  ;  incr pubqcnt [string length $nxword]
           if {$temp!="-1"} {  append uq3 " "  ;  incr pubqcnt  }
         }
       }
       if {$t2(maxhow)=="1" && $t2(usrqes)<="1"} {  set dun 1  ;  break  }
     } else {
       if {$temp!="-1"} {  set strid2 [expr {$temp+1}] ;  set tmp2 [string first " " $tqes $strid2]
         if {$tmp2!="-1"} {  set nxwrd2 [string range $tqes $strid2 [expr {$tmp2-1}]]
         } else {  set nxwrd2 [string range $tqes $strid2 end]  }
         set nxln2 [expr {$charcnt+[string length $nxword]+[string length $nxwrd2]+10}]
         if {$nxln2<$t2(maxchar)} {  append tq2 $nxword$sc[TRandL]$tc
           incr charcnt [expr {[string length $nxword]+7}]  ;  set ln1cnt $charcnt
         } else {
           if {$tmp2=="-1" && [expr {$nxln2-6}]<$t2(maxchar)} {  append tq2 "$nxword "
             incr charcnt [expr {[string length $nxword]+1}]  ;  set ln1cnt $charcnt
           } elseif {$tmp2=="-1" && $t2(maxhow)=="2"} {  append tq3 "$tclr(-qt) $nxword "
             set charcnt [expr {[string length $nxword]+8}]
           } else {  append tq2 $nxword  ;  incr charcnt [string length $nxword]
             set ln1cnt $charcnt  ;  append tq3 "$tclr(-qt) "  ;  set charcnt 7
           }
         }
         if {$t2(usrqes)>="1"} {
           set unxln2 [expr {$pubqcnt+[string length $nxword]+[string length $nxwrd2]+10}]
           if {$unxln2<$t2(maxchar)} {  append uq2 $nxword$sc[TRandL]$tc
             incr pubqcnt [expr {[string length $nxword]+7}]  ;  set uln1cnt $pubqcnt
           } else {
             if {$tmp2=="-1" && [expr {$unxln2-6}]<$t2(maxchar)} {  append uq2 "$nxword "
               incr pubqcnt [expr {[string length $nxword]+1}]  ;  set uln1cnt $pubqcnt
             } elseif {$tmp2=="-1" && $t2(usrqes)=="2"} {  append uq3 "$tclr(-qt) $nxword "
               set pubqcnt [expr {[string length $nxword]+8}]
             } else {  append uq2 $nxword  ;  incr pubqcnt [string length $nxword]
               set uln1cnt $pubqcnt  ;  append uq3 "$tclr(-qt) "  ;  set pubqcnt 7
             }
         } }
       } else {  append tq2 $nxword ;  incr charcnt [string length $nxword] ;  set ln1cnt $charcnt
         if {$t2(usrqes)>="1"} {  append uq2 $nxword
           incr pubqcnt [string length $nxword]  ;  set uln1cnt $pubqcnt
         }
     } }
     if {$temp=="-1"} {  set dun 1  ;  break  }
     set stridx [expr {$temp+1}]
    }
    if {$tq3 eq ""} {  incr ln1cnt 3
      set t2(-questn) "$tclr(-qt) $tqnum$tq2 ?"
      if {$ln1cnt<$t2(maxchar)} {  append t2(-questn) " $t2(-endclr)"  ;  incr ln1cnt
      } else {  append t2(-questn) $t2(-endclr)  }
    } elseif {$t2(maxhow)=="1" && $t2(maxanti)=="0"} {  incr ln1cnt 3
      set t2(-questn) "$tclr(-qt) $tqnum$tq2.."
      if {$ln1cnt<$t2(maxchar)} {  append t2(-questn) "."  ;  incr ln1cnt
        if {$ln1cnt<$t2(maxchar)} {  append t2(-questn) " "  ;  incr ln1cnt  }
      }
      append t2(-questn) $t2(-endclr)
    } elseif {$t2(maxanti)=="0"} {  set ln2cnt [expr {3+$charcnt}]
      set t2(-questn) "$tclr(-qt) $tqnum$tq2 $t2(-endclr)"  ;  incr ln1cnt 2
      if {$dun=="2"} {  set t2(-quesn2) "$tq3.."
        if {$ln2cnt<$t2(maxchar)} {  append t2(-quesn2) "."  ;  incr ln2cnt
          if {$ln2cnt<$t2(maxchar)} {  append t2(-quesn2) " "  ;  incr ln2cnt  }
        }
        append t2(-quesn2) $t2(-endclr)
      } else {  set t2(-quesn2) "$tq3 ?"
        if {$ln2cnt<$t2(maxchar)} {  append t2(-quesn2) " $t2(-endclr)"
        } else {  append t2(-quesn2) $t2(-endclr)  }
      }
    }
    if {$t2(usrqes)>="1"} {
      if {$uq3 eq ""} {  incr uln1cnt 3
        set t2(-uqes) "$tclr(-qt) $uq2 ?"
        if {$uln1cnt<$t2(maxchar)} {  append t2(-uqes) " $t2(-endclr)"
        } else {  append t2(-uqes) $t2(-endclr)  }
      } elseif {$t2(usrqes)=="1" && $t2(maxanti)=="0"} {  incr uln1cnt 3
        set t2(-uqes) "$tclr(-qt) $uq2.."
        if {$uln1cnt<$t2(maxchar)} {  append t2(-uqes) "."  ;  incr uln1cnt
          if {$uln1cnt<$t2(maxchar)} {  append t2(-uqes) " "  ;  incr uln1cnt  }
        }
        append t2(-uqes) $t2(-endclr)
      } elseif {$t2(maxanti)=="0"} {  set uln2cnt [expr {3+$pubqcnt}]
        set t2(-uqes) "$tclr(-qt) $uq2 $t2(-endclr)"
        if {$dun=="2"} {  set t2(-uqs2) "$uq3.."
          if {$uln2cnt<$t2(maxchar)} {  append t2(-uqs2) "."  ;  incr uln2cnt
            if {$uln2cnt<$t2(maxchar)} {  append t2(-uqs2) " "  ;  incr uln2cnt  }
          }
          append t2(-uqs2) $t2(-endclr)
        } else {  set t2(-uqs2) "$uq3 ?"
          if {$uln2cnt<$t2(maxchar)} {  append t2(-uqs2) " $t2(-endclr)"
          } else {  append t2(-uqs2) $t2(-endclr)  }
   }} } }
  }
  if {$t2(-questn) eq ""} {  set t2(-questn) "$tclr(-qt) $tqnum"
    set ln1cnt [expr {[string length $tqnum]+[string length $tqes]}]
    if {$tclr(-qt) eq ""} {  incr ln1cnt 4  ;  set end ""
    } else {  incr ln1cnt 7  ;  set end $t2(-endclr)  }
    if {$isml=="1"} {  append t2(-questn) $tqes
    } elseif {$ln1cnt<=$t2(maxchar)} {  append t2(-questn) "$tqes ? $end"
    } else {
      if {$tclr(-qt) eq ""} {  set ln1cnt [expr {[string length $tqnum]+2}]  ;  set ln2cnt 4
      } else {  set ln1cnt [expr {[string length $tqnum]+5}]  ;  set ln2cnt 7  }
      if {$t2(maxhow)=="1"} {  incr ln1cnt 3  }
      set x [expr {$t2(maxchar)-$ln1cnt}]  ;  set y [string last " " $tqes $x]
      set frst [string range $tqes 0 [expr {$y-1}]]
      set scnd [string range $tqes [expr {$y+1}] end]
      if {$t2(maxhow)=="1"} {
        append t2(-questn) "$frst... $end"  ;  incr ln1cnt [string length $frst]
      } else {  append t2(-questn) "$frst $end"  ;  incr ln1cnt [string length $frst]
        set x [expr {$t2(maxchar)-$ln2cnt}]
        if {[string length $scnd]>$x} {  incr x -1  ;  set y [string last " " $scnd $x]
          set t2(-quesn2) "$tclr(-qt) [string range $scnd 0 [expr {$y-1}]]... $end"
        } else {  set t2(-quesn2) "$tclr(-qt) $scnd ? $end"  }
  } } }
  if {$t2(usrqes)>="1" && $t2(-uqes) eq "" && $isml=="0"} {  set t2(-uqes) "$tclr(-qt) "
    if {$tclr(-qt) eq ""} {  set uln1cnt [expr {[string length $tqes]+4}]  ;  set end ""
    } else {  set uln1cnt [expr {[string length $tqes]+7}]  ;  set end $t2(-endclr)  }
    if {$uln1cnt<=$t2(maxchar)} {  append t2(-uqes) "$tqes ? $end"
    } else {
      if {$tclr(-qt) eq ""} {  set uln1cnt 2  ;  set ln2cnt 4
      } else {  set uln1cnt 5  ;  set ln2cnt 7  }
      if {$t2(maxhow)=="1"} {  incr uln1cnt 3  }
      set x [expr {$t2(maxchar)-$uln1cnt}]  ;  set y [string last " " $tqes $x]
      if {$t2(maxhow)=="1"} {  append t2(-uqes) "[string range $tqes 0 [expr {$y-1}]]... $end"
      } else {  set z [string range $tqes [expr {$y+1}] end]
        append t2(-uqes) "[string range $tqes 0 [expr {$y-1}]] $end"
        set x [expr {$t2(maxchar)-$ln2cnt}]
        if {[string length $z]>$x} {  incr x -1  ;  set y [string last " " $z $x]
          set t2(-uqs2) "$tclr(-qt) [string range $z 0 [expr {$y-1}]]... $end"
        } else {  set t2(-uqs2) "$tclr(-qt) $z ? $end"  }
  } } }
  if {$doques=="1"} {  set tansls [list $t2(-answer)]
    set nrange [expr {$t2(hpoint)-$t2(lpoint)}] ; set brange [expr {$t2(maxbonus)-$t2(minbonus)}]
  } else {  set tansls [lrange $qls 1 end] ; set t2(-kansls) "" ; set kdigcnt 0  }
  set kanscnt 0  ;  set q $t2(hintchar)
  foreach tmansr $tansls {
   set ansls [split $tmansr {}] ;  set istrun 0 ;  incr kanscnt ;  set kbegin ""
   if {$doques=="1"} {  set pbase $t2(lpoint)  ;  set aprang 0
   } else {
     if {$kanscnt=="1"} { set tem4 -answer } else { set tem4 -answr$kanscnt }
   }
   if {[llength $ansls]=="1"} {
     if {$doques=="1"} {  set t2(-hint) $q ;  set t2(-hnt2) $q ;  set t2(-hnt3) $q
       if {[TStrDig $tmansr]} {  set aprang [expr {round($nrange/4.0)}]
       } else {  set aprang [expr {round($nrange/3.0)}]  }
     } else {  incr kdigcnt  ;  append t2(-hint) " \[$q\]"
       lappend t2(-kansls) $tmansr \[$q\] \[$q\] $tem4
     }
   } elseif {[llength $ansls]=="2"} {
     if {$doques=="1"} {
       set t2(-hint) "$q$q" ; set t2(-hnt2) "[lindex $ansls 0]$q" ; set t2(-hnt3) "[lindex $ansls 0]$q"
       if {[TStrDig [lindex $ansls 1]]} { set aprang [expr {round($nrange/4.0)}]
       } else { set aprang [expr {round($nrange/3.0)}] }
     } else {  incr kdigcnt 2  ;  append t2(-hint) " \[$q$q\]"
       lappend t2(-kansls) $tmansr \[[lindex $ansls 0]$q\] \[[lindex $ansls 0]$q\] $tem4
     }
   } elseif {[TStrDig $tmansr] && [llength $ansls]<"5"} {
     foreach {d1 d2 d3 d4} $ansls { break }
     if {$doques=="1"} {  set t2(-uhint) $d1
       if {$d4==""} {   set aprang [expr {round($nrange/3.0)}]
         set t2(-hint) "$q$q$q" ; set t2(-hnt2) "$d1$q$q" ; set t2(-hnt3) "$d1$d2$q"
       } else {   set aprang [expr {round($nrange/2.0)}]
         set t2(-hint) "$q$q$q$q" ; set t2(-hnt2) "$d1$d2$q$q" ; set t2(-hnt3) "$d1$d2$d3$q"
       }
     } else {
       if {$d4==""} {  incr kdigcnt 3  ;  append t2(-hint) " \[$q$q$q\]"
         lappend t2(-kansls) $tmansr \[$d1$q$q\] \[$d1$d2$q\] $tem4
       } else {  incr kdigcnt 4  ;  append t2(-hint) " \[$q$q$q$q\]"
         lappend t2(-kansls) $tmansr \[$d1$d2$q$q\] \[$d1$d2$d3$q\] $tem4
       }
     }
   } else {
    if {$t2(shothe)=="1" && [string match -nocase "The *" $tmansr]} {
      if {[string length $tmansr]>"6"} {
        if {$doques=="1"} {
          append t2(-hint) "The " ; append t2(-hnt2) "The " ; append t2(-hnt3) "The "
          append t2(-uhint) "the " ; append t2(-uhnt2) "the " ; append t2(-uhnt3) "the "
        } else {  incr kdigcnt  ;  append t2(-hint) " \[The "
          append t2(-hnt2) "\[The " ; append t2(-hnt3) "\[The "
        }
        set kbegin [string range $tmansr 0 3]  ;  set tmansr [string range $tmansr 4 end]
        set istrun 1  ;  set ansls [lrange $ansls 4 end]
      }
    }
    if {$doques=="1"} {  set onethrd [expr {$nrange/3.0}]
      if {[llength $ansls]>"14"} {
        if {$t2(dobonus)>"0" && $t2(-shobons)>"0"} {  set isbon 1
          incr t2(-shobons) -1  ;  set pbase $t2(minbonus)  ;  set onethrd [expr {$brange/3.0}]
        }
        if {[llength $ansls]>"24"} {  set aprang [expr {round($onethrd*1.0)}]
          incr pbase [expr {round($onethrd*2.0)}]
        } elseif {[llength $ansls]>"19"} {
          if {$isbon=="1"} {  set aprang [expr {round($onethrd*2.0)}]
            incr pbase [expr {round($onethrd*1.0)}]
          } else {  set half [expr {$nrange/2.0}]  ;  set aprang [expr {round($half*1.0)}]
            incr pbase [expr {round($half*1.0)}]
            if {[string match *.5 $half]} {  set tmp [rand 2]
              if {$tmp=="0"} {  incr pbase -1  } else {  incr aprang -1  }
            }
          }
        } else {
          if {$isbon=="1"} {  set aprang [expr {round($onethrd*2.0)}]
          } else { incr pbase [expr {round($onethrd*1.0)}] ; set aprang [expr {round($onethrd*1.0)}] }
        }
      } else {
        if {[llength $ansls]>"8"} {  set aprang [expr {round($onethrd*2.0)}]
        } else {  set aprang [expr {round($nrange/2.0)}] }
      }
    } elseif {$t2(-hnt2)==""} {  append t2(-hint) " \["
      append t2(-hnt2) "\["  ;  append t2(-hnt3) "\["
    }
    set cscnt 0 ;  set chidx -1
    foreach char $ansls { incr chidx  ;  if {$doques=="0"} {  incr kdigcnt  }
     if {[TChar 1 $char]} { incr cscnt ; append t2(-hint) $q
     } else { append t2(-hint) $char }
     if {$chidx=="0"} {  append t2(-hnt2) $char  ;  append t2(-hnt3) $char
      if {$doques=="1"} {  append t2(-uhint) $char
        append t2(-uhnt2) $char  ;  append t2(-uhnt3) $char  }
     } elseif {$chidx=="1"} {
      if {$doques=="1"} {
        if {![TChar 1 [lindex $ansls 0]] && [llength $ansls]>"3"} { append t2(-uhint) $char }
        append t2(-uhnt2) $char  ;  append t2(-uhnt3) $char
      }
      if {[llength $ansls]>"3"} {  append t2(-hnt2) $char  } else {  append t2(-hnt2) $q  }
      append t2(-hnt3) $char
     } elseif {$chidx=="2"} {
      if {[llength $ansls]>"7"} {  append t2(-hnt2) $char
      } else {
       if {[TChar 1 $char]} {  append t2(-hnt2) $q  } else {  append t2(-hnt2) $char  }
      }
      if {[llength $ansls]>"5"} {  append t2(-hnt3) $char
        if {$doques=="1"} {  append t2(-uhnt2) $char  }
      } else {
       if {[TChar 1 $char]} {  append t2(-hnt3) $q  } else {  append t2(-hnt3) $char  }
      }
      if {$doques=="1" && [llength $ansls]>"3"} {  append t2(-uhnt3) $char  }
     } elseif {$chidx=="3"} {
      if {[llength $ansls]>"7"} {
       if {$cscnt>"3"} {
        if {[TChar 1 $char]} {  append t2(-hnt2) $q
         if {[TChar 2 $char]} {  append t2(-hnt3) $char  } else {  append t2(-hnt3) $q  }
        } else {  append t2(-hnt2) $char  ;  append t2(-hnt3) $char  }
       } else {  append t2(-hnt2) $char  ;  append t2(-hnt3) $char  }
       if {$doques=="1"} {  append t2(-uhnt2) $char ; append t2(-uhnt3) $char  }
      } else { 
       if {[TChar 1 $char]} {  append t2(-hnt2) $q
        if {[TChar 2 $char]} {  append t2(-hnt3) $char  } else {  append t2(-hnt3) $q  }
       } else {  append t2(-hnt2) $char  ;  append t2(-hnt3) $char  }
      }
     } else {
      if {[TChar 1 $char]} {  append t2(-hnt2) $q
       if {[TChar 2 $char]} {  append t2(-hnt3) $char  } else {  append t2(-hnt3) $q  }
      } else {  append t2(-hnt2) $char  ;  append t2(-hnt3) $char  }
      if {$doques=="1"} {
        if {$chidx=="4" && [llength $ansls]>"7"} {  append t2(-uhnt3) $char
        } elseif {$chidx=="5" && [llength $ansls]>"12"} { append t2(-uhnt3) $char }
      }
     }
    }
    if {$doques=="0"} { append t2(-hint) \]  ; append t2(-hnt2) \]  ; append t2(-hnt3) \]
      lappend t2(-kansls) $kbegin$tmansr $t2(-hnt2) $t2(-hnt3) $tem4
      set t2(-hnt2) ""  ;  set t2(-hnt3) ""
    }
   }
  }
  if {$t2(-utrigd)=="0"} {  incr t2(-udead)
    if {$t2(-udead)==$t2(sqcnt) && $t2(-htime)==$t2(qtime) && $t2(qslow)>"0"} {
      set t2(-htime) $t2(qslow)  ;  set t2(-ptime) $t2(pslow)  ;  set t2(-stime) $t2(sslow)
    } elseif {$t2(-udead)==$t2(rqcnt) && $t2(rest)>"0"} {
      set t2(-htime) $t2(rest)  ;  set t2(-ptime) $t2(rest)  ;  set t2(-stime) $t2(srest)
    }
  } else {  set t2(-utrigd) $isml=="1"  }
  if {$doques=="1"} {
    if {$isbon=="1"} {
      set pnttmp [TMkPoint $pbase $aprang $t2(-roundb) $t2(minbonus) $t2(maxbonus) b]
    } else {  set pnttmp [TMkPoint $pbase $aprang $t2(-roundq) $t2(lpoint) $t2(hpoint) q]  }
    if {$isml=="0"} {
      set t2(-hint) "$tclr(-hint) 1st Hint:$tclr(-hint2) $t2(-hint) $t2(-endclr) "
    } else {  set t2(-hint) ""  }
    if {$pnttmp=="1"} {  set point Point  } else {  set point Points  }
    if {$isbon=="1"} {
      append t2(-hint) "$tclr(-bonus) BONUS Question Value :$tclr(-bon2) $pnttmp $point "
    } else {  append t2(-hint) "$tclr(-pnt1) Question Value :$tclr(-pnt2) $pnttmp $point "  }
    set t2(-points) $pnttmp
  } else {
    set t2(-hint) "$tclr(-khnt) 1st Hint:$tclr(-khnt2) [string trim $t2(-hint)] $t2(-endclr) "
    set digav [expr {$kdigcnt/$kanscnt}]
    set pbase $t2(klpoint)  ;  set phigh $t2(khpoint)  ;  set prang [expr {$phigh-$pbase}]
    if {$prang>"0"} {  set fifth [expr {$prang/5.0}]
      if {$digav<"3"} {  set range [expr {round($fifth*1.0)}]
      } elseif {$digav<"5"} {  set range [expr {round($fifth*2.0)}]
      } elseif {$digav<"8"} {  set range [expr {round($fifth*2.0)}]
        incr pbase [expr {round($fifth*1.0)}]
      } elseif {$digav<"11"} {  set range [expr {round($fifth*2.0)}]
        incr pbase [expr {round($fifth*2.0)}]
      } elseif {$digav<"14"} {  set range [expr {round($fifth*2.0)}]
        incr pbase [expr {round($fifth*3.0)}]
      } else {  set range [expr {round($fifth*1.0)}] ; incr pbase [expr {round($fifth*4.0)}] }
    } else {  set range 0  }
    set pnttmp [TMkPoint $pbase $range $t2(-roundk) $t2(klpoint) $t2(khpoint) k]
    set t2(-points) $pnttmp
    if {$t2(kbonus)=="0" || $kanscnt<$t2(kbonus)} {  set t2(-kbon) 0
    } else {
      set kbon $t2(kbonlo)  ;  set kbonhi $t2(kbonhi)  ;  set krang [expr {$kbonhi-$kbon}]
      if {$krang>"0"} {  set ksev [expr {$krang/7.0}]
        if {$kanscnt<"6" && $digav<"8"} {  set range [expr {round($ksev*1.0)}]
        } elseif {$kanscnt<"6" && $digav<"14"} {  set range [expr {round($ksev*1.0)}]
          incr kbon [expr {round($ksev*1.0)}]
        } elseif {$kanscnt<"6"} {  set range [expr {round($ksev*1.0)}]
          incr kbon [expr {round($ksev*2.0)}]
        } elseif {$kanscnt<"9" && $digav<"8"} {  set range [expr {round($ksev*2.0)}]
          incr kbon [expr {round($ksev*1.0)}]
        } elseif {$kanscnt<"9" && $digav<"14"} {  set range [expr {round($ksev*1.0)}]
          incr kbon [expr {round($ksev*3.0)}]
        } elseif {$kanscnt<"9"} {  set range [expr {round($ksev*1.0)}]
          incr kbon [expr {round($ksev*4.0)}]
        } elseif {$digav<"8"} {  set range [expr {round($ksev*2.0)}]
          incr kbon [expr {round($ksev*3.0)}]
        } elseif {$digav<"14"} {  set range [expr {round($ksev*1.0)}]
          incr kbon [expr {round($ksev*5.0)}]
        } else { set range [expr {round($ksev*1.0)}] ; incr kbon [expr {round($ksev*6.0)}] }
      } else {  set range 0  }
      set t2(-kbon) [TMkPoint $kbon $range $t2(-roundkb) $t2(kbonlo) $t2(kbonhi) kb]
    }
    set pnttmp [expr {$t2(-points)*$kanscnt}]  ; set t2(-kanstot) $kanscnt
    set t2(-kgotpnts) 0  ;  set t2(-kusrls) ""  ;  set doshort 0
    if {$t2(krest)=="1" && $t2(-udead)>=$t2(rqcnt)} {  set doshort 1
    } elseif {$t2(krest)>"1" && $t2(-udead)>=$t2(sqcnt)} {  set doshort 1  }
    if {$t2(-points)=="1"} {  set point Point  } else {  set point Points  }
    if {$t2(kstyle)=="0" && $doshort=="0"} {
      set qlbeg " $kanscnt Answers at $t2(-points) $point Each"
      set qlend " Total: $pnttmp Points "
      set qstrlen [expr {$ln1cnt+[string length $qlbeg]+[string length $qlend]}]
      if {$tclr(-kpnt1) ne ""} {  incr qstrlen [string length $tclr(-kpnt1)]  }
      if {$tclr(-kpnt2) ne ""} {  incr qstrlen [string length $tclr(-kpnt2)]  }
      if {$qstrlen<=$t2(maxchar)} {  append t2(-questn) $tclr(-kpnt1)$qlbeg$tclr(-kpnt2)$qlend
      } else {  append t2(-quesn2) $tclr(-kpnt1)$qlbeg$tclr(-kpnt2)$qlend  }
    } else {
      set qlbeg " Question Value :"  ;  set qlend " $pnttmp Points "
      set qstrlen [expr {$ln1cnt+[string length $qlbeg]+[string length $qlend]}]
      if {$tclr(-kpnt1) ne ""} {  incr qstrlen [string length $tclr(-kpnt1)]  }
      if {$tclr(-kpnt2) ne ""} {  incr qstrlen [string length $tclr(-kpnt2)]  }
      if {$qstrlen<=$t2(maxchar)} {  append t2(-questn) $tclr(-kpnt1)$qlbeg$tclr(-kpnt2)$qlend
      } else {  append t2(-quesn2) $tclr(-kpnt1)$qlbeg$tclr(-kpnt2)$qlend  }
      set t2(-hint) "$tclr(-khnt) 1st Hint:$tclr(-khnt2) [TDoNum $kanscnt] Possible Answers $t2(-endclr) "
      append t2(-hint) "$tclr(-kpnt1) Each Answer :$tclr(-kpnt2) $t2(-points) $point "
    }
  }
 }
 if {$t2(-dosave)>"0"} {
   if {$t2(-dosave)!="2"} {  TSavHist 1  ;  incr t2(-dosave) -1
     if {$t2(-stats)>"0"} {  TSetStat  }
   } else {  set t2(hdowat) active  ;  incr t2(-dosave) -2
     if {[info exists t2(-hnew)]} {  set t2(-hnew) 0  }
     source $t2(pwdpath)$t2(scrpath)t-2.html.tcl
   }
 } elseif {$t2(-shoda10)>"0" || $t2(-showe10)>"0" || $t2(-shomo10)>"0" || $t2(-shoev10)>"0"} {
   TSavHist 2
 } elseif {$t2(-shohist)>"3"} {
   if {$t2(-histcnt)!="0"} {
     if {$t2(-shohist)=="4"} {  TReadHist 4 1  } else {  TReadHist 4 2  }
   }
   set t2(-shohist) 0
 } elseif {$t2(-shohist)>"0"} {
   if {$t2(-shohist)=="1" && $t2(-yestrda)>"0"} {  TReadHist 1
   } elseif {$t2(-shohist)=="2" && ($t2(-yestrda)=="2" || $t2(-yestrda)=="4")} {  TReadHist 2
   } elseif {$t2(-shohist)=="3" && $t2(-yestrda)>"2"} {  TReadHist 3  }
   set t2(-shohist) 0
 }
 if {[info exists t2(-dobakup)]} {
   if {$t2(-dobakup)=="1"} {
     if {$t2(bakupu)>"0"} {  TBakUp u 0  }  ;  if {$t2(bakuph)>"0"} {  TBakUp h 0  }
   } else {  TBakUp u 0  }
   unset t2(-dobakup)
 }
 if {$t2(-shoad)=="1"} {
   set ner2 "Kp b746.vavrsgB"  ; set ner3 "eiSy ..02 iiTuo"  ; set nerp ""
   foreach x [split $ner2 {}] y [split $ner3 {}] { set nerp $x$y$nerp }
   set t2(-preqes) $nerp\x5e\x5e  ;  set t2(-shoad) 0
 } else {
   if {$t2(randad)>"0"} {  incr t2(-randcnt)
     if {$t2(-randcnt)>=$t2(randad)} {
       set t2(-preqes) [lindex $t2(rndlin) $t2(-shorand)]  ;  incr t2(-shorand)
       if {$t2(-shorand)>=[llength $t2(rndlin)]} {  set t2(-shorand) 0  }
       set t2(-randcnt) 0
 } } }
 if {$t2(limit)>"0" && $t2(-lchek)>"0"} {  incr t2(-lchek) -1
   if {$t2(-lchek)=="1"} {  set t2(-limls) ""  ;  return 0  }
   if {$t2(-active) ne "" && [lindex $t2(-active) 5]>"0"} {
     set nkls "" ;  set hnls "" ;  set hsls "" ;  set ptls ""
     foreach {nk n2 hn uh u2 tp wp mp} $t2(-active) {  set fnd 0
      if {$tp=="0"} {  break  }
      if {[set idx [lsearch $nkls *,$nk,*]]>"-1"} {  set fnd 1  }
      if {$fnd=="0" && $n2 ne "-" && [set idx [lsearch $nkls *,$n2,*]]>"-1"} {  set fnd 1  }
      if {$fnd=="0" && $hn ne "*" && [set idx [lsearch $hnls *,$hn,*]]>"-1"} {  set fnd 1  }
      if {$fnd=="0" && $t2(l-match)>"0"} {
        if {$t2(l-match)=="3"} {  set ptrn "*,$uh,*"
          if {$u2 ne "-"} {  set ptr2 "*,$u2,*"  } else {  set ptr2 ""  }
        } else {  foreach {un hs} [split $uh @] { break }
          if {$t2(l-match)=="1"} {  set ptrn "*,*@$hs,*"  } else {  set ptrn "*,$un@*,*"  }
          if {$u2 ne "-"} {  foreach {un hs} [split $u2 @] { break }
            if {$t2(l-match)=="1"} {  set ptr2 "*,*@$hs,*"  } else {  set ptr2 "*,$un@*,*"  }
          } else {  set ptr2 ""  }

          if {[set idx [lsearch $hsls $ptrn]]>"-1"} {  set fnd 1  }
          if {$fnd=="0" && $ptr2 ne "" && [set idx [lsearch $hsls $ptr2]]>"-1"} { set fnd 1 }
      } }
      if {$fnd=="1"} {  set xnk [lindex $nkls $idx] ; set xhn [lindex $hnls $idx]
        if {![string match *,$nk,* $xnk]} {  append xnk $nk,  }
        if {$n2 ne "-" && ![string match *,$n2,* $xnk]} {  append xnk $n2,  }
        if {$xhn eq "" && $hn ne "*"} {  set xhn ,$hn,
        } elseif {$hn ne "*" && ![string match *,$hn,* $xhn]} {  append xhn $hn,  }
        set nkls [lreplace $nkls $idx $idx $xnk] ; set hnls [lreplace $hnls $idx $idx $xhn]
        if {$t2(l-match)>"0"} {  set xuh [lindex $hsls $idx]
          if {![string match *,$uh,* $xuh]} {  append xuh $uh,  }
          if {$u2 ne "-" && ![string match *,$u2,* $xuh]} {  append xuh $u2,  }
          set hsls [lreplace $hsls $idx $idx $xuh]
        }
        set ptls [lreplace $ptls $idx $idx [expr {[lindex $ptls $idx]+$tp}]]
      } else {  set ndat ,$nk,  ;  set udat ,$uh,
        if {$n2 ne "-"} {  append ndat $n2,  }
        if {$u2 ne "-"} {  append udat $u2,  }
        if {$hn ne "*"} {  set hdat ,$hn,  } else {  set hdat ""  }
        lappend nkls $ndat ; lappend hnls $hdat ; lappend hsls $udat ; lappend ptls $tp
     }}
     set limls "" ;  set idx -1
     foreach item $ptls {  incr idx
      if {$item>=$t2(limit)} {  set num -1
        foreach nk [split [string trim [lindex $nkls $idx] ,] ,] {
         if {[set fnd [lsearch -inline $t2(-limls) ":nk:*,$nk,*:hn:*"]] ne ""} {
           set num [string index $fnd end]  ;  break
        }}
        if {$num=="-1" && [set dat [lindex $hnls $idx]] ne ""} {
          foreach hn [split [string trim [lindex $hnls $idx] ,] ,] {
           if {[set fnd [lsearch -inline $t2(-limls) "*:hn:*,$hn,*:uh:*"]] ne ""} {
             set num [string index $fnd end]  ;  break
        } }}
        if {$num=="-1" && $t2(l-match)>"0"} {
          foreach uh [split [string trim [lindex $hsls $idx] ,] ,] {
           if {[set fnd [lsearch -inline $t2(-limls) "*:uh:*,$uh,*:end:*"]] ne ""} {
             set num [string index $fnd end]  ;  break
        } }}
        if {$num=="-1"} {  set num 0
          if {$t2(l-stxt) ne ""} {
            foreach nk [split [string trim [lindex $nkls $idx] ,] ,] {
             if {[onchan $nk $t2(chan)]} {  set map [list %n $nk %l $t2(limit)]
               foreach line $t2(l-stxt) {  putserv "NOTICE $nk :[string map $map $line]"  }
               break
        } } }}
        set x :nk:[lindex $nkls $idx]:hn:[lindex $hnls $idx]:uh:[lindex $hsls $idx]:end:
        lappend limls $x$num
     }}
     set t2(-limls) $limls
   } else {  set t2(-limls) ""  }
 }
}

SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

stevejobs

The above script has been fixed for 2nd & 3rd lines now, hopefully.
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
j
juggle
Voice
Posts: 15
Joined: Sat Sep 01, 2018 1:04 am

Re: Multi-Line Questions Mod. ver 0.1 for BogusTrivia 2.06

Post by juggle »

If i use this code.. how will i set Questions according to the New Script
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

This Bogus patch should not have any effect on your existing normal questions. They should display as they always have.

You can add new questions to your database that are specifically designed to work with this multi-line question patch.

The patch just looks for the string <br> anywhere in the question line, and does a linebreak at that point.
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
j
juggle
Voice
Posts: 15
Joined: Sat Sep 01, 2018 1:04 am

Post by juggle »

SpiKe^^ wrote:This Bogus patch should not have any effect on your existing normal questions. They should display as they always have.

You can add new questions to your database that are specifically designed to work with this multi-line question patch.

The patch just looks for the string <br> anywhere in the question line, and does a linebreak at that point.
Thanks Man... I love this script
Post Reply