; ; Cosmoquiz v1.55 beta ; ; by Cosmos (cosmos_42@yahoo.com.au) ; ; Last modified 15/04/03 ; ; Requires mIRC v5.82 or later - will not function with earlier versions ; ; Question file must consist of alternating lines of questions and answers ; with no spaces or blank lines at the end. Failure to format question ; file correctly may cause script to behave unexpectedly ; ; After loading script, type /cq to invoke dialog box ; ; Script begins here: on *:start: { .ial on if (%cq_loaded != TRUE) { ; Default options follow - change these variables to customise %cq_channel = #quiz %cq_mirc_directory = $mircdir %cq_script_name = $script %cq_toggle_scoreboard = TRUE %cq_final_format = FULL %cq_toggle_random = TRUE %cq_toggle_moderate = FALSE %cq_toggle_autoreset = TRUE %cq_toggle_qvalue = FALSE %cq_toggle_notify = TRUE %cq_toggle_multi = FALSE %cq_toggle_team = FALSE %cq_toggle_teamscores = TRUE %cq_toggle_teamsort = FALSE %cq_toggle_strictteams = FALSE %cq_toggle_autoaward = TRUE %cq_toggle_cumulative = TRUE %cq_toggle_grouped = FALSE %cq_toggle_floating = TRUE %cq_toggle_verbose = FALSE %cq_toggle_autohint = FALSE %cq_final_number = 3 %cq_qvalue = 1 %cq_penalty = 0 %cq_target = 10 %cq_hint_position = 0 %cq_multi_number = 3 %cq_multi_qvalue = 3 %cq_multi_decrease = 1 %cq_team_number = 2 ; End user customisable variables - do not touch the ones below :-) %cq_loaded = TRUE .disable #cq_answermode %cq_previewed = FALSE if ($version < 5.9) { echo 4 -a *** Sorry, this script requires mIRC v5.9 or later cq_unload } echo 4 -a *** Cosmoquiz loaded: type /cq to invoke dialog box } } alias cq_unload { ; Alias to completely unload script and all associated variables ; ; cq_unload takes no arguments if ($dialog(cq_dialog).title != $null) { dialog -x cq_dialog cq_dialog } if ($dialog(cq_dialog_answers).title != $null) { dialog -x cq_dialog_answers cq_dialog_answers } if ($dialog(cq_dialog_players).title != $null) { dialog -x cq_dialog_players cq_dialog_players } if ($dialog(cq_dialog_scores).title != $null) { dialog -x cq_dialog_scores cq_dialog_scores } if ($dialog(cq_dialog_options).title != $null) { dialog -x cq_dialog_options cq_dialog_options } echo 4 -a *** Cosmoquiz unloaded var %tounload = %cq_script_name unset %cq* unload -rs %tounload } alias cq_getactive { if (%cq_toggle_floating == TRUE) { %cq_active = $active } else { %cq_active = %cq_channel } } alias cq_scores_reset { ; Alias to reset all scores, as at the end of a round ; ; cq_scores_reset takes no arguments beep var %sure = $?!="Are you sure you want to reset scores?" if (%sure == $true) { unset %cq_player* unset %cq_hostid* unset %cq_nickid* unset %cq_total_players cq_update_players echo 4 -a *** Scores reset } } alias cq_teamscore_reset { ; Alias to reset team scores, as at the end of a round ; ; cq_teamscore_reset takes no arguments beep var %sure = $?!="Are you sure you want to reset team scores?" if (%sure == $true) { var %loopcounter = 1 while (%loopcounter <= %cq_team_number) { %cq_teams_ [ $+ [ %loopcounter ] $+ _score ] = 0 %cq_teams_ [ $+ [ %loopcounter ] $+ _rank ] = %loopcounter %cq_teamrank_ [ $+ [ %loopcounter ] ] = %loopcounter inc %loopcounter } unset %cq_team_target if ($dialog(cq_dialog_scores).title != $null) { cq_update_teams } echo 4 -a *** Team scores reset } } alias cq_loadfile { ; Alias to load in a new question file ; ; Usage /cq_loadfile - bring up dialog box to pick file to load ; /cq_loadfile filename - immediately load filename if ($exists($1) == $true) { var %tempfile = $1 } else { var %tempfile = $$dir="Please select file to open" [ [ %cq_mirc_directory ] $+ ] *.txt } if (%tempfile != $null) { %cq_file_name = %tempfile unset %cq_asked* %cq_file_lines = $lines(%cq_file_name) %cq_file_questions = $calc(%cq_file_lines / 2) %cq_asked_total = 0 %cq_pointer = 0 %cq_previewed = FALSE if (2 // %cq_file_lines) { echo 4 -a -------------------------------------- echo 4 -a Loaded file [ %cq_file_name ] echo 4 -a File contains [ %cq_file_questions ] questions echo 4 -a -------------------------------------- } else { echo 4 -a *** Sorry, [ %cq_file_name ] has an uneven number of lines! unset %cq_file* } } } alias cq_blurb { ; Provides a description of the upcoming quiz using information contained within cq variables cq_getactive if (%cq_toggle_team == TRUE) { describe $cq_channel *** $1- Team Quiz *** var %team = team var %loopcounter = 1 while (%loopcounter <= %cq_team_number) { .timer 1 %loopcounter describe %cq_active To join %cq_teams_ [ $+ [ %loopcounter ] $+ _name ] $+ , please prefix your nickname with ^ $+ %cq_teams_ [ $+ [ %loopcounter ] $+ _prefix ] inc %loopcounter } var %delay = %loopcounter } else { var %blurb = The following quiz is entitled: $1-. var %team = $null } if (%loopcounter == $null) { var %delay = 0 } if (%cq_toggle_multi == TRUE) { .timer 1 %delay describe %cq_active [ %blurb ] Each question starts at %cq_multi_qvalue point(s) and decreases by %cq_multi_decrease point(s) with each winner. Maximum of %cq_multi_number winners. First %team to %cq_target points wins! } else { .timer 1 %delay describe %cq_active [ %blurb ] Each question is worth %cq_qvalue point(s) with a penalty of %cq_penalty point(s) for each hint given. First %team to %cq_target points wins! } } alias cq_preview { ; Alias to preview next question and answer ; ; cq_preview takes no arguments if ((%cq_asked_total >= %cq_file_questions) || ($exists(%cq_file_name) != $true)) { echo 4 -a *** Sorry, you are out of questions! } else { if (%cq_toggle_random == TRUE) { %cq_pointer = $rand(1,%cq_file_questions) while (%cq_asked_ [ $+ [ %cq_pointer ] ] == TRUE) { %cq_pointer = $rand(1,%cq_file_questions) } } else { if ((%cq_pointer < 1) || (%cq_pointer >= %cq_file_questions)) { %cq_pointer = 1 } while (%cq_asked_ [ $+ [ %cq_pointer ] ] == TRUE) { inc %cq_pointer } } %cq_question_preview = $read -nl [ $+ [ $calc((%cq_pointer * 2)-1) ] ] %cq_file_name %cq_answer_preview = $read -nl [ $+ [ $calc(%cq_pointer * 2) ] ] %cq_file_name %cq_previewed = TRUE if ($dialog(cq_dialog).title == $null) { echo 4 -a Next Q : [ %cq_question_preview ] echo 4 -a Answer : [ %cq_answer_preview ] } } } alias cq_jump { ; Alias to jump to a specific question number ; ; Usage /cq_jump # where # is the question number to jump to if ($1 isnum 1 - %cq_file_questions) { if (%cq_asked_ [ $+ [ $1 ] ] != TRUE) { %cq_pointer = $1 %cq_question_preview = $read -nl [ $+ [ $calc((%cq_pointer * 2)-1) ] ] %cq_file_name %cq_answer_preview = $read -nl [ $+ [ $calc(%cq_pointer * 2) ] ] %cq_file_name %cq_previewed = TRUE if ($dialog(cq_dialog).title == $null) { echo 4 -a Next Q : [ %cq_question_preview ] echo 4 -a Answer : [ %cq_answer_preview ] } } else { echo 4 -a *** Sorry, question [ $1 ] has already been asked } } else { echo 4 -a *** Sorry, that question number is invalid } } alias cq_skip { ; Alias to skip the current question permanently ; ; cq_skip takes no arguments if ((%cq_pointer != $null) && (%cq_asked_total < %cq_file_questions)) { %cq_asked_ [ $+ [ %cq_pointer ] ] = TRUE inc %cq_asked_total %cq_previewed = FALSE cq_preview } } alias cq_ask { ; Alias to ask questions ; ; Usage /cq_ask - picks a random question from file ; /cq_ask Question - manually asks question cq_getactive if (%cq_toggle_multi == TRUE) { %cq_qvalue_current = %cq_multi_qvalue } else { %cq_qvalue_current = %cq_qvalue } %cq_multi_answered = 0 %cq_multi_scorestring = $null unset %cq_hint %cq_hint_position = 0 if ($1 == $null) { if (%cq_previewed != TRUE) { if ((%cq_asked_total >= %cq_file_questions) || ($exists(%cq_file_name) != $true)) { echo 4 -a *** Sorry, you are out of questions! } else { if (%cq_toggle_random == TRUE) { %cq_pointer = $rand(1,%cq_file_questions) while (%cq_asked_ [ $+ [ %cq_pointer ] ] == TRUE) { %cq_pointer = $rand(1,%cq_file_questions) } } else { if ((%cq_pointer < 1) || (%cq_pointer >= %cq_file_questions)) { %cq_pointer = 1 } while (%cq_asked_ [ $+ [ %cq_pointer ] ] == TRUE) { inc %cq_pointer } } %cq_question = $read -nl [ $+ [ $calc((%cq_pointer * 2)-1) ] ] %cq_file_name %cq_answer = $read -nl [ $+ [ $calc(%cq_pointer * 2) ] ] %cq_file_name } } else { %cq_question = %cq_question_preview %cq_answer = %cq_answer_preview } if (%cq_toggle_qvalue == TRUE) { var %points = ( $+ [ %cq_qvalue_current ] Pts) if (%cq_qvalue_current == 1) { %points = $left(%points, -2) $+ ) } } else { var %points = $null } describe %cq_active [ %points ] Q: [ %cq_question ] echo 4 -a Answer: [ %cq_answer ] %cq_asked_ [ $+ [ %cq_pointer ] ] = TRUE inc %cq_asked_total %cq_previewed = FALSE } else { %cq_question = $1- %cq_answer = $null describe %cq_active Q: $1- } } alias cq_repeat { ; ; Alias to repeat the current question ; ; cq_repeat takes no arguments ; cq_getactive if (%cq_toggle_qvalue == TRUE) { var %points = ( $+ [ %cq_qvalue_current ] Pts) if (%cq_qvalue_current == 1) { %points = $left(%points, -2) $+ ) } } else { var %points = $null } describe %cq_active [ %points ] Q: (Repeat) %cq_question } alias cq_hint { ; ; Alias to give players a hint ; ; Usage /cq_hint Hint ; cq_getactive dec %cq_qvalue_current %cq_penalty if (%cq_qvalue_current <= 0) { %cq_qvalue_current = 1 } if (%cq_toggle_qvalue == TRUE) { var %points = ( $+ [ %cq_qvalue_current ] Pts) if (%cq_qvalue_current == 1) { %points = $left(%points, -2) $+ ) } } else { var %points = $null } describe %cq_active [ %points ] HINT: [ $1- ] } alias cq_update_hint { did -r cq_dialog_answers 261,263 did -a cq_dialog_answers 261 %cq_hint did -a cq_dialog_answers 263 %cq_hint_position did -f cq_dialog_answers 261 did -t cq_dialog_answers 205 if (%cq_toggle_autohint == TRUE) { cq_givehint } } alias cq_givehint { cq_hint $did(cq_dialog_answers,261).text did -f cq_dialog_answers 261 did -c cq_dialog_answers 261 1 1 $did(cq_dialog_answers,261).len cq_update_answerstat } alias cq_ans { ; Alias to answer a question ; ; Usage /cq_ans - display correct answer (award to nobody) ; /cq_ans Nick - award to nick, answer from file cq_getactive if ($1 == $null) { describe %cq_active The correct answer was: [ %cq_answer ] if (%cq_toggle_scoreboard == TRUE) { cq_scores } if (%cq_toggle_teamscores == TRUE) { cq_scores_team } } elseif ($address($1, 3) == $null) { echo 4 -a *** Sorry, [ $1 ] is not in [ $active ] or has not spoken } else { if (%cq_toggle_qvalue == TRUE) { var %points = ( $+ [ %cq_qvalue_current ] Pts) if (%cq_qvalue_current == 1) { %points = $left(%points, -2) $+ ) } } else { var %points = $null } if (%cq_toggle_multi == TRUE) { %cq_multi_scorestring = [ %cq_multi_scorestring ] [ $ial($address($1, 3)).nick ] $+ < $+ [ %cq_qvalue_current ] $+ > $+ , } else { describe %cq_active < [ $ial($address($1, 3)).nick ] > !!!!! [ %points ] Answer: [ %cq_answer ] } var %lookup_player = %cq_hostid_ [ $+ [ $address($1, 3) ] ] if (%lookup_player == $null) { inc %cq_total_players %cq_player_ [ $+ [ %cq_total_players ] $+ _host ] = $address($1, 3) %cq_player_ [ $+ [ %cq_total_players ] $+ _nick ] = $ial($address($1, 3), 1).nick %cq_player_ [ $+ [ %cq_total_players ] $+ _score ] = %cq_qvalue_current %cq_hostid_ [ $+ [ $address($1, 3) ] ] = %cq_total_players %cq_nickid_ [ $+ [ $ial($address($1, 3), 1).nick ] ] = %cq_total_players } else { inc %cq_player_ [ $+ [ %lookup_player ] $+ _score ] %cq_qvalue_current %cq_player_ [ $+ [ %lookup_player ] $+ _nick ] = $ial($address($1, 3), 1).nick } if (%cq_toggle_team == TRUE) { var %winnerprefix = $left($1,2) var %winnerteam = %cq_prefix_ [ $+ [ $right(%winnerprefix,1) ] ] if (($left(%winnerprefix,1) == $chr(94)) && (%winnerteam != $null)) { inc %cq_teams_ [ $+ [ %winnerteam ] $+ _score ] %cq_qvalue_current } } if ((%cq_toggle_scoreboard == TRUE) && (%cq_toggle_multi == FALSE)) { cq_scores } if ((%cq_toggle_teamscores == TRUE) && (%cq_toggle_multi == FALSE)) { cq_scores_team } } if (%cq_toggle_multi == FALSE) { cq_check_target } } alias cq_award { cq_getactive if (%cq_multi_answered == 0) { cq_ans } else { var %loop = 1 while (%loop <= %cq_multi_answered) { var %winner = $gettok($did(cq_dialog_answers,322,%loop).text, 1, 32) %cq_qvalue_current = $gettok($did(cq_dialog_answers,322,%loop).text, 2, 32) cq_ans %winner inc %loop } describe %cq_active Answer: [ %cq_answer ] - Well done [ $left(%cq_multi_scorestring,-1) ] !!!!! } if (%cq_toggle_scoreboard == TRUE) { cq_scores } if (%cq_toggle_teamscores == TRUE) { cq_scores_team } .disable #cq_answermode dialog -s cq_dialog_answers 10000 10000 0 0 cq_update_answerstat cq_preview cq_update_preview cq_update_qfilestat did -e cq_dialog 1 did -t cq_dialog 1 did -f cq_dialog 1 cq_check_target } alias cq_check_target { if ((%cq_toggle_notify == TRUE) && (%cq_player_target != TRUE) && (%cq_toggle_team == FALSE)) { var %highscore = %cq_player_1_score var %highnick = %cq_player_1_nick if (%highscore >= %cq_target) { %cq_player_target = TRUE beep var %sure = $?!=" [ %highnick ] has reached target of [ %cq_target ] - show scores?" if (%sure == $true) { cq_scores_final } } } elseif ((%cq_toggle_notify == TRUE) && (%cq_team_target != TRUE) && (%cq_toggle_team == TRUE)) { var %loopcounter = 1 while (%loopcounter <= %cq_team_number) { var %score = %cq_teams_ [ $+ [ %loopcounter ] $+ _score ] if (%score >= %cq_target) { var %reached = TRUE var %team = %cq_teams_ [ $+ [ %loopcounter ] $+ _name ] } inc %loopcounter } if (%reached == TRUE) { %cq_team_target = TRUE beep var %sure = $?!=" [ %team ] has reached target of [ %cq_target ] - show scores?" if (%sure == $true) { cq_scores_final } } } } alias cq_toggle { ; ; Alias to toggle various options TRUE/FALSE ; ; cq_toggle takes the option to toggle as an argument ; if (%cq_toggle_ [ $+ [ $1 ] ] == TRUE) { %cq_toggle_ [ $+ [ $1 ] ] = FALSE echo 4 -a *** [ $1 ] is now set to FALSE } else { %cq_toggle_ [ $+ [ $1 ] ] = TRUE echo 4 -a *** [ $1 ] is now set to TRUE } } alias cq_scores { ; ; Alias to display simple (short-form) scoreboard ; ; cq_scores takes no arguments cq_getactive if (%cq_total_players > 0 ) { cq_sort var %loopcounter = 1 if (%cq_toggle_team == TRUE) { var %scorestring = $chr(91) $+ Individual Scores $+ $chr(93) $+ : cq_sort_teams } else { var %scorestring = Scores: } if (%cq_toggle_grouped == TRUE) { while (%loopcounter <= %cq_total_players) { %scorestring = [ %scorestring ] $chr(91) $+ %cq_player_ [ $+ [ %loopcounter ] $+ _score ] $+ $chr(93) $+ < $+ %cq_player_ [ $+ [ %loopcounter ] $+ _nick ] inc %loopcounter while (%cq_player_ [ $+ [ %loopcounter ] $+ _score ] == %cq_player_ [ $+ [ $calc(%loopcounter - 1) ] $+ _score ]) { %scorestring = [ %scorestring ] $+ , %cq_player_ [ $+ [ %loopcounter ] $+ _nick ] inc %loopcounter } %scorestring = [ %scorestring ] $+ > $+ , } } else { while (%loopcounter <= %cq_total_players) { %scorestring = [ %scorestring ] %cq_player_ [ $+ [ %loopcounter ] $+ _nick ] $+ ( $+ %cq_player_ [ $+ [ %loopcounter ] $+ _score ] $+ ), inc %loopcounter } } describe %cq_active [ $left(%scorestring, -1) ] $+ . } else { echo 4 -a *** The scoreboard is empty! } } alias cq_scores_team { ; Alias to display shortform team scoreboard cq_getactive if (%cq_toggle_team == TRUE) { var %scorestring = $chr(91) $+ Team Scores $+ $chr(93) $+ : var %loopcounter = 1 while (%loopcounter <= %cq_team_number) { if (%cq_toggle_teamsort == TRUE) { var %tempteam = %cq_teamrank_ [ $+ [ %loopcounter ] ] } else { var %tempteam = %loopcounter } %scorestring = [ %scorestring ] %cq_teams_ [ $+ [ %tempteam ] $+ _name ] ( $+ %cq_teams_ [ $+ [ %tempteam ] $+ _score ] $+ ), inc %loopcounter } describe %cq_active [ $left(%scorestring, -1) ] $+ . } } alias cq_scores_final { ; ; Alias to display final scoreboard (usually at the end of a round) ; ; cq_scores_final takes no arguments ; cq_getactive if (%cq_toggle_team == TRUE) { cq_sort cq_sort_teams var %tempteam = %cq_teamrank_1 var %winteam = %cq_teams_ [ $+ [ %tempteam ] $+ _name ] var %winscore = %cq_teams_ [ $+ [ %tempteam ] $+ _score ] describe %cq_active ---------------------------------------------------------------- describe %cq_active The winners are: ---> %winteam <--- with %winscore points!! describe %cq_active Best individual: ---> %cq_player_1_nick <--- with %cq_player_1_score points! describe %cq_active ---------------------------------------------------------------- if (%cq_toggle_autoreset == TRUE) { cq_scores_reset cq_teamscore_reset } } else { if (%cq_total_players > 0) { cq_sort if (%cq_final_format == WINNER) { describe %cq_active ---------------------------------------------------- describe %cq_active The winner is: ---> %cq_player_1_nick <--- with %cq_player_1_score points! describe %cq_active ---------------------------------------------------- } else { if (%cq_final_format == ONLY) { var %displayto = %cq_final_number } else { var %displayto = 100000 } if (($me isop $active) && (%cq_toggle_moderate == TRUE)) { mode $active +m var %mod_delay 1 } else { var %mod_delay 0 } .timer 1 %mod_delay describe %cq_active ---- FINAL SCORES ---- var %loopcounter = 0 var %placemarker = 0 var %lines = 0 while ((%loopcounter < %cq_total_players) && (%lines < %displayto)) { inc %loopcounter inc %placemarker inc %lines if (%cq_toggle_cumulative == TRUE) { %placemarker = %loopcounter } if (($right(%placemarker, 1) == 1) && (%placemarker != 11)) { var %placeid = st } elseif (($right(%placemarker, 1) == 2) && (%placemarker != 12)) { var %placeid = nd } elseif (($right(%placemarker, 1) == 3) && (%placemarker != 13)) { var %placeid = rd } else { var %placeid = th } if (%cq_player_ [ $+ [ %loopcounter ] $+ _score ] < 10) { var %leadingspace = $chr(160) } else { var %leadingspace = $null } if (%cq_player_ [ $+ [ %loopcounter ] $+ _score ] == 1) { var %points = pt $+ $chr(160) } else { var %points = pts } var %scorestring = [ %placemarker ] $+ %placeid - %leadingspace $+ [ %cq_player_ [ $+ [ %loopcounter ] $+ _score ] ] %points - [ %cq_player_ [ $+ [ %loopcounter ] $+ _nick ] ] if (%cq_toggle_cumulative == TRUE) { var %equal = $chr(160) } while (%cq_player_ [ $+ [ %loopcounter ] $+ _score ] == %cq_player_ [ $+ [ $calc(%loopcounter + 1) ] $+ _score ] ) { if (%cq_toggle_cumulative == TRUE) { var %equal $chr(61) } inc %loopcounter %scorestring = [ %scorestring ] $+ , %cq_player_ [ $+ [ %loopcounter ] $+ _nick ] } .timer 1 $calc(%lines + %mod_delay) describe %cq_active [ %equal ] $+ [ %scorestring ] } if ($me isop $active) { .timer 1 $calc(%lines + 2) mode $active -m } } if (%cq_toggle_autoreset == TRUE) { cq_scores_reset } } } else { echo 4 -a *** The scoreboard is empty! } } alias cq_player_add { ; ; Alias to add one or more points to a player's score ; ; Usage /cq_player_add nick [points] ; if (($2 != $null) && ($2 isnum 1-999)) { var %toadd = $2 } else { var %toadd = 1 } var %tempnickid = %cq_nickid_ [ $+ [ $1 ] ] if (%tempnickid == $null) { if ($address($1, 3) == $null) { if (($1 ison $active) && (%cq_player_ial_ [ $+ [ ($1) ] ] == $null ) ) { who $1 echo 4 -a *** [ $1 ] has not spoken - IAL updating, please wait... .timer 1 5 cq_player_add $1 $did(cq_dialog, 72).text .timer 1 6 cq_update_players %cq_player_ial_ [ $+ [ ($1) ] ] = TRUE } else { echo 4 -a *** Sorry, [ $1 ] is not in [ $active ] or is not responding unset %cq_player_ial* } } else { inc %cq_total_players %cq_player_ [ $+ [ %cq_total_players ] $+ _host ] = $address($1, 3) %cq_player_ [ $+ [ %cq_total_players ] $+ _nick ] = $ial($address($1, 3), 1).nick %cq_player_ [ $+ [ %cq_total_players ] $+ _score ] = %toadd %cq_hostid_ [ $+ [ $address($1, 3) ] ] = %cq_total_players %cq_nickid_ [ $+ [ $ial($address($1, 3), 1).nick ] ] = %cq_total_players cq_sort if (%cq_toggle_verbose == TRUE) { cq_getactive describe %cq_active *** %toadd point(s) added to $1 } else { echo 4 -a *** %toadd point(s) added to $1 } unset %cq_player_ial* } } else { inc %cq_player_ [ $+ [ %tempnickid ] $+ _score ] %toadd cq_sort if (%cq_toggle_verbose == TRUE) { cq_getactive describe %cq_active *** %toadd point(s) added to $1 } else { echo 4 -a *** %toadd point(s) added to $1 } } if (%cq_toggle_team == TRUE) { var %winnerprefix = $left($1,2) var %winnerteam = %cq_prefix_ [ $+ [ $right(%winnerprefix,1) ] ] if (($left(%winnerprefix,1) == $chr(94)) && (%winnerteam != $null)) { inc %cq_teams_ [ $+ [ %winnerteam ] $+ _score ] %toadd cq_sort_teams if (%cq_toggle_verbose == TRUE) { cq_getactive describe %cq_active *** %toadd point(s) added to %cq_teams_ [ $+ [ %winnerteam ] $+ _name ] } else { echo 4 -a *** %toadd point(s) added to %cq_teams_ [ $+ [ %winnerteam ] $+ _name ] } } } cq_check_target } alias cq_player_sub { ; ; Alias to substract one or more points from a player's score ; ; Will delete player from scoreboard if score decreased to 0 ; ; Usage /cq_player_sub nick [points] if (($2 != $null) && ($2 isnum 1-999)) { var %tosub = $2 } else { var %tosub = 1 } var %tempnickid = %cq_nickid_ [ $+ [ $1 ] ] if (%tempnickid == $null) { echo 4 -a *** Sorry, [ $1 ] is not on the scoreboard } else { dec %cq_player_ [ $+ [ %tempnickid ] $+ _score ] %tosub if (%cq_toggle_verbose == TRUE) { cq_getactive describe %cq_active *** %tosub point(s) subtracted $1 } else { echo 4 -a *** %tosub point(s) subtracted from $1 } if (%cq_player_ [ $+ [ %tempnickid ] $+ _score ] <= 0) { cq_player_delete $1 } cq_sort } if (%cq_toggle_team == TRUE) { var %winnerprefix = $left($1,2) var %winnerteam = %cq_prefix_ [ $+ [ $right(%winnerprefix,1) ] ] if (($left(%winnerprefix,1) == $chr(94)) && (%winnerteam != $null)) { dec %cq_teams_ [ $+ [ %winnerteam ] $+ _score ] %tosub cq_sort_teams if (%cq_toggle_verbose == TRUE) { cq_getactive describe %cq_active *** %tosub point(s) subtracted %cq_teams_ [ $+ [ %winnerteam ] $+ _name ] } else { echo 4 -a *** %tosub point(s) subtracted %cq_teams_ [ $+ [ %winnerteam ] $+ _name ] } } } } alias cq_player_set { ; ; Alias to set a player's score ; ; Usage /cq_player_set nick points ; if (($2 != $null) && ($2 isnum 1-999)) { var %toset = $2 } else { var %toset = 1 } var %tempnickid = %cq_nickid_ [ $+ [ $1 ] ] if (%tempnickid == $null) { if ($address($1, 3) == $null) { if (($1 ison $active) && (%cq_player_ial_ [ $+ [ ($1) ] ] == $null ) ) { who $1 echo 4 -a *** [ $1 ] has not spoken - IAL updating, please wait... .timer 1 5 cq_player_add $1 $did(cq_dialog, 72).text .timer 1 6 cq_update_players %cq_player_ial_ [ $+ [ ($1) ] ] = TRUE } else { echo 4 -a *** Sorry, [ $1 ] is not in [ $active ] or is not responding unset %cq_player_ial* } } else { inc %cq_total_players %cq_player_ [ $+ [ %cq_total_players ] $+ _host ] = $address($1, 3) %cq_player_ [ $+ [ %cq_total_players ] $+ _nick ] = $ial($address($1, 3), 1).nick %cq_player_ [ $+ [ %cq_total_players ] $+ _score ] = %toset %cq_hostid_ [ $+ [ $address($1, 3) ] ] = %cq_total_players %cq_nickid_ [ $+ [ $ial($address($1, 3), 1).nick ] ] = %cq_total_players cq_sort if (%cq_toggle_verbose == TRUE) { cq_getactive describe %cq_active *** $1 score is now %toset } else { echo 4 -a *** $1 score is now %toset } unset %cq_player_ial* } } else { %cq_player_ [ $+ [ %tempnickid ] $+ _score ] = %toset cq_sort if (%cq_toggle_verbose == TRUE) { cq_getactive describe %cq_active *** $1 score is now %toset } else { echo 4 -a *** $1 score is now %toset } } cq_check_target } alias cq_player_delete { ; ; Alias to delete a player from the scoreboard ; ; Usage /cq_player_delete nick ; var %tempnickid = %cq_nickid_ [ $+ [ $1 ] ] if (%tempnickid == $null) { echo 4 -a *** Sorry, [ $1 ] is not on the scoreboard } else { var %tempnick = %cq_player_ [ $+ [ %tempnickid ] $+ _nick ] var %temphost = %cq_player_ [ $+ [ %tempnickid ] $+ _host ] %cq_player_ [ $+ [ %tempnickid ] $+ _score ] = -1000 cq_sort unset %cq_player_ [ $+ [ %cq_total_players ] $+ _ ] $+ * unset %cq_hostid_ [ $+ [ %temphost ] ] unset %cq_nickid_ [ $+ [ %tempnick ] ] dec %cq_total_players if (%cq_toggle_verbose == TRUE) { cq_getactive describe %cq_active *** %tempnick removed from the scoreboard } else { echo 4 -a *** %tempnick removed from scoreboard } } } alias cq_sort { ; ; Bubblesort routine to sort scoreboard ; var %swapflag = TRUE var %loopcounter2 = 0 while (%swapflag == TRUE) { var %swapflag == FALSE var %loopcounter = 1 inc %loopcounter2 while (%loopcounter <= $calc(%cq_total_players - %loopcounter2)) { if ( %cq_player_ [ $+ [ %loopcounter ] $+ _score ] < %cq_player_ [ $+ [ $calc(%loopcounter + 1) ] $+ _score ] ) { var %tempnick1 = %cq_player_ [ $+ [ %loopcounter ] $+ _nick ] var %temphost1 = %cq_player_ [ $+ [ %loopcounter ] $+ _host ] var %tempscore1 = %cq_player_ [ $+ [ %loopcounter ] $+ _score ] var %tempid1 = %cq_hostid_ [ $+ [ %temphost1 ] ] var %tempnickid1 = %cq_nickid_ [ $+ [ %tempnick1 ] ] var %tempnick2 = %cq_player_ [ $+ [ $calc(%loopcounter + 1) ] $+ _nick ] var %temphost2 = %cq_player_ [ $+ [ $calc(%loopcounter + 1) ] $+ _host ] var %tempscore2 = %cq_player_ [ $+ [ $calc(%loopcounter + 1) ] $+ _score ] var %tempid2 = %cq_hostid_ [ $+ [ %temphost2 ] ] var %tempnickid2 = %cq_nickid_ [ $+ [ %tempnick2 ] ] %cq_player_ [ $+ [ %loopcounter ] $+ _nick ] = %tempnick2 %cq_player_ [ $+ [ %loopcounter ] $+ _host ] = %temphost2 %cq_player_ [ $+ [ %loopcounter ] $+ _score ] = %tempscore2 %cq_hostid_ [ $+ [ %temphost1 ] ] = %tempid2 %cq_nickid_ [ $+ [ %tempnick1 ] ] = %tempnickid2 %cq_player_ [ $+ [ $calc(%loopcounter + 1) ] $+ _nick ] = %tempnick1 %cq_player_ [ $+ [ $calc(%loopcounter + 1) ] $+ _host ] = %temphost1 %cq_player_ [ $+ [ $calc(%loopcounter + 1) ] $+ _score ] = %tempscore1 %cq_hostid_ [ $+ [ %temphost2 ] ] = %tempid1 %cq_nickid_ [ $+ [ %tempnick2 ] ] = %tempnickid1 %swapflag = TRUE } inc %loopcounter } } } alias cq_sort_teams { ; ; Bubblesort routine to sort team scoreboard ; var %swapflag = TRUE var %loopcounter2 = 0 while (%swapflag == TRUE) { var %swapflag == FALSE var %loopcounter = 1 inc %loopcounter2 while (%loopcounter <= $calc(%cq_team_number - %loopcounter2)) { var %tempteam1 = %cq_teamrank_ [ $+ [ %loopcounter ] ] var %tempteam2 = %cq_teamrank_ [ $+ [ $calc(%loopcounter + 1) ] ] if (%cq_teams_ [ $+ [ %tempteam1 ] $+ _score ] < %cq_teams_ [ $+ [ %tempteam2 ] $+ _score ]) { var %tempscore1 = %cq_teams_ [ $+ [ %tempteam1 ] $+ _score ] var %tempscore2 = %cq_teams_ [ $+ [ %tempteam2 ] $+ _score ] %cq_teams_ [ $+ [ %tempteam1 ] $+ _rank ] = $calc(%loopcounter + 1) %cq_teamrank_ [ $+ [ %loopcounter ] ] = %tempteam2 %cq_teams_ [ $+ [ %tempteam2 ] $+ _rank ] = %loopcounter %cq_teamrank_ [ $+ [ $calc(%loopcounter + 1) ] ] = %tempteam1 %swapflag = TRUE } inc %loopcounter } } } on *:NICK:{ ; ; Triggered when a player changes their nick ; var %temphostid = %cq_hostid_ [ $+ [ $address($newnick, 3) ] ] if (%temphostid != $null ) { %cq_player_ [ $+ [ %temphostid ] $+ _nick ] = $newnick unset %cq_nickid_ [ $+ [ $nick ] ] %cq_nickid_ [ $+ [ $newnick ] ] = %temphostid } cq_update_players } on *:JOIN:*:{ ; Triggered when someone joins the channel cq_update_players } on *:PART:*:{ ; Triggered when someone leaves the channel cq_update_players } alias cq { ; ; Alias to open/close dialog box interface ; if ($dialog(cq_dialog).table == $null ) { dialog -m cq_dialog_answers cq_dialog_answers dialog -s cq_dialog_answers 10000 10000 0 0 dialog -m cq_dialog cq_dialog } else { dialog -x cq_dialog cq_dialog if ($dialog(cq_dialog_answers).title != $null) { dialog -x cq_dialog_answers cq_dialog_answers .disable #cq_answermode } } } alias cq_update_qfilestat { ; ; Alias to update data on current question file ; did -r cq_dialog 33,35,36,38, 41 did -a cq_dialog 33 %cq_pointer did -a cq_dialog 35 %cq_file_questions did -a cq_dialog 36 $calc(%cq_file_questions - %cq_asked_total) did -a cq_dialog 38 %cq_file_name did -a cq_dialog 41 %cq_asked_total } alias cq_update_preview { ; ; Alias to update question preview on main dialog box ; did -r cq_dialog 61,62 did -a cq_dialog 61 %cq_question_preview did -a cq_dialog 62 %cq_answer_preview did -c cq_dialog 61 1 did -c cq_dialog 62 1 } alias cq_update_answerstat { ; ; Alias to update data on answer dialog box ; did -r cq_dialog_answers 232,234,262,263 did -a cq_dialog_answers 232 %cq_question did -a cq_dialog_answers 234 %cq_answer did -a cq_dialog_answers 262 %cq_qvalue_current did -a cq_dialog_answers 263 %cq_hint_position } ; Main Dialog box - invoke with /cq ; Buttons 1-30 ; Text 31-60 ; Edit 61-80 ; Box 81-100 ; Checkbox 101-120 dialog cq_dialog { title "Cosmoquiz v1.55 beta http://www.geocities.com/cosmos_42/" size 20 105 600 120 button "",1000, 0 0 0 0, ok button "",1001, 0 0 0 0, cancel box "",81, -5 68 610 10 text "Q:",47,75 79 15 15 edit %cq_question_preview,61,95 79 505 21, autohs text "A:",48,75 100 15 15 edit %cq_answer_preview,62,95 100 505 21, autohs text "Q:",32,1 45 60 20 text %cq_pointer,33, 25 45 35 20,right text "/",34, 60 45 5 20 text %cq_file_questions,35, 65 45 35 20,left text "Used: ",40, 120 45 35 20 text $calc(%cq_file_questions - %cq_asked_total),41, 165 45 35 20,left text "Left: ",42, 205 45 30 20 text $calc(%cq_file_questions - %cq_asked_total),36, 235 45 35 20,right text %cq_file_name,38, 1 59 270 15 button "A S K ",1,0 0 85 45 button "Load...",2,160 1 55 22 button "Answer",3,90 25 60 20 button "Jump...",4,90 2 60 20 button "Unload",5,220 1 55 22 button "Preview",6,1 80 60 20 button "Skip",7,1 101 60 20 button "More options..",8,160 25 115 20 box "",85, 280 -10 1 88 button "Show",11,290 22 45 25 button "Final",12,340 22 45 25 button "Reset",13,390 22 45 25 button "Blurb",15,290 51 45 22 button "More options..",14,340 51 95 22 text "Score Management",59, 305 1 140 20 box "",91, 445 -10 1 88 button "Add",21,450 23 35 25 button "Sub",22,490 23 35 25 button "Set",25,530 23 35 25 edit "1",72,570 23 30 25 button "Del",23,450 50 35 25 button "List",24,568 50 33 25 text "Player Management",60, 475 1 140 20 edit "",71, 490 50 75 25,autohs } ; Main Dialog box events on *:dialog:cq_dialog:init:0:{ ; Triggered when dialog box is opened cq_update_qfilestat did -t cq_dialog 2 did -f cq_dialog 2 } on *:dialog:cq_dialog:sclick:1001:{ ; Triggered when main dialog box is shut via (X) button if ($dialog(cq_dialog_answers).title != $null) { dialog -x cq_dialog_answers cq_dialog_answers .disable #cq_answermode } if ($dialog(cq_dialog_players).title != $null) { dialog -x cq_dialog_players cq_dialog_players } if ($dialog(cq_dialog_scores).title != $null) { dialog -x cq_dialog_scores cq_dialog_scores } } on *:dialog:cq_dialog:sclick:1:{ ; Triggered by clicking the "Ask" button cq_getactive if ((%cq_asked_total >= %cq_file_questions) || ($exists(%cq_file_name) != $true)) { echo 4 -a *** Sorry, you are out of questions! } else { if ($dialog(cq_dialog_answers).title == $null) { dialog -m cq_dialog_answers cq_dialog_answers dialog -s cq_dialog_answers 20 210 600 240 } %cq_question_preview = $did(cq_dialog, 61).text %cq_answer_preview = $did(cq_dialog, 62).text cq_ask cq_update_qfilestat did -r cq_dialog_answers 261 did -b cq_dialog 1 .enable #cq_answermode if ( $dialog(cq_dialog_answers).x == 10000 ) { dialog -s cq_dialog_answers 20 210 600 240 cq_update_answerstat did -r cq_dialog_answers 321 did -r cq_dialog_answers 322 did -f cq_dialog_answers 261 } else { cq_update_answerstat did -r cq_dialog_answers 321 did -r cq_dialog_answers 322 } } } on *:dialog:cq_dialog:sclick:2:{ ; Triggered when "Load" button is pressed cq_loadfile cq_preview cq_update_preview cq_update_qfilestat did -t cq_dialog 1 did -f cq_dialog 1 } on *:dialog:cq_dialog:sclick:3:{ ; Triggered when "Answer" button is pressed if ($dialog(cq_dialog_answers).title == $null) { dialog -m cq_dialog_answers cq_dialog_answers dialog -s cq_dialog_answers 20 210 600 240 cq_update_answerstat } else { if ( $dialog(cq_dialog_answers).x == 10000 ) { dialog -s cq_dialog_answers 20 210 600 240 did -f cq_dialog_answers 261 cq_update_answerstat } else { dialog -s cq_dialog_answers 10000 10000 0 0 } } } on *:dialog:cq_dialog:edit:61:{ ; Triggered when text is entered in "Load" edit box did -t cq_dialog 2 } on *:dialog:cq_dialog:sclick:4:{ ; Triggered when the "Jump..." button is clicked var %jumpto = $?="Jump to which question?" cq_jump %jumpto cq_update_preview cq_update_qfilestat did -f cq_dialog 1 } on *:dialog:cq_dialog:sclick:5:{ ; Triggered when "Unload Script" button is pressed beep var %sure = $?!="Are you sure you want to unload Cosmoquiz?" if (%sure == $true) { cq_unload } } on *:dialog:cq_dialog:sclick:6:{ ; Triggered when "preview" button is pressed cq_preview cq_update_preview cq_update_qfilestat } on *:dialog:cq_dialog:sclick:7:{ ; Triggered when "Skip" button is pressed cq_skip cq_update_qfilestat cq_update_preview } on *:dialog:cq_dialog:sclick:8:{ ; Triggered when "More options..." button is pressed if ($dialog(cq_dialog_options).title == $null) { dialog -m cq_dialog_options cq_dialog_options } else { dialog -x cq_dialog_options cq_dialog_options } } on *:dialog:cq_dialog:sclick:11:{ ; Triggered when "show scoreboard" button is pressed cq_scores cq_scores_team } on *:dialog:cq_dialog:sclick:12:{ ; Triggered when "Final scoreboard" button is pressed cq_scores_final } on *:dialog:cq_dialog:sclick:13:{ ; Triggered when "Reset scoreboard" button is clicked cq_scores_reset if (%cq_toggle_team == TRUE) { cq_teamscore_reset } did -f cq_dialog 1 } on *:dialog:cq_dialog:sclick:14:{ ; Triggered when "More options..." button is pressed under score management if ($dialog(cq_dialog_scores).title == $null) { dialog -m cq_dialog_scores cq_dialog_scores } else { dialog -x cq_dialog_scores cq_dialog_scores } } on *:dialog:cq_dialog:sclick:15:{ ; Triggered by clicking the "blurb" button var %blurb = $?="Enter a description for your quiz" if (%blurb != $null) { cq_blurb %blurb } } on *:dialog:cq_dialog:sclick:21:{ ; ; Triggered when "Add" button is pressed ; if ($dialog(cq_dialog_players).title != $null) { if ($did(cq_dialog_players,521).seltext != $null) { var %nick = $gettok($did(cq_dialog_players,521).seltext,3,32) cq_player_add %nick $did(cq_dialog, 72).text cq_update_players var %newid = %cq_nickid_ [ $+ [ %nick ] ] did -f cq_dialog_players 521 did -c cq_dialog_players 521 %newid } else { cq_player_add $did(cq_dialog, 71).text $did(cq_dialog, 72).text cq_update_players } } else { cq_player_add $did(cq_dialog, 71).text $did(cq_dialog, 72).text } } on *:dialog:cq_dialog:sclick:22:{ ; ; Triggered when "Sub" button is pressed ; if ($dialog(cq_dialog_players).title != $null) { if ($did(cq_dialog_players,521).seltext != $null) { var %nick = $gettok($did(cq_dialog_players,521).seltext,3,32) cq_player_sub %nick $did(cq_dialog, 72).text cq_update_players var %newid = %cq_nickid_ [ $+ [ %nick ] ] did -f cq_dialog_players 521 if (%newid != $null) { did -c cq_dialog_players 521 %newid } else { did -r cq_dialog 71 did -f cq_dialog 71 } } else { cq_player_sub $did(cq_dialog, 71).text $did(cq_dialog, 72).text cq_update_players } } else { cq_player_sub $did(cq_dialog, 71).text $did(cq_dialog, 72).text } } on *:dialog:cq_dialog:sclick:23:{ ; ; Triggered when "Del" button is pressed ; if ($dialog(cq_dialog_players).title != $null) { if ($did(cq_dialog_players,521).seltext != $null) { var %nick = $gettok($did(cq_dialog_players,521).seltext,3,32) cq_player_delete %nick cq_update_players did -r cq_dialog 71 did -f cq_dialog 71 } else { cq_player_delete $did(cq_dialog, 71).text cq_update_players } } else { cq_player_delete $did(cq_dialog, 71).text } } on *:dialog:cq_dialog:sclick:24:{ ; Triggered when "List" button is pressed if ($dialog(cq_dialog_players).title == $null) { dialog -m cq_dialog_players cq_dialog_players cq_update_players } else { dialog -x cq_dialog_players cq_dialog_players } } on *:dialog:cq_dialog:sclick:25:{ ; ; Triggered when "Set" button is pressed ; if ($dialog(cq_dialog_players).title != $null) { if ($did(cq_dialog_players,521).seltext != $null) { var %nick = $gettok($did(cq_dialog_players,521).seltext,3,32) cq_player_set %nick $did(cq_dialog, 72).text cq_update_players var %newid = %cq_nickid_ [ $+ [ %nick ] ] did -f cq_dialog_players 521 did -c cq_dialog_players 521 %newid } else { cq_player_set $did(cq_dialog, 71).text $did(cq_dialog, 72).text cq_update_players } } else { cq_player_set $did(cq_dialog, 71).text $did(cq_dialog, 72).text } } on *:dialog:cq_dialog:edit:71:{ ; Triggered when a nick is manually typed into player management if ($dialog(cq_dialog_players).title != $null) { did -u cq_dialog_players 521 } } on *:dialog:cq_dialog:edit:72:{ ; Triggered by changing points to add/subtract from nick if ($did(cq_dialog, 72).text !isnum 1-999) { did -r cq_dialog 72 } } on *:dialog:cq_dialog:sclick:111:{ ; ; Triggered when "score" checkbox is clicked ; cq_toggle scoreboard } on *:dialog:cq_dialog:sclick:112:{ ; ; Triggered when "moderate" checkbox is clicked ; cq_toggle moderate } ; Answer mode dialog box ; Buttons 201-230 ; Text 231-260 ; Edit 261-280 ; Box 281-300 ; Checkbox 301-320 ; List 321-340 dialog cq_dialog_answers { title "Answer Mode - Double click to award answer" size 20 210 600 240 button "",1500, 0 0 0 0, cancel button "",2000, 0 0 0 0, ok button "",2500, 0 0 0 0, default list 321, 0 30 430 180, vsbar list 322, 430 30 100 180 text "Q:" ,231, 5 1 15 15 text %cq_question,232, 20 1 510 15 text "A:",233, 5 15 15 15 text %cq_answer,234, 20 15 510 15 text "HINT:",235, 2 199 40 20 text "AUTO:",237, 2 222 40 20 edit %cq_hint_position, 263, 40 219 25 22 button "L-->",207, 80 219 45 20 button "Rand",208, 125 219 45 20 button "<--R",209, 170 219 45 20 button "Vowels",210, 230 219 60 20 button "Conson.",211, 290 219 60 20 button "Pattern",212, 467 219 60 20 edit "",264, 360 219 100 22, autohs edit %cq_qvalue_current, 262, 573 34 25 25 text "Value", 236, 533 37 40 25 button "Award",201, 533 64 64 23 button "Clr Nick",206, 533 90 64 23 button "Clr Ans", 202, 533 116 64 23 button "Repeat Q:",203, 533 142 64 23 button "Give A:",204, 533 168 64 23 button "HINT",205, 533 195 64 45 edit "",261,40 197 490 21, autohs } ; Answer mode dialog box events #cq_answermode off on *:text:*:%cq_active:{ if ((%cq_toggle_team == TRUE) && (%cq_toggle_strictteams == TRUE)) { var %winnerprefix = $left($nick,2) var %winnerteam = %cq_prefix_ [ $+ [ $right(%winnerprefix,1) ] ] if (($left(%winnerprefix,1) == $chr(94)) && (%winnerteam != $null)) { did -a cq_dialog_answers 321 $nick > $1- } } else { did -a cq_dialog_answers 321 $nick > $1- } } on *:dialog:cq_dialog:edit:61:{ %cq_question = $did(cq_dialog, 61).text } on *:dialog:cq_dialog:edit:62:{ %cq_answer = $did(cq_dialog, 62).text } #cq_answermode end on *:dialog:cq_dialog_answers:sclick:1500:{ ; Triggered when answer dialog box is shut via (X) button did -t cq_dialog 1 did -f cq_dialog 1 } on *:dialog:cq_dialog_answers:dclick:321:{ ; Triggered by double clicking player's response var %winner = $gettok($did(cq_dialog_answers, 321).seltext, 1, 32) if (%cq_toggle_multi == FALSE) { cq_ans %winner .disable #cq_answermode dialog -s cq_dialog_answers 10000 10000 0 0 cq_update_answerstat cq_preview cq_update_preview cq_update_qfilestat did -e cq_dialog 1 did -t cq_dialog 1 did -f cq_dialog 1 } elseif (%cq_multi_answered < %cq_multi_number) { var %loop2 = 1 var %answered = FALSE while (%loop2 <= %cq_multi_answered) { var %winner2 = $gettok($did(cq_dialog_answers,322,%loop2).text, 1, 32) if (%winner2 == %winner) { %answered = TRUE } inc %loop2 } if (%answered == FALSE) { did -a cq_dialog_answers 322 %winner %cq_qvalue_current inc %cq_multi_answered dec %cq_qvalue_current %cq_multi_decrease did -r cq_dialog_answers 262 did -a cq_dialog_answers 262 %cq_qvalue_current if ((%cq_toggle_autoaward == TRUE) && (%cq_multi_answered >= %cq_multi_number)) { cq_award } } } } on *:dialog:cq_dialog_answers:sclick:201:{ ; Triggered by clicking the "Award" button cq_award } on *:dialog:cq_dialog_answers:sclick:202:{ ; Triggered by clicking the "Clr Ans" button did -r cq_dialog_answers 321 } on *:dialog:cq_dialog_answers:sclick:203:{ ; Triggered by clicking the "Repeat Q:" button cq_repeat did -f cq_dialog_answers 261 did -c cq_dialog_answers 261 1 1 $did(cq_dialog_answers,261).len } on *:dialog:cq_dialog_answers:sclick:204:{ ; Triggered by clicking the "Give A:" button cq_ans dialog -s cq_dialog_answers 10000 10000 0 0 cq_preview cq_update_preview cq_update_qfilestat did -e cq_dialog 1 did -t cq_dialog 1 did -f cq_dialog 1 } on *:dialog:cq_dialog_answers:sclick:205:{ ; Triggered by clicking the hint button cq_givehint } on *:dialog:cq_dialog_answers:sclick:206:{ ; Triggered by clicking the "Clr Nick" button if (%cq_toggle_multi == TRUE) { did -r cq_dialog_answers 322 did -r cq_dialog_answers 262 %cq_multi_answered = 0 %cq_qvalue_current = %cq_multi_qvalue did -a cq_dialog_answers 262 %cq_qvalue_current } } on *:dialog:cq_dialog_answers:sclick:207:{ ; Triggered by clicking the "Left-->" hint button if (%cq_hint_position < 1) { var %letters = $regsub(%cq_answer,/[abcdefghijklmnopqrstuvwxyz0123456789]/gi,·,%cq_hint) } else { unset %cq_hint var %words = $gettok(%cq_answer,0,32) var %loop = 1 while (%loop <= %words) { var %current = $gettok(%cq_answer,%loop,32) var %length = $len(%current) var %lettercount = 0 var %hintpos = 0 while ((%lettercount < %cq_hint_position) && (%hintpos < %length)) { inc %hintpos if ($regex($mid(%current,%hintpos,1),/[^abcdefghijklmnopqrstuvwxyz0123456789]/gi) == 0) { inc %lettercount } } %cq_hint = %cq_hint $left(%current,%hintpos) while (%hintpos < %length) { inc %hintpos if ($regex($mid(%current,%hintpos,1),/[^abcdefghijklmnopqrstuvwxyz0123456789]/gi) > 0) { %cq_hint = %cq_hint $+ $mid(%current,%hintpos,1) } else { %cq_hint = %cq_hint $+ · } } inc %loop } } if ($right(%cq_hint,1) == .) { %cq_hint = $left(%cq_hint,-1) } inc %cq_hint_position cq_update_hint } on *:dialog:cq_dialog_answers:sclick:208:{ ; Triggered by clicking the "Rand" hint button if (%cq_hint_position == 0) { var %letters = $regsub(%cq_answer,/[abcdefghijklmnopqrstuvwxyz0123456789]/gi,·,%cq_hint) } else { var %words = $gettok(%cq_answer,0,32) var %currenthint = %cq_hint unset %cq_hint var %loop = 1 while (%loop <= %words) { var %current = $gettok(%currenthint,%loop,32) var %length = $len(%current) var %blanks = $count(%current,·) var %replaced = 0 while ((%blanks > 0) && (%replaced == 0)) { var %random = $rand(1,%length) if ($mid(%current,%random,1) == ·) { var %replaced = 1 } } var %leftbound = %random - 1 var %rightbound = %length - %random if (%leftbound > 0) { var %leftpart = $left(%current,%leftbound) } if (%rightbound > 0) { var %rightpart = $right(%current,%rightbound) } var %midpart = $mid($gettok(%cq_answer,%loop,32),%random,1) %cq_hint = %cq_hint %leftpart $+ %midpart $+ %rightpart inc %loop unset %leftpart %midpart %rightpart } } if ($right(%cq_hint,1) == .) { %cq_hint = $left(%cq_hint,-1) } inc %cq_hint_position cq_update_hint } on *:dialog:cq_dialog_answers:sclick:209:{ ; Triggered by clicking the "<--Right" hint button if (%cq_hint_position < 1) { var %letters = $regsub(%cq_answer,/[abcdefghijklmnopqrstuvwxyz0123456789]/gi,·,%cq_hint) } else { unset %cq_hint var %words = $gettok(%cq_answer,0,32) var %loop = 1 while (%loop <= %words) { var %hintpos = %cq_hint_position var %current = $gettok(%cq_answer,%loop,32) var %length = $len(%current) var %lettercount = 0 var %hintpos = 0 while ((%lettercount < %cq_hint_position) && (%hintpos < %length)) { inc %hintpos if ($regex($mid(%current,$calc(%length - %hintpos + 1),1),/[^abcdefghijklmnopqrstuvwxyz0123456789]/gi) == 0) { inc %lettercount } } var %temphint1 = $right(%current,%hintpos) while (%hintpos < %length) { inc %hintpos if ($regex($mid(%current,$calc(%length - %hintpos + 1),1),/[^abcdefghijklmnopqrstuvwxyz0123456789]/gi) > 0) { var %temphint2 = $mid(%current,$calc(%length - %hintpos + 1),1) $+ %temphint2 } else { var %temphint2 = · $+ %temphint2 } } %cq_hint = %cq_hint %temphint2 $+ %temphint1 unset %temphint2 inc %loop } } if ($right(%cq_hint,1) == .) { %cq_hint = $left(%cq_hint,-1) } inc %cq_hint_position cq_update_hint } on *:dialog:cq_dialog_answers:sclick:210:{ ; Triggered by clicking the "Vowels" hint button var %vowels = $regsub(%cq_answer,/[bcdfghjklmnpqrstvwxyz0123456789]/gi,·,%cq_hint) if ($right(%cq_hint,1) == .) { %cq_hint = $left(%cq_hint,-1) } %cq_hint = %cq_hint (Vowels) cq_update_hint } on *:dialog:cq_dialog_answers:sclick:211:{ ; Triggered by clicking the "Consonants" hint button var %conson = $regsub(%cq_answer,/[aeiou0123456789]/gi,·,%cq_hint) if ($right(%cq_hint,1) == .) { %cq_hint = $left(%cq_hint,-1) } %cq_hint = %cq_hint (Consonants) cq_update_hint } on *:dialog:cq_dialog_answers:sclick:212:{ ; Triggered by clicking the "Pattern" hint button var %pattern = /[ $+ $did(cq_dialog_answers,264).text $+ ]/gi unset %cq_hint var %words = $gettok(%cq_answer,0,32) var %loop = 1 while (%loop <= %words) { var %current = $gettok(%cq_answer,%loop,32) var %length = $len(%current) var %hintpos = 1 while (%hintpos <= %length) { if (($regex($mid(%current,%hintpos,1),/[^abcdefghijklmnopqrstuvwxyz0123456789]/gi) > 0) || ($regex($mid(%current,%hintpos,1),%pattern) > 0)) { %temphint = %temphint $+ $mid(%current,%hintpos,1) } else { %temphint = %temphint $+ · } inc %hintpos } inc %loop %cq_hint = %cq_hint %temphint unset %temphint } if ($right(%cq_hint,1) == .) { %cq_hint = $left(%cq_hint,-1) } %cq_hint = %cq_hint ( $+ $did(cq_dialog_answers,264).text $+ ) cq_update_hint } on *:dialog:cq_dialog_answers:edit:261:{ ; Triggered by entering text into hint box did -t cq_dialog_answers 205 } on *:dialog:cq_dialog_answers:edit:262:{ ; Triggered by changing value of current question if (($did(cq_dialog_answers, 262).text isnum 1-99) && ($did(cq_dialog_answers, 262).text >= %cq_penalty)) { %cq_qvalue_current = $did(cq_dialog_answers, 262).text } else { did -r cq_dialog_answers 262 } } on *:dialog:cq_dialog_answers:edit:263:{ ; Triggered by changing value of hint position if ($did(cq_dialog_answers,263).text isnum 0-99) { %cq_hint_position = $did(cq_dialog_answers,263).text } else { did -r cq_dialog_answers 263 } } on *:dialog:cq_dialog_answers:edit:264:{ ; Triggered by changing the hint pattern did -t cq_dialog_answers 212 } ; Player Management dialog box ; Buttons 401-430 ; Text 431-460 ; Edit 461-480 ; Box 481-500 ; Checkbox 501-520 ; List 521-540 dialog cq_dialog_players { title "Player List" size 468 255 152 220 button "",2900, 0 0 0 0, cancel button "",2901, 0 0 0 0, ok list 521, 3 3 147 225, vsbar } alias cq_update_players { ; Alias to update player management box ; ; cq_update_players takes no arguments ; if ($dialog(cq_dialog_players).title != $null) { did -r cq_dialog_players 521 var %loopcounter = 1 while (%loopcounter <= %cq_total_players) { var %nick = %cq_player_ [ $+ [ %loopcounter ] $+ _nick ] var %score = %cq_player_ [ $+ [ %loopcounter ] $+ _score ] if (%score < 10) { var %leadingspace = $chr(160) } else { var %leadingspace = $null } did -a cq_dialog_players 521 %leadingspace $+ %score - %nick inc %loopcounter } did -a cq_dialog_players 521 ------------------------------------------ var %inchannel = $nick($active,0) var %loopcounter = 1 while (%loopcounter <= %inchannel) { var %nickid = %cq_nickid_ [ $+ [ $nick($active,%loopcounter) ] ] if (%nickid == $null) { did -a cq_dialog_players 521 00 - $nick($active,%loopcounter) } inc %loopcounter } } } ; Player list dialog box events on *:dialog:cq_dialog_players:sclick:2900:{ ; Triggered when players dialog box is shut via (X) button did -t cq_dialog 1 did -f cq_dialog 1 } on *:dialog:cq_dialog_players:sclick:521:{ ; Triggered by clicking player management listbox did -r cq_dialog 71 did -a cq_dialog 71 %cq_player_ [ $+ [ $did(cq_dialog_players,521).sel ] $+ _nick ] } ; More options Scoreboard Management dialog box ; Buttons 600-630 ; Text 631-660 ; Edit 661-680 ; Box 681-700 ; Checkbox/radio 701-720 ; List/Combo 721-740 dialog cq_dialog_scores { title "More Scoreboard Options" size 20 255 442 220 button "",2902, 0 0 0 0, cancel button "",2903, 0 0 0 0, ok ; COLUMN 1------------------------------------- check "Show running scores",701,1 1 155 20 check "Grouped running scores",705,1 20 155 20 check "Moderate chan on final",702,1 40 155 20 check "Reset scores on final", 704, 1 60 155 20 box "",681,-10 78 320 10 edit %cq_qvalue, 661, 1 90 25 23 text "Initial value of Q:",631, 32 93 120 23 edit %cq_penalty, 662, 1 115 25 23 text "Hint penalty",632, 32 119 120 23 check "Show question value", 703, 1 142 150 20 box "",682,-10 155 165 10 check "Notify Target Score", 706, 1 170 155 20 edit %cq_target, 663, 1 193 30 23 text "Target Score",633, 35 196 120 23 box "", 683, 155 -10 2 240 ; COLUMN 2------------------------------------- radio "Display all final scores",712,160 1 150 20 radio "Display first",713,160 22 90 20 edit %cq_final_number,673, 260 20 30 23 radio "Display winner only",714,160 44 150 20 check "Cumulative ranks",715,160 65 155 20 check "Multi-winner mode",710,160 91 145 20 check "Autoaward winners",711,160 112 145 20 edit %cq_multi_qvalue, 670, 160 140 25 23 text "Initial value of Q:", 640, 195 143 115 23 edit %cq_multi_decrease, 671, 160 165 25 23 text "Decrease Q: value", 641, 195 168 115 23 edit %cq_multi_number, 672, 160 190 25 23 text "Maximum winners", 642, 195 193 115 23 box "", 684, 310 -10 2 240 ; COLUMN 3------------------------------------- check "Team Quiz Mode",716,315 1 150 20 edit %cq_team_number, 675, 315 23 20 23 text "No. of Teams",643,340 26 120 23 text "Number",644,315 57 120 23 combo 721,360 54 40 150,drop text "Name",645,315 85 45 23 edit "",676,360 83 80 23,autohs text "Prefix ^",646,315 111 45 23 edit "",677,360 109 20 23 text "Score",647,315 137 45 23 edit "",678,360 135 30 23 check "Running Scores",717,315 160 150 20 check "Sort Team Scores",718,315 180 150 20 check "Strict Team Mode",719,315 200 150 20 } alias cq_update_teams { did -r cq_dialog_scores 721 var %loopcounter = 1 while (%loopcounter <= %cq_team_number) { did -a cq_dialog_scores 721 %loopcounter inc %loopcounter } did -c cq_dialog_scores 721 1 did -r cq_dialog_scores 676,677,678 did -a cq_dialog_scores 676 %cq_teams_1_name did -a cq_dialog_scores 677 %cq_teams_1_prefix did -a cq_dialog_scores 678 %cq_teams_1_score } alias cq_reset_teams { did -r cq_dialog_scores 721 unset %cq_teams_* unset %cq_prefix_* unset %cq_teamrank_* var %loopcounter = 1 while (%loopcounter <= %cq_team_number) { did -a cq_dialog_scores 721 %loopcounter %cq_teams_ [ $+ [ %loopcounter ] $+ _name ] = Team %loopcounter %cq_teams_ [ $+ [ %loopcounter ] $+ _prefix ] = %loopcounter %cq_teams_ [ $+ [ %loopcounter ] $+ _score ] = 0 %cq_teams_ [ $+ [ %loopcounter ] $+ _rank ] = %loopcounter %cq_prefix_ [ $+ [ %loopcounter ] ] = %loopcounter %cq_teamrank_ [ $+ [ %loopcounter ] ] = %loopcounter inc %loopcounter } did -c cq_dialog_scores 721 1 did -r cq_dialog_scores 676,677,678 did -a cq_dialog_scores 676 %cq_teams_1_name did -a cq_dialog_scores 677 %cq_teams_1_prefix did -a cq_dialog_scores 678 %cq_teams_1_score } ; More Score Options Dialog Events on *:dialog:cq_dialog_scores:init:0:{ if (%cq_toggle_scoreboard == TRUE) { did -c cq_dialog_scores 701 } if (%cq_toggle_moderate == TRUE) { did -c cq_dialog_scores 702 } if (%cq_toggle_qvalue == TRUE) { did -c cq_dialog_scores 703 } if (%cq_toggle_autoreset == TRUE) { did -c cq_dialog_scores 704 } if (%cq_toggle_grouped == TRUE) { did -c cq_dialog_scores 705 } if (%cq_toggle_notify == TRUE) { did -c cq_dialog_scores 706 } if (%cq_toggle_multi == TRUE) { did -c cq_dialog_scores 710 did -b cq_dialog_scores 631,632,661,662,703 } else { did -b cq_dialog_scores 640,641,642,670,671,672,711 } if (%cq_toggle_autoaward == TRUE) { did -c cq_dialog_scores 711 } if (%cq_final_format == FULL) { did -c cq_dialog_scores 712 } if (%cq_final_format == ONLY) { did -c cq_dialog_scores 713 } if (%cq_final_format == WINNER) { did -c cq_dialog_scores 714 } if (%cq_toggle_cumulative == TRUE) { did -c cq_dialog_scores 715 } if (%cq_toggle_team == TRUE) { did -c cq_dialog_scores 716 cq_update_teams } else { did -b cq_dialog_scores 643,644,645,646,647,675,676,677,678,717,718,719,721 } if (%cq_toggle_teamscores == TRUE) { did -c cq_dialog_scores 717 } if (%cq_toggle_teamsort == TRUE) { did -c cq_dialog_scores 718 } if (%cq_toggle_strictteams == TRUE) { did -c cq_dialog_scores 719 } } on *:dialog:cq_dialog_scores:sclick:2902:{ ; Triggered when scores dialog box is shut via (X) button did -t cq_dialog 1 did -f cq_dialog 1 } on *:dialog:cq_dialog_scores:edit:661:{ ; Triggered by editing question value box if (($did(cq_dialog_scores, 661).text isnum 1-99) && ($did(cq_dialog_scores, 661).text >= %cq_penalty)) { %cq_qvalue = $did(cq_dialog_scores, 661).text } else { did -r cq_dialog_scores 661 } } on *:dialog:cq_dialog_scores:edit:662:{ ; Triggered by editing penalty box if (($did(cq_dialog_scores, 662).text isnum 0-99) && ($did(cq_dialog_scores, 662).text <= %cq_qvalue)) { %cq_penalty = $did(cq_dialog_scores, 662).text } else { did -r cq_dialog_scores 662 } } on *:dialog:cq_dialog_scores:edit:663:{ ; Triggered by editing target score if ($did(cq_dialog_scores, 663).text isnum 1-999) { %cq_target = $did(cq_dialog_scores, 663).text } else { did -r cq_dialog_scores 663 } } on *:dialog:cq_dialog_scores:edit:670:{ ; Triggered by changing multi-mode initial question value if (($did(cq_dialog_scores, 670).text isnum 1-99) && ($did(cq_dialog_scores, 670).text > $calc(%cq_multi_decrease * $calc(%cq_multi_number - 1)))) { %cq_multi_qvalue = $did(cq_dialog_scores, 670).text } else { did -r cq_dialog_scores 670 } } on *:dialog:cq_dialog_scores:edit:671:{ ; Triggered by changing multi-mode decrease question value if (($did(cq_dialog_scores, 671).text isnum 0-99) && ($calc($did(cq_dialog_scores, 671).text * $calc(%cq_multi_number - 1)) < %cq_multi_qvalue)) { %cq_multi_decrease = $did(cq_dialog_scores, 671).text } else { did -r cq_dialog_scores 671 } } on *:dialog:cq_dialog_scores:edit:672:{ ; Triggered by changing maximum players in multimode if (($did(cq_dialog_scores, 672).text isnum 0-99) && ($calc(%cq_multi_qvalue - $calc(($did(cq_dialog_scores, 672).text - 1) * %cq_multi_decrease)) > 0 )) { %cq_multi_number = $did(cq_dialog_scores, 672).text } else { did -r cq_dialog_scores 672 } } on *:dialog:cq_dialog_scores:edit:673:{ ; Triggered by changing number of places to display in final scores if ($did(cq_dialog_scores, 673).text isnum 1-999) { %cq_final_number = $did(cq_dialog_scores, 673).text } else { did -r cq_dialog_scores 673 } } on *:dialog:cq_dialog_scores:edit:675:{ ; ; Triggered when data is entered into "No. of teams" ; if (($did(cq_dialog_scores, 675).text isnum 2-9)) { %cq_team_number = $did(cq_dialog_scores, 675).text cq_reset_teams } else { did -r cq_dialog_scores 675 } } on *:dialog:cq_dialog_scores:edit:676:{ ; Triggered when data is entered into "Team name" var %team = $did(cq_dialog_scores,721).text %cq_teams_ [ $+ [ %team ] $+ _name ] = $did(cq_dialog_scores,676).text } on *:dialog:cq_dialog_scores:edit:677:{ ; Triggered when data is entered into "Team Prefix" if ($len($did(cq_dialog_scores,677).text) == 1) { var %team = $did(cq_dialog_scores,721).text var %oldprefix = %cq_teams_ [ $+ [ %team ] $+ _prefix ] %cq_teams_ [ $+ [ %team ] $+ _prefix ] = $did(cq_dialog_scores,677).text unset %cq_prefix_ [ $+ [ %oldprefix ] ] %cq_prefix_ [ $+ [ $did(cq_dialog_scores,677).text ] ] = %team } else { did -r cq_dialog_scores 677 } } on *:dialog:cq_dialog_scores:edit:678:{ ; Triggered when data is entered into "Team score" if ($did(cq_dialog_scores,678).text isnum 0-999) { var %team = $did(cq_dialog_scores,721).text %cq_teams_ [ $+ [ %team ] $+ _score ] = $did(cq_dialog_scores,678).text } else { did -r cq_dialog_scores 678 } } on *:dialog:cq_dialog_scores:sclick:701:{ ; Triggered when "show running scores" checkbox is clicked cq_toggle scoreboard } on *:dialog:cq_dialog_scores:sclick:702:{ ; Triggered when "moderate chan on final" checkbox is clicked cq_toggle moderate } on *:dialog:cq_dialog_scores:sclick:703:{ ; Triggered when "show question value" checkbox is clicked cq_toggle qvalue } on *:dialog:cq_dialog_scores:sclick:704:{ ; Triggered when "reset scores on final" checkbox is clicked cq_toggle autoreset } on *:dialog:cq_dialog_scores:sclick:705:{ ; Triggered when "grouped running scores" checkbox is clicked cq_toggle grouped } on *:dialog:cq_dialog_scores:sclick:706:{ ; Triggered when "Notify target score" checkbox is clicked cq_toggle notify } on *:dialog:cq_dialog_scores:sclick:710:{ ; Triggered when "Multi-Answer Mode" checkbox is clicked cq_toggle multi if (%cq_toggle_multi == TRUE) { did -e cq_dialog_scores 640,641,642,670,671,672,711 did -r cq_dialog_scores 662 %cq_penalty = 0 %cq_toggle_qvalue = FALSE did -u cq_dialog_scores 703 did -a cq_dialog_scores 662 0 did -b cq_dialog_scores 631,632,661,662,703 } else { did -b cq_dialog_scores 640,641,642,670,671,672,711 did -e cq_dialog_scores 631,632,661,662,703 } } on *:dialog:cq_dialog_scores:sclick:711:{ ; Triggered when "Autoaward" checkbox is clicked cq_toggle autoaward } on *:dialog:cq_dialog_scores:sclick:712:{ ; Triggered when "Full scoreboard" radio is clicked %cq_final_format = FULL echo 4 -a *** Full scoreboard will now be displayed } on *:dialog:cq_dialog_scores:sclick:713:{ ; Triggered when "Display only the first..." radio is clicked %cq_final_format = ONLY echo 4 -a *** Only the first [ %cq_final_number ] places will be displayed } on *:dialog:cq_dialog_scores:sclick:714:{ ; Triggered when "Display only the winner" radio is clicked %cq_final_format = WINNER echo 4 -a *** Only the winner will be displayed } on *:dialog:cq_dialog_scores:sclick:715:{ ; Triggered when "Cumulative ranks" checkbox is clicked cq_toggle cumulative } on *:dialog:cq_dialog_scores:sclick:716:{ ; Triggered when "Team Quiz Mode" checkbox is clicked cq_toggle team if (%cq_toggle_team == TRUE) { did -e cq_dialog_scores 643,644,645,646,647,675,676,677,678,717,718,719,721 cq_reset_teams } else { did -b cq_dialog_scores 643,644,645,646,647,675,676,677,678,717,718,719,721 } } on *:dialog:cq_dialog_scores:sclick:717:{ ; Triggered when Running team scores checkbox is clicked cq_toggle teamscores } on *:dialog:cq_dialog_scores:sclick:718:{ ; Triggered when Running team scores checkbox is clicked cq_toggle teamsort } on *:dialog:cq_dialog_scores:sclick:719:{ ; Triggered when Strict Teams checkbox is clicked cq_toggle strictteams } on *:dialog:cq_dialog_scores:sclick:721:{ ; Triggered when Team number combobox box is clicked did -r cq_dialog_scores 676,677,678 var %team = $did(cq_dialog_scores,721).seltext did -a cq_dialog_scores 676 %cq_teams_ [ $+ [ %team ] $+ _name ] did -a cq_dialog_scores 677 %cq_teams_ [ $+ [ %team ] $+ _prefix ] did -a cq_dialog_scores 678 %cq_teams_ [ $+ [ %team ] $+ _score ] } ; More script options dialog box ; Buttons 800-830 ; Text 831-860 ; Edit 861-880 ; Box 881-900 ; Checkbox/radio 901-920 ; List/Combo 921-940 dialog cq_dialog_options { title "More Script Options" size 20 255 155 220 button "",2904, 0 0 0 0, cancel button "",2905, 0 0 0 0, ok check "Random Q: order",901, 1 1 150 20 box "",881,-10 23 320 10 text "Channel",831, 1 47 70 23 edit %cq_channel, 861, 75 42 70 23, autohs check "Floating Channel",902, 1 71 150 20 box "",882,-10 90 320 10 check "Verbose management",903, 1 110 150 20 check "Immediate autohint",904, 1 130 150 20 } ; More script options dialog box events on *:dialog:cq_dialog_options:init:0:{ if (%cq_toggle_random == TRUE) { did -c cq_dialog_options 901 } if (%cq_toggle_floating == TRUE) { did -c cq_dialog_options 902 } if (%cq_toggle_verbose == TRUE) { did -c cq_dialog_options 903 } if (%cq_toggle_autohint == TRUE) { did -c cq_dialog_options 904 } } on *:dialog:cq_dialog_options:sclick:901:{ ; ; Triggered when "Random Q:" checkbox is clicked ; cq_toggle random } on *:dialog:cq_dialog_options:sclick:902:{ ; Triggered when "Floating channel" checkbox is clicked cq_toggle floating } on *:dialog:cq_dialog_options:sclick:903:{ ; Triggered when "Verbose management" checkbox is clicked cq_toggle verbose } on *:dialog:cq_dialog_options:sclick:904:{ ; Triggered when "Immediate autohint" checkbox is clicked cq_toggle autohint } on *:dialog:cq_dialog_options:edit:861:{ ; Triggered by editing "channel" edit box if ($left($did(cq_dialog_options, 861).text,1) == $chr(35)) { %cq_channel = $did(cq_dialog_options, 861).text } else { %cq_channel = #quiz did -r cq_dialog_options 861 did -a cq_dialog_options 861 %cq_channel } }