rendered paste body;Now with multiscore!
;to ensure IAL is updated
on 1:JOIN:*:if ((# == %quizchan) && ($dialog(1) == Quiz)) whois $nick
;-------------LOAD------------
on *:LOAD:{
if (!$isfile(%qoptioncongrats)) set %qoptioncongrats $sfile($mircdir,Choose congratulations file (optional),Set File)
if (!$isdir(%qoptionqdir)) {
set %qoptionqdir $mircdir
set %qoptionqdir $sdir($mircdir,Choose question file directory)
}
if (!$isfile(%qoptionhelp)) set %qoptionhelp $sfile($mircdir,Choose help file (optional),Set File)
}
;-------------OPTIONS--------------
alias quizsetup {
dialog -i quiz
dialog -m qop quizoptions
filloptions
}
alias defaultoptions {
if (!%qoptionq) set %qoptionq Q $chr(37) $+ quizqnum $chr(36) $+ + :
if (!%qoptiona) set %qoptiona A $chr(37) $+ quizqnum $chr(36) $+ + :
if (!%qoptionh) set %qoptionh Hint:
if (!%qoptionn) set %qoptionn Notice:
if (!%qoptionm) set %qoptionm One attempt per person only
if (!%qoptionu) set %qoptionu Scores are being amended
if (!%qoptionqdir) set %qoptionqdir $mircdir
if (!%qoptionmax) set %qoptionmax 10
if (!%qoptionend) set %qoptionend notice
if (!%qoptionlengths) set %qoptionlengths off
if (!%qoptiontable) set %qoptiontable 1
if (!%qoptiondouble) set %qoptiondouble enable
if (!%qoptiondelay) set %qoptiondelay 200
if (!%qoptiondelayuse) set %qoptiondelayuse on
if ((!%qoptionmask) && (%qoptionmask != 0)) set %qoptionmask 3
if (!%qoptionnoscoring) set %qoptionnoscoring off
}
dialog quizoptions {
title "Quiz Options"
size -1 -1 158 171
option dbu
button "Done", 11, 114 152 33 12, ok
button "Cancel", 12, 79 152 33 12, cancel
button "Restore", 13, 9 152 33 12
tab "Quiz", 20, 8 4 139 139
text "Quiz Channel:", 3, 18 26 35 8, tab 20
text "File:", 6, 17 42 10 8, tab 20
button "Reset", 10, 108 55 22 10, tab 20
button %quizline, 9, 80 55 22 10, tab 20
button %qoptionmax, 5, 57 70 17 10, tab 20
text "Question File Line No:", 8, 17 56 55 8, tab 20
button %qoptionqfile, 7, 28 41 102 10, tab 20
check "On Score:", 4, 17 70 35 10, tab 20
combo 2, 57 24 73 69, tab 20 drop
check "Use Congrats text file", 31, 17 127 68 10, tab 20
radio "Get Notice", 34, 81 70 50 10, group tab 20
radio "End Quiz", 35, 81 81 50 10, tab 20
check "Show lengths of answer in question", 36, 17 111 110 10, tab 20
text "Score table:", 42, 17 96 30 8, tab 20
radio "Basic", 43, 56 95 27 10, group tab 20
radio "Classic", 44, 89 95 34 10, tab 20
tab "General", 21
text "Default Quiz Folder:", 28, 19 26 51 8, tab 21
text "Congrats Text File (%nicks,$1):", 29, 18 51 100 8, tab 21
button "Button", 30, 18 36 119 11, tab 21
button "Button", 32, 18 61 119 11, tab 21
check "Button Hide Time in milliseconds:", 47, 18 79 87 10, tab 21
edit "", 48, 113 79 24 10, tab 21
combo 51, 73 96 64 47, tab 21 size drop
text "Mask Type (default 3)", 52, 17 97 54 8, tab 21
button "Jumble a Question File", 1, 18 112 119 11, tab 21
button "Create a jumble quiz from a list of words in a file", 14, 18 127 119 11, tab 21
tab "Labels", 27
text "Use @ where you want the question number", 16, 16 24 123 8, tab 27
text "Control codes possible, colours not recommended", 22, 16 32 123 8, tab 27
text "Question:", 15, 16 51 26 8, tab 27
text "Answer:", 17, 16 63 26 8, tab 27
text "Hint:", 18, 16 75 26 8, tab 27
text "Notice:", 19, 16 87 26 8, tab 27
edit "", 23, 46 50 92 10, tab 27
edit "", 24, 46 62 92 10, tab 27
edit "", 25, 46 74 92 10, tab 27
edit "", 26, 46 86 92 10, tab 27
text "Remember to use Ctrl-O at the end if codes are used", 37, 15 40 124 8, tab 27
edit "", 39, 14 109 124 10, tab 27 autohs
text "Question notice:", 38, 15 101 89 8, tab 27
check "Give undo score notice:", 40, 15 120 68 10, tab 27
edit "", 41, 14 129 124 10, tab 27 autohs
tab "Control", 45
radio "Use Channel Ops", 49, 17 27 53 10, group tab 45
radio "Use Z Control", 50, 80 27 50 10, tab 45
text "Control Title / Reason 1", 53, 17 42 57 8, tab 45
edit "", 55, 76 41 57 10, tab 45
edit "", 56, 16 52 117 10, tab 45
radio "Channel", 63, 16 127 38 10, group tab 45
radio "Notice", 64, 58 127 33 10, tab 45
text "Warning method:", 66, 16 117 50 8, tab 45
edit "", 59, 76 66 57 10, tab 45
edit "", 61, 16 77 117 10, tab 45
edit "", 60, 76 91 57 10, tab 45
text "Control Title / Reason 3", 58, 17 93 57 8, tab 45
text "Control Title / Reason 2", 57, 17 68 57 8, tab 45
edit "", 62, 16 103 117 10, tab 45
radio "Message", 65, 100 127 38 10, tab 45
text "THIS TAB NOT YET ENABLED", 54, 31 19 85 8, tab 45 center
tab "Score", 67
check "Disable double-clicking to award points", 46, 17 25 109 10, tab 67
check "Disable scoring altogether", 68, 17 38 78 10, tab 67
button "Defaults", 33, 44 152 33 12
}
alias filloptions {
var %chan 1
while (%chan <= $chan(0)) {
did -a qop 2 $chan(%chan)
if ($chan(%chan) == %quizchan) did -c qop 2 %chan
inc %chan
}
did -o qop 7 1 %qoptionqfile
did -o qop 9 1 %quizline
did -o qop 5 1 %qoptionmax
did $iif(x isin %qoptionend,-u,-c) qop 4
did $iif(notice isin %qoptionend,-c,-u) qop 34
did $iif(end isin %qoptionend,-c,-u) qop 35
did $iif(%qoptiontable == 1,-c,-u) qop 44
did $iif(%qoptiontable == 2,-c,-u) qop 43
did $iif(%qoptionlengths == on,-c,-u) qop 36
did $iif(%qoptioncongratsuse == on,-c,-u) qop 31
did -o qop 23 1 $replace( [ [ %qoptionq ] ] ,1,@,2,@,3,@,4,@,5,@,6,@,7,@,8,@,9,@,0,@,@@@@,@@@,@@@,@@,@@,@)
did -o qop 24 1 $replace( [ [ %qoptiona ] ] ,1,@,2,@,3,@,4,@,5,@,6,@,7,@,8,@,9,@,0,@,@@@@,@@@,@@@,@@,@@,@)
did -o qop 25 1 $replace( [ [ %qoptionh ] ] ,1,@,2,@,3,@,4,@,5,@,6,@,7,@,8,@,9,@,0,@,@@@@,@@@,@@@,@@,@@,@)
did -o qop 26 1 $replace( [ [ %qoptionn ] ] ,1,@,2,@,3,@,4,@,5,@,6,@,7,@,8,@,9,@,0,@,@@@@,@@@,@@@,@@,@@,@)
did -o qop 30 1 %qoptionqdir
did -o qop 32 1 %qoptioncongrats
did -o qop 39 1 %qoptionm
did $iif(%qoptionuuse == on,-c,-u) qop 40
did -o qop 41 1 %qoptionu
did $iif(%qoptiondouble == disable,-c,-u) qop 46
did $iif(%qoptionnoscoring == on,-c,-u) qop 68
did $iif(%qoptiondelayuse == on,-c,-u) qop 47
did -o qop 48 1 %qoptiondelay
did -a qop 51 0 *!user@host
did -a qop 51 1 *!*user@host
did -a qop 51 2 *!*@host
did -a qop 51 3 *!*user@*.host
did -a qop 51 4 *!*@*.host
did -c qop 51 $calc(%qoptionmask + 1)
}
alias saveoptions {
set %quizchan $did(qop,2)
set %quizserv $scid($cid).server
set %qoptionqfile $did(qop,7)
set %quizline $did(qop,9)
set %qoptionmax $did(qop,5)
set %qoptionend $iif($did(qop,4).state == 0,x) $+ $iif($did(qop,34).state == 1,notice,end)
set %qoptiontable $iif($did(qop,44).state == 1,1,2)
set %qoptionlengths $iif($did(qop,36).state == 1,on,off)
set %qoptioncongratsuse $iif($did(qop,31).state == 1,on,off)
set %qoptionq $label($did(qop,23))
set %qoptiona $label($did(qop,24))
set %qoptionh $label($did(qop,25))
set %qoptionn $label($did(qop,26))
set %qoptionqdir $did(qop,30)
set %qoptioncongrats $did(qop,32)
set %qoptionm $did(qop,39)
set %qoptionu $did(qop,41)
set %qoptionuuse $iif($did(qop,40).state == 1,on,off)
set %line [ $+ [ $remove(%qoptionqfile,$chr(32)) ] ] %quizline
set %qoptiondouble $iif($did(qop,46).state == 1,disable,enable)
set %qoptionnoscoring $iif($did(qop,68).state == 1,on,off)
set %qoptiondelayuse $iif($did(qop,47).state == 1,on,off)
set %qoptiondelay $did(qop,48)
set %qoptionmask $gettok($did(qop,51),1,32)
}
on 1:DIALOG:qop:sclick:13:filloptions
on 1:DIALOG:qop:sclick:33:unset %qoption* | defaultoptions | filloptions
on 1:DIALOG:qop:sclick:12:dialog -e quiz | preview
on 1:DIALOG:qop:sclick:11:saveoptions | preview | dialog -e quiz
on 1:DIALOG:qop:sclick:7:{
did -o qop 7 1 $$sfile(%qoptionqdir,Choose quiz file,Set File)
did -o qop 9 1 1
if (%line [ $+ [ $remove($did(qop,7),$chr(32)) ] ] ) did -o qop 9 1 %line [ $+ [ $remove($did(qop,7),$chr(32)) ] ]
}
on 1:DIALOG:qop:sclick:9:did -o qop 9 1 $$?="Quizline"
on 1:DIALOG:qop:sclick:10:did -o qop 9 1 1
on 1:DIALOG:qop:sclick:5:did -o qop 5 1 $$?="Max Score"
on 1:DIALOG:qop:sclick:30:did -o qop 30 1 $sdir($mircdir,Choose Question directory)
on 1:DIALOG:qop:sclick:32:did -o qop 32 1 $sfile($mircdir,Choose congratulations file (optional),Set File)
on 1:DIALOG:qop:sclick:1:jumble
on 1:DIALOG:qop:sclick:14:wordjumble
alias label {
var %pos $pos($$1,@,1)
return $replace($$1,$chr(32),$chr(32) $chr(36) $+ chr(32) $chr(32),$chr(35),$ascchr(35) $chr(32),@,$chr(32) $chr(36) $+ + $chr(37) $+ quizqnum $chr(36) $+ + $chr(32))
}
alias ascchr return $chr(32) $chr(36) $+ + $chr(36) $+ chr( $+ $$1 $+ ) $chr(36) $+ +
alias jumble {
set %filejumble $$iif(($1),$1,$sfile(%qoptionqdir,File to jumble (Computer will hang for short time),Jumble!))
set %copyline 1
set %qjumble [ %qoptionqdir $+ [ $remove($nopath(%filejumble),.txt) ] $+ Jumbled.txt ]
write -c %qjumble
while (%copyline < $lines(%filejumble)) { copyline }
unset %qjumble
unset %filejumble
}
alias copyline {
set %pasteline $calc(2*$rand(0,$calc($lines(%qjumble) / 2 )) + 1)
write -il [ $+ [ %pasteline ] ] %qjumble $read(%filejumble,%copyline)
inc %copyline
inc %pasteline
write -il [ $+ [ %pasteline ] ] %qjumble $read(%filejumble,%copyline)
inc %copyline
}
alias wordjumble {
set %wordjumble $$sfile(%qoptionqdir,File of words to jumble (Computer will hang for short time),Jumble!)
set %wordjumblenew [ %qoptionqdir $+ [ $remove($nopath(%wordjumble),.txt) ] $+ Word.txt ]
set %wordline 1
while (%wordline <= $lines(%wordjumble)) {
write %wordjumblenew Unjumble the word: $jumbleword
write %wordjumblenew %wordq $read(%wordjumble,%wordline)
inc %wordline
unset %wordnew
}
jumble %wordjumblenew
.remove %wordjumblenew
unset %word*
}
alias jumbleword {
set %wordold $lower($read(%wordjumble,%wordline))
set %wordnumber 1
set %wordoldlength $len(%wordold)
while (%wordnumber <= %wordoldlength) {
jumbleletter
inc %wordnumber
}
return %wordnew
}
alias jumbleletter {
set %wordrand $rand(1,$len(%wordold))
set %wordletter $mid(%wordold,%wordrand,1)
set %wordleft $left(%wordold,$calc(%wordrand - 1))
set %wordright $right(%wordold,$calc($len(%wordold) - %wordrand))
set %wordold %wordleft $+ %wordright
set %wordnew %wordnew $+ %wordletter
}
;--------------POPUPS---------------
menu nicklist,query {
-
It's called lag: notice $$1 Its called lag. What you say comes up on your screen immediately, but it takes time to reach the questioner. Whoever comes up on the questioner's screen first gets the point and that is final. Please do not make a fuss over it, everyone experiences lag, do not cut and paste and do not reply to this notice.
}
menu channel {
-
-
$iif(($dialog(quiz)),$style(2)) Start Quiz: {
defaultoptions
unset %quiz*
set %quizqnum 0
set %quizchan #
set %quizserv $scid($cid).server
if (!$chan(#).ial) who #
set %quizline 1
if ( %line [ $+ [ $remove(%qoptionqfile,$chr(32)) ] ] ) set %quizline %line [ $+ [ $remove(%qoptionqfile,$chr(32)) ] ]
dialog -mod Quiz Quiz
preview
did -i quiz 1 1 < Quiz started in %quizchan >
}
$iif((!%quizscoretally) || ($dialog(quiz)),$style(2)) Continue Quiz: {
defaultoptions
set %quizchan #
set %quizserv $scid($cid).server
if (!$chan(#).ial) who #
dialog -mod Quiz quiz
if (!%quizrepeata) answersetup
preview
did -i quiz 1 1 < Quiz continued in %quizchan >
}
$iif(($dialog(quiz)),$style(2)) Clear Quiz: unset %quiz*
}
;--------------ALIAS-------------------
alias quizline return $read(%qoptionqfile,$calc(%quizline + $1))
alias questions return $round($calc($$1 / 2),0)
alias correct {
set %line [ $+ [ $remove(%qoptionqfile,$chr(32)) ] ] %quizline
if (%quizline >= $calc($lines(%qoptionqfile) - 1)) unset %line [ $+ [ %qoptionqfile ] ]
set %quizaddress $address($$1,%qoptionmask)
set %quiz [ $+ [ %quizaddress ] ] $$1
if (!%quizscorehigh) set %quizscorehigh 0
set %quizoldsc %quizscorehigh
set %quiznewsc $calc(%quizscorehigh + $$2)
while (%quizoldsc >= 1) {
if ($istok(%quizscore [ $+ [ %quizoldsc ] ] ,%quizaddress,32)) { scoresetup | return }
dec %quizoldsc
dec %quiznewsc
}
set %quizscore [ $+ [ $$2 ] ] $addtok(%quizscore [ $+ [ $$2 ] ] ,%quizaddress,32)
set %quiznewsc $$2
if (%quizscorehigh < $$2) set %quizscorehigh $$2
scoreupdate
}
alias scoresetup {
set %quizscore [ $+ [ %quizoldsc ] ] $remtok(%quizscore [ $+ [ %quizoldsc ] ] ,%quizaddress,1,32) | set %quizscore [ $+ [ %quiznewsc ] ] $addtok(%quizscore [ $+ [ %quiznewsc ] ] ,%quizaddress,32)
if (%quiznewsc > %quizscorehigh) set %quizscorehigh %quiznewsc
if ((%quiznewsc >= %qoptionmax) && (%qoptionend == notice)) { did -o quiz 5 1 MAX SCORE REACHED | beep }
scoreupdate
}
alias scoreupdate {
if (!%quizscorehigh) halt
unset %quizscoretally
set %quizsc 1
set %quizf %quizscorehigh
:scoreloop
set %quizt 1
while (%quizt <= $numtok(%quizscore [ $+ [ %quizsc ] ] ,32)) {
if ($ial($gettok(%quizscore [ $+ [ %quizsc ] ] ,%quizt,32)).nick) set %quizupdate [ $+ [ %quizsc ] ] $addtok(%quizupdate [ $+ [ %quizsc ] ] ,$chr(32) $+ $ial($gettok(%quizscore [ $+ [ %quizsc ] ] ,%quizt,32)).nick,44)
else set %quizupdate [ $+ [ %quizsc ] ] $addtok(%quizupdate [ $+ [ %quizsc ] ] ,$chr(32) $+ %quiz [ $+ [ $gettok(%quizscore [ $+ [ %quizsc ] ] ,%quizt,32) ] ] ,44)
inc %quizt
}
inc %quizsc
if (%quizsc <= %quizscorehigh) goto scoreloop
while (%quizsc > 1) {
dec %quizsc
if (%quizupdate [ $+ [ %quizsc ] ]) set %quizscoretally $addtok(%quizscoretally,$chr(40) $+ %quizsc $+ $chr(41) $+ $chr(60) $+ $right(%quizupdate [ $+ [ %quizsc ] ] ,-1) $+ $chr(62),32)
}
unset %quizupdate*
}
;------------------ final scores -------------------
alias finalscores {
if (!%quizscorehigh) halt
set %quizsc 1
set %quizf %quizscorehigh
:finalloop
set %quizt 1
while (%quizt <= $numtok(%quizscore [ $+ [ %quizsc ] ] ,32)) {
tablenicks [ $+ [ %qoptiontable ] ] $ial($gettok(%quizscore [ $+ [ %quizsc ] ] ,%quizt,32)).nick
inc %quizt
}
inc %quizsc
if (%quizsc != $calc(%quizscorehigh + 1)) goto finalloop
table [ $+ [ %qoptiontable ] ]
unset %quizfinal*
set %quizqnum 0
did -r quiz 1
did -a quiz 1 < Quiz completed >
if (!%quizcontinue) { unset %quizscore* }
}
alias tablenicks1 {
if ($ial($gettok(%quizscore [ $+ [ %quizsc ] ] ,%quizt,32)).nick) set %quizfinal [ $+ [ %quizsc ] ] $addtok(%quizfinal [ $+ [ %quizsc ] ] , < $+ $$1 $+ > $+ $chr(32),32)
else set %quizfinal [ $+ [ %quizsc ] ] $addtok(%quizfinal [ $+ [ %quizsc ] ] , < $+ %quiz [ $+ [ $gettok(%quizscore [ $+ [ %quizsc ] ] ,%quizt,32) ] ] $+ > $+ $chr(32),32)
}
alias table1 {
describe %quizchan POSITION $chr(124) SCORE $chr(124) PLAYERS
while (%quizf > 0) {
if (%quizfinal [ $+ [ %quizf ] ] ) describe %quizchan $position $+ $chr(124) $centre(%quizf,7) $chr(124) %quizfinal [ $+ [ %quizf ] ]
dec %quizf
}
}
alias tablenicks2 {
if ($ial($gettok(%quizscore [ $+ [ %quizsc ] ] ,%quizt,32)).nick) set %quizfinal [ $+ [ %quizsc ] ] $addtok(%quizfinal [ $+ [ %quizsc ] ] , $chr(32) $+ $$1 ,44)
else set %quizfinal [ $+ [ %quizsc ] ] $addtok(%quizfinal [ $+ [ %quizsc ] ] , $chr(32) $+ %quiz [ $+ [ $gettok(%quizscore [ $+ [ %quizsc ] ] ,%quizt,32) ] ] ,44)
}
alias table2 {
describe %quizchan - FINAL SCORES -
describe %quizchan SCORE ---- NICKS
while (%quizf > 0) {
if (%quizfinal [ $+ [ %quizf ] ] ) describe %quizchan < %quizf > $str(-,$calc(5 - $len(%quizf))) %quizfinal [ $+ [ %quizf ] ]
dec %quizf
}
}
alias centre {
if ($len($$1) >= $$2) return $3 $+ $$1 $+ $3
var %left $round($calc(($$2 - $len($$1))/2),0)
var %right $calc($$2 - $len($$1) - %left)
return $str( $+ $3 $+ $chr(32),%left) $$1 $str( $+ $3 $+ $chr(32),%right)
}
alias textright {
if ($len($$1) >= $$2) return $3 $+ $$1 $+ $3
var %left $calc($$2 - $len($$1))
return $str( $+ $3 $+ $chr(32),%left) $$1
}
alias position {
if (%quizfinalnum) inc %quizfinalpos %quizfinalnum
else set %quizfinalpos 1
set %quizfinalnum $numtok(%quizfinal [ $+ [ %quizf ] ] ,32)
if (%quizfinalpos == 1) return $centre($iif(%quizfinalnum > 1,Winners,Winner),12)
else return $textright($iif(%quizfinalnum > 1,=) $+ $ord(%quizfinalpos),8)
}
'------- extras --------
alias q { describe # Q: $replace($$1-,/,÷,*,×) }
alias h { describe # H: $$1- }
alias a {
describe # A: $$1-
if (%quizscoretally) { correct $mid($$1-,$calc($pos($$1-,wd,1) + 3),9) }
}
alias newquiz {
set %quiznew $$?1="Name of the new quiz"
write %qoptionqdir $+ %quiznew $+ .txt a
run %qoptionqdir $+ %quiznew $+ .txt
}
alias editquiz { run %qoptionqdir $+ $$?1="Name of the quiz to edit" $+ .txt }
;--------------REMOTES-----------
on 1:NOTICE:q*:#quiz:editbox -p # $chr(47) $+ msg $nick
#groupquiz off
on 1:ACTION:*Q *:#quiz:join #quiz
on 1:ACTION:*(Q)*:#quiz:join #quiz
on 1:ACTION:*Q*:#quiz:if (%questioner == $nick) { join #quiz }
#groupquiz end
;------------------DIALOG----------------
;----dialog table-----
dialog quiz {
title "Quiz by dodgo"
size -1 -1 634 326
list 1, 5 9 240 233, size extsel
button "End Question", 2, 538 18 82 24
button "Ask Question", 3, 262 18 82 24
edit "", 10, 262 45 359 50, multi vsbar
edit "", 11, 262 95 359 23, autohs
button "Skip Q/A", 14, 355 121 82 24
button "Delete Line", 15, 261 121 82 24
button "Close Dialog", 19, 536 294 90 24, ok
button "End Quiz", 20, 551 212 72 24
button "Ask && Notice", 4, 354 18 82 24
edit "", 5, 296 148 324 37, multi autovs
button "Hint", 6, 263 151 32 30
button "Show Scores", 7, 478 212 72 24
button "Edit Scores", 12, 405 212 72 24
button "Restore Q/A", 18, 448 121 82 24
button "Standard Hint", 16, 446 18 82 24
button "Save Q/A", 8, 539 121 82 24
edit "", 22, 14 289 85 23
radio "Swearing", 23, 111 257 120 20
radio "Flooding", 24, 111 275 120 20
radio "Lame/Annoying", 25, 111 293 120 20
button "Kick", 26, 241 277 69 19
button "Ban", 27, 241 296 69 19
button "Get Ops", 28, 16 262 80 22
text "Question Number:", 31, 428 272 88 16
text "num", 33, 517 272 35 16, center
text "out of", 34, 549 272 32 16, center
text "num", 35, 580 272 35 16, center
text "File", 36, 453 254 170 16, center
button "Options", 37, 429 294 90 24
button "Mode", 38, 324 294 90 24
button "Undo Score", 13, 332 212 72 24
button "Quick File Load", 17, 324 257 90 24
text "File:", 30, 428 254 23 16
button "Lag Notice", 32, 241 258 69 19
button "Award", 39, 259 212 72 24
box "Scoring", 9, 253 197 376 46
box "Asking", 21, 253 3 376 190
box "Control", 29, 6 247 308 72
}
alias preview {
if (%quizline >= $lines(%qoptionqfile)) { set %quizline 1 | unset %line [ $+ [ %qoptionqfile ] ] | beep }
did -r quiz 10
did -r quiz 11
did -a quiz 10 $quizline
did -a quiz 11 $quizline(1)
did -o quiz 33 1 $iif(%quizoptionprogress == lines,%quizline,$questions(%quizline))
did -o quiz 35 1 $iif(%quizoptionprogress == lines,$lines(%qoptionqfile),$questions($lines(%qoptionqfile)))
did -o quiz 36 1 $nopath(%qoptionqfile)
}
alias answersetup {
set %quizanswer $did(quiz,11)
if ($did(quiz,11)) inc %quizline 2
if (!$did(quiz,11)) dec %quizqnum
preview
set %quizrepeata on
unset %quizrepeatq
did -b quiz 2
did -e quiz 14
did -e quiz 15
did -b quiz 8
did -b quiz 18
did -e quiz 13
did -b quiz 16
did -e quiz 20
}
alias questionsetup {
inc %quizqnum
unset %quiznumhint
did -r quiz 1
did -r quiz 5
set %quizrepeatq on
unset %quizrepeata
did -e quiz 2
did -b quiz 14
did -b quiz 15
did -b quiz 13
did -e quiz 16
did -b quiz 20
}
alias hintbutton {
$iif(%quiznumhint >= 0,inc %quiznumhint,$iif(%qoptionlengths == on,set %quiznumhint 1,set %quiznumhint 0))
.timerhint -m 1 700 makehint %quiznumhint $iif($chr(40) isin $did(quiz,11),$remove($left($did(quiz,11),$pos($did(quiz,11),$chr(40),1)),$chr(40)),$did(quiz,11))
}
alias makehint {
set %quizhintcnt 0
if (- isin $$2-) set %ch .
else set %ch -
if ($$1 == 0) { set %quizhinthint $replace($$2-,a,%ch,b,%ch,c,%ch,d,%ch,e,%ch,f,%ch,g,%ch,h,%ch,i,%ch,j,%ch,k,%ch,l,%ch,m,%ch,n,%ch,o,%ch,p,%ch,q,%ch,r,%ch,s,%ch,t,%ch,u,%ch,v,%ch,w,%ch,x,%ch,y,%ch,z,%ch,0,%ch,1,%ch,2,%ch,3,%ch,4,%ch,5,%ch,6,%ch,7,%ch,8,%ch,9,%ch,0,%ch) | givehint | halt }
while (%quizhintcnt < $numtok($$2-,32)) {
inc %quizhintcnt
set %quizhintletters $left($gettok($$2-,%quizhintcnt,32),$$1)
if ($$1 < $len($gettok($$2-,%quizhintcnt,32))) { set %quizhintblanks $replace($right($gettok($$2-,%quizhintcnt,32),$calc(-1*$$1)),a,%ch,b,%ch,c,%ch,d,%ch,e,%ch,f,%ch,g,%ch,h,%ch,i,%ch,j,%ch,k,%ch,l,%ch,m,%ch,n,%ch,o,%ch,p,%ch,q,%ch,r,%ch,s,%ch,t,%ch,u,%ch,v,%ch,w,%ch,x,%ch,y,%ch,z,%ch,0,%ch,1,%ch,2,%ch,3,%ch,4,%ch,5,%ch,6,%ch,7,%ch,8,%ch,9,%ch,0,%ch) }
elseif ($$1 >= $len($gettok($$2-,%quizhintcnt,32))) { unset %quizhintblanks }
set %quizhinthint $instok(%quizhinthint,%quizhintletters $+ %quizhintblanks,%quizhintcnt,32)
}
givehint
}
alias givehint {
describe %quizchan [ [ %qoptionh ] ] %quizhinthint
did -a quiz 1 < Hint: %quizhinthint >
unset %quizhint*
unset %ch
}
alias lengths {
unset %quizlength*
set %quizlengthcount 1
while (%quizlengthcount <= $numtok($did(11),32)) {
set %quizlengths $instok(%quizlengths,$len($gettok($did(11),%quizlengthcount,32)),100,44)
inc %quizlengthcount
}
return $chr(40) $+ %quizlengths $+ $chr(41)
}
alias undo {
set %quizscore [ $+ [ %quiznewsc ] ] $remtok(%quizscore [ $+ [ %quiznewsc ] ] ,%quizaddress,1,32)
if (%quiznewsc != 1) set %quizscore [ $+ [ %quizoldsc ] ] $addtok(%quizscore [ $+ [ %quizoldsc ] ] ,%quizaddress,32)
if (%qoptionuuse == on) describe %quizchan [ [ %qoptionn ] ] %qoptionu
dec %quizline 2
preview
unset %quizrepeata
set %quizrepeatq on
did -b quiz 14
did -b quiz 15
did -e quiz 2
did -e quiz 16
did -b quiz 13
did -o quiz 1 %quizcorrectline $left($did(quiz,1,%quizcorrectline),-18)
did -d quiz 1 $calc(%quizcorrectline + 1)
}
alias quickload {
set %qoptionqfile $$sfile(%qoptionqdir,Choose quiz file,Start Asking!)
set %quizline 1
if ( %line [ $+ [ $remove(%qoptionqfile,$chr(32)) ] ] ) set %quizline %line [ $+ [ $remove(%qoptionqfile,$chr(32)) ] ]
preview
}
alias congrats {
set %nicks $$1
if (%qoptioncongratsuse == on) return $read(%qoptioncongrats)
else return Well done $$1 $+ !
}
alias temphide {
if (%qoptiondelayuse = off) return
did -h quiz $$1
.timer -m 1 %qoptiondelay did -v quiz $$1
}
;----dialog remotes-----
on *:TEXT:*:%quizchan:if (($dialog(quiz)) && (< Question isin $did(quiz,1,1)) && ($scid($cid).server == %quizserv)) { did -a quiz 1 $nick -> $strip($$1-) }
on *:NICK:{
if (!$dialog(quiz)) halt
var %nickchange 1
while (%nickchange <= $did(quiz,1).lines) {
if ($gettok($did(quiz,1,%nickchange),1,32) != <) did -o quiz 1 %nickchange $replace($did(quiz,1,%nickchange),$nick,$newnick)
inc %nickchange
}
}
on 1:DIALOG:quiz:init:0:{
if ($me !isop %quizchan) disablecontrol
else did -b quiz 28
$iif(%modequiz == normal,normalmode,$iif(%modequiz == help,helpmode,intromode))
did -b quiz 2
did -b quiz 8
did -b quiz 18
did -b quiz 13
if (!%quizrepeatq) did -b quiz 16
}
on 1:DIALOG:quiz:sclick:3:{
temphide $did
if (!%quizrepeatq) questionsetup
did -a quiz 1 < Question asked >
describe %quizchan [ [ %qoptionq ] ] $did(10,1) $+ $did(10,2) $+ $did(10,3) $+ $did(10,4) $+ $did(10,5) $+ $did(10,6) $iif(%qoptionlengths == on,$lengths)
did -f quiz 5
}
on 1:DIALOG:quiz:sclick:4:{
temphide $did
if (!%quizrepeatq) questionsetup
did -a quiz 1 < Question / Notice >
describe %quizchan [ [ %qoptionq ] ] $did(10,1) $+ $did(10,2) $+ $did(10,3) $+ $did(10,4) $+ $did(10,5) $+ $did(10,6) $iif(%qoptionlengths == on,$lengths)
describe %quizchan [ [ %qoptionn ] ] %qoptionm
did -f quiz 5
}
on 1:DIALOG:quiz:sclick:2:{
temphide $did
did -a quiz 1 < Question skipped >
describe %quizchan Question over, answer was: $did(11)
answersetup
}
on 1:DIALOG:quiz:dclick:1:{
if (%qoptiondouble == disable) halt
set %quizcorrect $gettok($did(1).seltext,1,32)
set %quizcorrectline $did(1).sel
if (%quizcorrect != <) {
if (!%quizrepeata) answersetup
did -o quiz 1 %quizcorrectline $did(1).seltext < Point awarded >
did -i quiz 1 $calc(%quizcorrectline + 1) < Answer: %quizanswer >
describe %quizchan [ [ %qoptiona ] ] %quizanswer $chr(124) $congrats(%quizcorrect)
correct %quizcorrect 1
if (%qoptionnoscoring == on) halt
describe %quizchan SCORES: %quizscoretally
if ((%quizscorehigh >= %qoptionmax) && (%qoptionend == end)) { finalscores | halt }
}
}
on 1:DIALOG:quiz:sclick:39:{
temphide $did
unset %quizcorrect
unset %quizcorrectlines
set %count 1
if (!%quizrepeata) answersetup
if ($did(quiz,1,0).sel > 3) set %countlimit 3 | else set %countlimit $did(quiz,1,0).sel
while (%count <= %countlimit) {
correct $gettok($did(quiz,1,$did(quiz,1,%count).sel),1,32) $calc(4 - %count)
set %quizcorrect $addtok(%quizcorrect,$chr(32) $+ $gettok($did(quiz,1,$did(quiz,1,%count).sel),1,32),44)
set %quizcorrectlines $addtok(%quizcorrectlines,$did(quiz,1,%count).sel,32)
inc %count
}
set %count 1
while (%count <= %countlimit) {
did -o quiz 1 $gettok(%quizcorrectlines,%count,32) $did(1,$gettok(%quizcorrectlines,%count,32)) < Point awarded >
inc %count
}
describe %quizchan [ [ %qoptiona ] ] %quizanswer $chr(124) $congrats(%quizcorrect)
if (%qoptionnoscoring == on) halt
describe %quizchan SCORES: %quizscoretally
if ((%quizscorehigh >= %qoptionmax) && (%qoptionend == end)) { finalscores | halt }
}
on 1:DIALOG:quiz:sclick:19:unset %quizchan | if ($dialog(editscores)) dialog -x editscores
on 1:DIALOG:quiz:edit:5:did -t quiz 6
on 1:DIALOG:quiz:sclick:6:{ temphide $did | describe %quizchan [ [ %qoptionh ] ] $did(5) $+ $did(5,2) $+ $did(5,3) | did -a quiz 1 < Hint: $did(5) $+ $did(5,2) $+ $did(5,3) > | did -r quiz 5 | did -f quiz 5 }
on 1:DIALOG:quiz:edit:10:{ did -t quiz 3 | did -e quiz 8 | did -e quiz 18 }
on 1:DIALOG:quiz:edit:11:{ did -t quiz 3 | did -e quiz 8 | did -e quiz 18 }
on 1:DIALOG:quiz:sclick:16:hintbutton
on 1:DIALOG:quiz:sclick:20:{ temphide $did | finalscores }
on 1:DIALOG:quiz:sclick:15:{ temphide $did | write -dl $+ %quizline %qoptionqfile | preview }
on 1:DIALOG:quiz:sclick:7: temphide $did | scoreupdate | describe %quizchan SCORES: %quizscoretally
on 1:DIALOG:quiz:sclick:12:{ did -b quiz 13 | editscores }
on 1:DIALOG:quiz:sclick:18:{ preview | did -b quiz 8 | did -b quiz 18 }
on 1:DIALOG:quiz:sclick:14:{ temphide $did | inc %quizline 2 | preview }
on 1:DIALOG:quiz:sclick:8:{ write -l $+ %quizline %qoptionqfile $did(10) $+ $did(10,2) $+ $did(10,3) $+ $did(10,4) $+ $did(10,5) | write -l $+ $calc(%quizline + 1) %qoptionqfile $did(11) | did -b quiz 8 | did -b quiz 18 }
on 1:DIALOG:quiz:sclick:13:undo
on 1:DIALOG:quiz:sclick:17:quickload
on 1:DIALOG:quiz:sclick:37:quizsetup
on 1:DIALOG:quiz:sclick:32:temphide $did | if ($did(22)) notice $did(22) Its called lag. What you say comes up on your screen immediately, but it takes time to reach the questioner. Whoever comes up on the questioner's screen first gets the point and that is final. Please do not make a fuss over it, everyone experiences lag, do not cut and paste and do not reply to this notice.
;control
on 1:OP:%quizchan:if (($opnick == $me) && ($dialog(quiz))) { enablecontrol | did -b quiz 28 }
on 1:DEOP:%quizchan:if (($opnick == $me) && ($dialog(quiz))) { disablecontrol | did -e quiz 28 }
on 1:DIALOG:quiz:sclick:28: temphide $did | msg z op %quizchan $me
on 1:DIALOG:quiz:sclick:1:if ($gettok($did(1).seltext,1,32) != <) did -o quiz 22 1 $gettok($did(1).seltext,1,32)
on 1:DIALOG:quiz:sclick:23:set %quizreason No swearing
on 1:DIALOG:quiz:sclick:24:set %quizreason No flooding
on 1:DIALOG:quiz:sclick:25:set %quizreason No lameness or being annoying
on 1:DIALOG:quiz:sclick:26:kick %quizchan $did(22) Warning: %quizreason
on 1:DIALOG:quiz:sclick:27:{ ban %quizchan $did(22) 2 | kick %quizchan $did(22) %quizreason }
alias enablecontrol {
did -e quiz 23
did -e quiz 24
did -e quiz 25
did -e quiz 26
did -e quiz 27
}
alias disablecontrol {
did -b quiz 23
did -b quiz 24
did -b quiz 25
did -b quiz 26
did -b quiz 27
}
;------edit scores dialog
dialog editscores {
title "Edit Score Board"
size -1 -1 129 167
option dbu
list 1, 3 4 73 159, size
text "#", 2, 90 23 22 7, center
button "Done", 5, 81 144 42 18, ok
text "Nick", 6, 80 11 42 7, center
box "", 7, 80 99 44 22
box "", 8, 80 40 44 22
text "Rapid Increase", 9, 89 46 25 14, center
text "Rapid Decrease", 10, 89 105 25 14, center
button "Increase", 3, 80 62 44 20
button "Decrease", 4, 80 82 44 20
}
alias scorenick return $ial($gettok(%quizscore [ $+ [ $$1 ] ] ,$$2,32)).nick
alias editscores {
dialog -mo editscores editscores
dialog -i quiz
set %quizsc $calc(%quizscorehigh + 1)
set %quiznick 0
if (!%quizscorehigh) set %quizscorehigh 0
while (%quizsc > 0) {
dec %quizsc
set %quizt 0
while (%quizt < $numtok(%quizscore [ $+ [ %quizsc ] ] ,32)) {
inc %quizt
if ($scorenick(%quizsc,%quizt)) did -a editscores 1 %quizsc $iif(%quizsc >= 10,$iif(%quizsc >= 100,-,---),-----) $scorenick(%quizsc,%quizt) -------------------------------------- $gettok(%quizscore [ $+ [ %quizsc ] ] ,%quizt,32)
else did -a editscores 1 %quizsc $iif(%quizsc >= 10,$iif(%quizsc >= 100,-,---),-----) %quiz [ $+ [ $gettok(%quizscore [ $+ [ %quizsc ] ] ,%quizt,32) ] ] -------------------------------------- $gettok(%quizscore [ $+ [ %quizsc ] ] ,%quizt,32)
}
}
while (%quiznick < $nick(%quizchan,0)) {
inc %quiznick
if (($nick(%quizchan,%quiznick) !isin $didtok(editscores,1,32)) && ($nick(%quizchan,%quiznick) != $me) && ($nick(%quizchan,%quiznick) != Z )) { did -a editscores 1 0 ----- $nick(%quizchan,%quiznick) -------------------------------------- $address($nick(%quizchan,%quiznick),%qoptionmask) }
}
}
on 1:dialog:editscores:sclick:1:{ did -o editscores 2 1 $gettok($did(1).seltext,1,32) | did -o editscores 6 1 $gettok($did(1).seltext,3,32) | set %quizaddress $gettok($did(1).seltext,5,32) | set %quiznick $gettok($did(1).seltext,3,32) | set %quizeditline $did(1,1).sel | set %quiz [ $+ [ %quizaddress ] ] %quiznick }
on 1:dialog:editscores:sclick:0:{
if (($did(2) != $chr(35)) && ($inrect($mouse.x,$mouse.y,161,86,85,45))) { increase | .timerquick -m 0 50 increase }
if (($did(2) != $chr(35)) && ($inrect($mouse.x,$mouse.y,161,204,85,45))) { decrease | .timerquick -m 0 50 decrease }
}
on 1:dialog:editscores:uclick:0:.timerquick off
on 1:dialog:editscores:sclick:3:increase over
on 1:dialog:editscores:sclick:4:decrease
on 1:dialog:editscores:sclick:5: {
if ((%quizscorehigh >= %qoptionmax) && (%qoptionend == end)) finalscores
if ((%quizscorehigh >= %qoptionmax) && (%qoptionend == notice)) { did -i quiz 1 2 < - > | did -i quiz 1 2 < MAX SCORE REACHED > | did -i quiz 1 2 < - > }
dialog -e quiz
}
alias decrease { if ($did(editscores,2) != 0) setscore %quizaddress $did(editscores,2) $calc($did(editscores,2) - 1) %quiznick %quizeditline }
alias increase { if (($did(editscores,2) != %qoptionmax) || ($$1 == over)) setscore %quizaddress $did(editscores,2) $calc($did(editscores,2) + 1) %quiznick %quizeditline }
alias setscore {
set %quizscore [ $+ [ $$2 ] ] $remtok(%quizscore [ $+ [ $$2 ] ] ,$$1,1,32)
set %quizscore [ $+ [ $$3 ] ] $addtok(%quizscore [ $+ [ $$3 ] ] ,$$1,32)
did -o editscores 2 1 $$3
did -o editscores 1 $$5 $$3 $iif($$3 >= 10,$iif($$3 >= 100,-,---),-----) %quiznick -------------------------------------- $$1
did -c editscores 1 $$5
if ($$3 > %quizscorehigh) set %quizscorehigh $$3
}
;---- mode ----
on 1:DIALOG:quiz:sclick:38:$iif(%modequiz == normal,intromode,$iif(%modequiz == intro,helpmode,normalmode))
alias helpmode {
set %modequiz help
did -o quiz 38 1 Mode: Help
.enable #help
did -o quiz 1 1 Mode not for quizzing, Move mouse over controls
did -o quiz 1 2 Mode not for quizzing, Move mouse over controls
did -v quiz 4
did -v quiz 8
did -v quiz 14
did -v quiz 15
did -v quiz 16
did -v quiz 18
did -v quiz 22
did -v quiz 23
did -v quiz 24
did -v quiz 25
did -v quiz 26
did -v quiz 27
did -v quiz 28
did -v quiz 29
did -v quiz 32
did -v quiz 37
}
alias normalmode {
set %modequiz normal
did -o quiz 38 1 Mode: Normal
.disable #help
}
alias intromode {
set %modequiz intro
.disable #help
did -o quiz 38 1 Mode: Intro
did -h quiz 4
did -h quiz 8
did -h quiz 14
did -h quiz 15
did -h quiz 16
did -h quiz 18
did -h quiz 22
did -h quiz 23
did -h quiz 24
did -h quiz 25
did -h quiz 26
did -h quiz 27
did -h quiz 28
did -h quiz 29
did -h quiz 32
did -h quiz 37
}
#help on
on 1:DIALOG:quiz:mouse:*: did -o quiz 1 2 $read(%qoptionhelp,s,$did)
#help end
;works better if overwriting in listbox instead of hintbox, dunno why
;-------------not yet in use and other commands------------
;tug of war style scoring
alias saveoptions {
var %count 1
while (%count <= $var(%line*,0)) {
writeini quizoptions.ini Lines $remove($var(%line*,%count),$chr(37) $+ line) $var(%line*,%count).value
inc %count
}
}