; ; Cosmoquiz v1.61 beta 2 ; ; by Cosmos (cosmos_42@yahoo.com.au) ; ; Last modified 28/03/05 ; ; Requires mIRC v5.9 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_dialog_x = 20 %cq_dialog_y = 105 %cq_dialog_offset = 173 %cq_file_format = ONLY %cq_final_format = FULL %cq_final_number = 3 %cq_guesses = 1 %cq_hint_position = 0 %cq_multi_decrease = 0 %cq_multi_number = 1 %cq_penalty = 0 %cq_aprefix = - %cq_qfile_directory = $mircdir %cq_qvalue = 1 %cq_target = 10 %cq_team_number = 2 %cq_time = 30 %cq_warning = 10 %cq_toggle_autoaward = TRUE %cq_toggle_autohint = FALSE %cq_toggle_autoreset = TRUE %cq_toggle_cumulative = TRUE %cq_toggle_floating = TRUE %cq_toggle_genre = FALSE %cq_toggle_grouped = FALSE %cq_toggle_guesses = FALSE %cq_toggle_moderate = FALSE %cq_toggle_notify = TRUE %cq_toggle_prefixed = FALSE %cq_toggle_qnumbers = FALSE %cq_toggle_random = TRUE %cq_toggle_qsave = FALSE %cq_toggle_qvalue = FALSE %cq_toggle_scoreboard = TRUE %cq_toggle_showpoints = TRUE %cq_toggle_strictteams = FALSE %cq_toggle_stripbrackets = FALSE %cq_toggle_team = FALSE %cq_toggle_teamscores = TRUE %cq_toggle_teamsort = FALSE %cq_toggle_timed = FALSE %cq_toggle_verbose = FALSE %cq_toggle_warning = FALSE ; End user customisable variables - do not touch the ones below :-) %cq_loaded = TRUE .disable #cq_answermode %cq_answermode = OFF %cq_previewed = FALSE %cq_questions_total = 0 %cq_files_total = 0 %cq_files_id = 0 %cq_files_pointer = 0 %cq_asked_total = 0 %cq_remaining_total = 0 if ($os != XP) { %cq_dialog_offset = 165 } 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_mdx { var %dll = $mircdir $+ mdx.dll return $dll(%dll,$1,$2-) } alias cq_disable_answermode { .disable #cq_answermode %cq_answermode = OFF } alias cq_enable_answermode { .enable #cq_answermode %cq_answermode = ON } alias cq_update_dialogpos { ; Alias to update position of main dialog box if ($dialog(cq_dialog).title != $null) { %cq_dialog_x = $dialog(cq_dialog).x %cq_dialog_y = $dialog(cq_dialog).y } } alias cq_close_dialogs { ; Alias to close all dialog boxes if ($dialog(cq_dialog).title != $null) { cq_update_dialogpos 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_scriptoptions).title != $null) { dialog -x cq_dialog_scriptoptions cq_dialog_scriptoptions } if ($dialog(cq_dialog_files).title != $null) { dialog -x cq_dialog_files cq_dialog_files } } alias cq_unload { ; Alias to completely unload script and all associated variables cq_close_dialogs echo 4 -a *** Cosmoquiz unloaded var %tounload = " $+ $script $+ " unset %cq_* unload -rs %tounload } alias cq_getactive { ; Alias to find out what channel you are in when you ask a question 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 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 unset %cq_question_number cq_update_players echo 4 -a *** Scores reset } } alias cq_teamscore_reset { ; Alias to reset team scores, as at the end of a round 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 var %tempfile = $$sfile(%cq_qfile_directory,Please select question file to open) var %lines = $lines(%tempfile) var %questions = $calc(%lines / 2) if (2 // %lines) { inc %cq_files_total inc %cq_files_id %cq_fileid_ [ $+ [ %cq_files_total ] ] = %cq_files_id %cq_filename_ [ $+ [ %cq_files_id ] ] = %tempfile %cq_filelines_ [ $+ [ %cq_files_id ] ] = %lines %cq_filequestions_ [ $+ [ %cq_files_id ] ] = %questions %cq_filepointer_ [ $+ [ %cq_files_id ] ] = 0 %cq_fileasked_ [ $+ [ %cq_files_id ] ] = 0 %cq_fileremaining_ [ $+ [ %cq_files_id ] ] = %questions %cq_fileenabled_ [ $+ [ %cq_files_id ] ] = TRUE inc %cq_questions_total %questions inc %cq_remaining_total %questions var %genre = $?="Please enter Question Genre or leave blank for General" if (%genre) { %cq_filegenre_ [ $+ [ %cq_files_id ] ] = %genre } else { %cq_filegenre_ [ $+ [ %cq_files_id ] ] = General } echo 4 -a ---------------------------------------------------------- echo 4 -a Loaded file [ %tempfile ] containing [ %genre ] questions echo 4 -a File contains [ %questions ] questions echo 4 -a ---------------------------------------------------------- } elseif (%tempfile != $null) { echo 4 -a *** Sorry, [ %tempfile ] has an uneven number of lines! } } 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_active *** $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_multi_number > 1) { .timer 1 %delay describe %cq_active [ %blurb ] Each question starts at %cq_qvalue point(s) and decreases by %cq_multi_decrease point(s) with each winner. 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! } if (%cq_toggle_timed == TRUE) { inc %delay if (%cq_toggle_warning == TRUE) { var %warning = with a warning given after [ %cq_warning ] seconds } .timer 1 %delay describe %cq_active You have [ %cq_time ] seconds to answer each question [ %warning ] } if (%cq_toggle_guesses == TRUE) { var %guesses = A limit of [ %cq_guesses ] attempt(s) per question applies... } if (%cq_toggle_prefixed == TRUE) { var %prefix = Please prefix your answers with [ %cq_aprefix ] } if ((%cq_toggle_prefixed == TRUE) || (%cq_toggle_guesses == TRUE)) { inc %delay .timer 1 %delay describe %cq_active [ %guesses ] [ %prefix ] } } alias cq_update_filespointer { if (%cq_remaining_total > 0) { if ((%cq_files_pointer == 0) && (%cq_files_total > 0)) { inc %cq_files_pointer } if (%cq_file_format == RANDOM) { %cq_files_pointer = $rand(1,%cq_files_total) var %converted = %cq_fileid_ [ $+ [ %cq_files_pointer ] ] while ((%cq_fileremaining_ [ $+ [ %converted ] ] < 1 ) || (%cq_fileenabled_ [ $+ [ %converted ] ] != TRUE)) { %cq_files_pointer = $rand(1,%cq_files_total) var %converted = %cq_fileid_ [ $+ [ %cq_files_pointer ] ] } } elseif (%cq_file_format == ONE) { inc %cq_files_pointer if (%cq_files_pointer > %cq_files_total) { %cq_files_pointer = 1 } } var %converted = %cq_fileid_ [ $+ [ %cq_files_pointer ] ] while ((%cq_fileremaining_ [ $+ [ %converted ] ] < 1 ) || (%cq_fileenabled_ [ $+ [ %converted ] ] != TRUE)) { inc %cq_files_pointer if (%cq_files_pointer > %cq_files_total) { %cq_files_pointer = 1 } var %converted = %cq_fileid_ [ $+ [ %cq_files_pointer ] ] } } } alias cq_preview { ; Alias to preview next question and answer if (%cq_remaining_total == 0) { echo 4 -a *** Sorry, you are out of questions! %cq_previewed = FALSE unset %cq_question_preview unset %cq_answer_preview } else { var %converted = %cq_fileid_ [ $+ [ %cq_files_pointer ] ] if (%cq_fileremaining_ [ $+ [ %converted ] ] < 1) { cq_update_filespointer } var %converted = %cq_fileid_ [ $+ [ %cq_files_pointer ] ] if (%cq_toggle_random == TRUE) { %cq_filepointer_ [ $+ [ %converted ] ] = $rand(1,%cq_filequestions_ [ $+ [ %converted ] ]) while (%cq_asked_ [ $+ [ %converted ] $+ _ [ $+ [ %cq_filepointer_ [ $+ [ %converted ] ] ] ] ] == TRUE) { %cq_filepointer_ [ $+ [ %converted ] ] = $rand(1,%cq_filequestions_ [ $+ [ %converted ] ]) } } else { inc %cq_filepointer_ [ $+ [ %converted ] ] if (%cq_filepointer_ [ $+ [ %converted ] ] > %cq_filequestions_ [ $+ [ %converted ] ]) { %cq_filepointer_ [ $+ [ %converted ] ] = 1 } while (%cq_asked_ [ $+ [ %converted ] $+ _ [ $+ [ %cq_filepointer_ [ $+ [ %converted ] ] ] ] ] == TRUE) { inc %cq_filepointer_ [ $+ [ %converted ] ] if (%cq_filepointer_ [ $+ [ %converted ] ] > %cq_filequestions_ [ $+ [ %converted ] ]) { %cq_filepointer_ [ $+ [ %converted ] ] = 1 } } } var %point = %cq_filepointer_ [ $+ [ %converted ] ] %cq_question_preview = $read -nl [ $+ [ $calc((%point * 2)-1) ] ] %cq_filename_ [ $+ [ %converted ] ] %cq_answer_preview = $read -nl [ $+ [ $calc(%point * 2) ] ] %cq_filename_ [ $+ [ %converted ] ] %cq_previewed = TRUE } } alias cq_jump { ; Alias to jump to a specific question number var %converted = %cq_fileid_ [ $+ [ %cq_files_pointer ] ] if ($1 isnum 1 - %cq_filequestions_ [ $+ [ %converted ] ]) { var %converted = %cq_fileid_ [ $+ [ %cq_files_pointer ] ] if (%cq_asked_ [ $+ [ %converted ] $+ _ [ $+ [ $1 ] ] ] != TRUE) { %cq_filepointer_ [ $+ [ %converted ] ] = $1 var %point = %cq_filepointer_ [ $+ [ %converted ] ] %cq_question_preview = $read -nl [ $+ [ $calc((%point * 2)-1) ] ] %cq_filename_ [ $+ [ %converted ] ] %cq_answer_preview = $read -nl [ $+ [ $calc(%point * 2) ] ] %cq_filename_ [ $+ [ %converted ] ] %cq_previewed = TRUE } else { echo 4 -a *** Sorry, question [ $1 ] has already been asked } } else { echo 4 -a *** Sorry, [ $1 ] is not a valid question number } } alias cq_kill { ; Alias to kill the current question permanently var %converted = %cq_fileid_ [ $+ [ %cq_files_pointer ] ] if (%cq_previewed == TRUE) { %cq_asked_ [ $+ [ %converted ] $+ _ [ $+ [ %cq_filepointer_ [ $+ [ %converted ] ] ] ] ] = TRUE inc %cq_fileasked_ [ $+ [ %converted ] ] inc %cq_asked_total dec %cq_fileremaining_ [ $+ [ %converted ] ] dec %cq_remaining_total cq_preview } } alias cq_update_qstring { 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_genre == TRUE) { var %converted = %cq_fileid_ [ $+ [ %cq_files_pointer ] ] var %genre = $chr(91) $+ %cq_filegenre_ [ $+ [ %converted ] ] $+ $chr(93) } else { var %genre = $null } if (%cq_toggle_qnumbers == TRUE) { var %qnumber = %cq_question_number } else { var %qnumber = $null } %cq_questionstring = [ %points ] Q $+ [ %qnumber ] $+ : %genre [ %cq_question ] } alias cq_ask { ; Alias to ask questions if (%cq_previewed != TRUE) { echo 4 -a *** Sorry, you are out of questions! } else { cq_getactive %cq_qvalue_current = %cq_qvalue %cq_multi_answered = 0 %cq_multi_scorestring = $null unset %cq_hint %cq_hint_position = 0 %cq_question = %cq_question_preview %cq_answer = %cq_answer_preview inc %cq_question_number cq_update_qstring if (%cq_toggle_timed == TRUE) { var %timed = $chr(40) $+ %cq_time sec $+ $chr(41) } describe %cq_active %cq_questionstring [ %timed ] inc %cq_asked_total dec %cq_remaining_total var %converted = %cq_fileid_ [ $+ [ %cq_files_pointer ] ] inc %cq_fileasked_ [ $+ [ %converted ] ] dec %cq_fileremaining_ [ $+ [ %converted ] ] %cq_asked_ [ $+ [ %converted ] $+ _ [ $+ [ %cq_filepointer_ [ $+ [ %converted ] ] ] ] ] = TRUE %cq_previewed = FALSE } } alias cq_repeat { ; Alias to repeat the current question cq_getactive cq_update_qstring if (%cq_toggle_timed == TRUE) { var %timed = $chr(40) $+ $timer(cq1).secs sec $+ $chr(41) } describe %cq_active (Repeat) %cq_questionstring [ %timed ] } alias cq_hint { ; Alias to give players a 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 } if (%cq_toggle_timed == TRUE) { var %timed = $chr(40) $+ $timer(cq1).secs sec $+ $chr(41) } describe %cq_active [ %points ] HINT: [ $1- ] [ %timed ] } 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 cq_getactive if ($1 == $null) { describe %cq_active The correct answer was: [ %cq_answer ] .timercq? off unset %cq_answered_* if ($dialog(cq_dialog_answers).title != $null) { did -r cq_dialog_answers 202 did -a cq_dialog_answers 202 Pause } 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_showpoints == TRUE) { var %pointswon = < $+ [ %cq_qvalue_current ] $+ > } else { unset %pointswon } %cq_multi_scorestring = [ %cq_multi_scorestring ] [ $ial($address($1, 3)).nick ] $+ %pointswon $+ , 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 } } } } alias cq_award { ; Alias used in multi-answer mode to award multiple winners 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) ] !!!!! .timercq? off unset %cq_answered_* if ($dialog(cq_dialog_answers).title != $null) { did -r cq_dialog_answers 202 did -a cq_dialog_answers 202 Pause } if (%cq_toggle_scoreboard == TRUE) { cq_scores } if (%cq_toggle_teamscores == TRUE) { cq_scores_team } } cq_disable_answermode dialog -s cq_dialog_answers 10000 10000 0 0 cq_update_answerstat cq_update_filespointer 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 { ; Alias to see if target score has been reached if ((%cq_toggle_notify == TRUE) && (%cq_player_target != TRUE) && (%cq_toggle_team == FALSE)) { cq_sort 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)) { cq_sort cq_sort_teams 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 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_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_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 = 10000 } 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 (%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 = [ $ord(%placemarker) ] - %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 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 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 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 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 { cq_update_dialogpos dialog -x cq_dialog cq_dialog if ($dialog(cq_dialog_answers).title != $null) { dialog -x cq_dialog_answers cq_dialog_answers cq_disable_answermode } } } alias cq_update_qfilestat { ; Alias to update data on current question file var %converted = %cq_fileid_ [ $+ [ %cq_files_pointer ] ] did -r cq_dialog 33,35,36,38,41,51 did -a cq_dialog 33 %cq_filepointer_ [ $+ [ %converted ] ] did -a cq_dialog 35 %cq_filequestions_ [ $+ [ %converted ] ] did -a cq_dialog 36 %cq_remaining_total did -a cq_dialog 38 $gettok(%cq_filename_ [ $+ [ %converted ] ],-1,92) did -a cq_dialog 41 %cq_fileasked_ [ $+ [ %converted ] ] did -a cq_dialog 51 %cq_filegenre_ [ $+ [ %converted ] ] if ($dialog(cq_dialog_files).title != $null) { cq_update_files } } 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 262,263 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 or Divider 81-100 ; Checkbox 101-120 dialog cq_dialog { title "Cosmoquiz v1.61 beta 2 http://www.geocities.com/cosmos_42/" icon $mircdir $+ cq.ico size %cq_dialog_x %cq_dialog_y 600 141 button "",1000, 0 0 0 0, ok button "",1001, 0 0 0 0, cancel text "Q:",47,75 79 15 15 edit %cq_question_preview,61,95 79 505 42, multi vsbar text "A:",48,75 121 15 15 edit %cq_answer_preview,62,95 121 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 %cq_fileasked_1,41, 165 45 35 20,left text "Left: ",42, 205 45 30 20 text %cq_fileremaining_1,36, 235 45 35 20,right text "File:",49, 1 59 35 20 text %cq_filename_1,38, 36 59 82 15 text "Genre:",50, 120 59 35 20 text %cq_filegenre_1,51, 161 59 100 15 button "A S K ",1,0 0 85 45 button "Jump...",4,90 1 60 21 button "Save Q",26,90 23 60 21 button "Files...",2,155 1 60 21 button "Unload",5,215 1 60 21 button "Preview",6,1 80 60 20 button "Next File",9,1 101 60 20 button "Kill Q:",7,1 122 60 20 button "Answer",3,155 23 60 21 button "Setup...",8,215 23 60 21 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 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 ;Dividers button "",91, 440 1 5 75 button "",85, 280 1 5 75 button "",81, 1 74 600 4 } ; Main Dialog box events on *:dialog:cq_dialog:init:0:{ ; Triggered when dialog box is opened cq_mdx SetMircVersion $version cq_mdx MarkDialog cq_dialog cq_mdx SetControlMDX 81 divider tbborder > $mircdir\ctl_gen.mdx cq_mdx SetControlMDX 85,91 divider vertical lrborder > $mircdir\ctl_gen.mdx cq_update_qfilestat did -t cq_dialog 2 did -f cq_dialog 2 if (%cq_toggle_qsave == FALSE) { did -b cq_dialog 26 } } on *:DIALOG:cq_dialog:sclick:81,85,91:{ ;Event trap to prevent moving dividers tokenize 32 $did($did) if ($1 == moving) { did -a $dname 81 restrict top 78 did -a $dname 81 restrict bottom 78 did -a $dname 85 restrict left 285 did -a $dname 85 restrict right 285 did -a $dname 91 restrict left 445 did -a $dname 91 restrict right 445 } } on *:dialog:cq_dialog:sclick:1001:{ ; Triggered when main dialog box is shut via (X) button if ($dialog(cq_dialog_answers).title != $null) { cq_update_dialogpos dialog -x cq_dialog_answers cq_dialog_answers cq_disable_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_previewed != 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 220 } cq_ask cq_update_qfilestat did -r cq_dialog_answers 261 did -b cq_dialog 1 cq_enable_answermode if (%cq_toggle_timed == TRUE) { .timercq1 1 %cq_time describe %cq_active $chr(91) $+ TIME'S UP $+ $chr(93) .timercq2 1 %cq_time cq_disable_answermode if (%cq_toggle_warning == TRUE) { var %warning = $calc(%cq_time - %cq_warning) .timercq3 1 %warning describe %cq_active $chr(91) $+ [ %cq_warning ] SECONDS $+ $chr(93) } } if ( $dialog(cq_dialog_answers).x == 10000 ) { cq_update_dialogpos dialog -s cq_dialog_answers %cq_dialog_x $calc(%cq_dialog_y + %cq_dialog_offset) 600 220 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_update_dialogpos if ($dialog(cq_dialog_files).title == $null) { dialog -m cq_dialog_files cq_dialog_files } else { dialog -x cq_dialog_files cq_dialog_files } } on *:dialog:cq_dialog:sclick:3:{ ; Triggered when "Answer" button is pressed if ($dialog(cq_dialog_answers).title == $null) { cq_update_dialogpos dialog -m cq_dialog_answers cq_dialog_answers dialog -s cq_dialog_answers %cq_dialog_x $calc(%cq_dialog_y + %cq_dialog_offset) 600 220 cq_update_answerstat } else { if ( $dialog(cq_dialog_answers).x == 10000 ) { cq_update_dialogpos dialog -s cq_dialog_answers %cq_dialog_x $calc(%cq_dialog_y + %cq_dialog_offset) 600 220 did -f cq_dialog_answers 261 cq_update_answerstat } else { dialog -s cq_dialog_answers 10000 10000 0 0 } } } 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 did -f cq_dialog 1 } on *:dialog:cq_dialog:sclick:7:{ ; Triggered when "Kill Q:" button is pressed cq_kill cq_update_qfilestat cq_update_preview did -f cq_dialog 1 } on *:dialog:cq_dialog:sclick:8:{ ; Triggered when "Setup..." button is pressed cq_update_dialogpos if ($dialog(cq_dialog_scriptoptions).title == $null) { dialog -m cq_dialog_scriptoptions cq_dialog_scriptoptions } else { dialog -x cq_dialog_scriptoptions cq_dialog_scriptoptions } } on *:dialog:cq_dialog:sclick:9:{ ; Triggered when "Next file" button is pressed if (%cq_file_format == ONLY) { inc %cq_files_pointer } cq_update_filespointer cq_preview cq_update_preview cq_update_qfilestat } 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 cq_update_dialogpos 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 cq_update_dialogpos 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:sclick:26:{ ; Triggered when "Save Question" button is clicked if ((%cq_remaining_total > 0) && (%cq_previewed == TRUE)) { var %converted = %cq_fileid_ [ $+ [ %cq_files_pointer ] ] var %pointer = %cq_filepointer_ [ $+ [ %converted ] ] var %filename = %cq_filename_ [ $+ [ %converted ] ] var %question = $calc((%pointer * 2) - 1) var %answer = $calc(%question + 1) write -l $+ %question " $+ %filename $+ " %cq_question_preview write -l $+ %answer " $+ %filename $+ " %cq_answer_preview echo 4 -a Question saved to [ %filename ] } } on *:dialog:cq_dialog:edit:61:{ ; Triggered when text is entered in "Question Preview" edit box did -t cq_dialog 1 var %lines = $did(cq_dialog, 61).lines var %x = 1 while (%x <= %lines) { var %question = %question $did(cq_dialog, 61, %x).text inc %x } %cq_question_preview = %question if (%cq_answermode == ON) { %cq_question = %question } } on *:dialog:cq_dialog:edit:62:{ ; Triggered when text is entered in "Answer Preview" edit box did -t cq_dialog 1 %cq_answer_preview = $did(cq_dialog, 62).text if (%cq_answermode == ON) { %cq_answer = $did(cq_dialog, 62).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" icon cq.ico size %cq_dialog_x $calc(%cq_dialog_y + %cq_dialog_offset) 600 220 button "",1500, 0 0 0 0, cancel button "",2000, 0 0 0 0, ok button "",2500, 0 0 0 0, default list 321, 0 5 430 178, vsbar list 322, 430 5 100 178 text "HINT:",235, 2 175 40 20 text "AUTO:",237, 2 202 40 20 edit %cq_hint_position, 263, 40 199 30 22 button "L-->",207, 80 199 45 20 button "Rand",208, 125 199 45 20 button "<--R",209, 170 199 45 20 button "Vowels",210, 230 199 60 20 button "Conson.",211, 290 199 60 20 button "Pattern",212, 467 199 60 20 edit "",264, 360 199 100 22, autohs edit %cq_qvalue_current, 262, 570 14 30 25 text "Value", 236, 530 17 40 25 button "Award",201, 533 44 64 23 button "Clr Nick",206, 533 70 64 23 button "Pause", 202, 533 96 64 23 button "Repeat Q:",203, 533 122 64 23 button "Give A:",204, 533 148 64 23 button "HINT",205, 533 175 64 45 edit "",261,40 172 490 21, autohs } ; Answer mode dialog box events #cq_answermode off on *:text:*:%cq_active:{ if ((%cq_toggle_prefixed == FALSE) || ($left($1,1) == %cq_aprefix)) { if ((%cq_toggle_guesses == FALSE) || (!%cq_answered_ [ $+ [ $nick ] ]) || (%cq_answered_ [ $+ [ $nick ] ] < %cq_guesses)) { inc %cq_answered_ [ $+ [ $nick ] ] 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- } } } } #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_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 if (%cq_qvalue_current < 1) { %cq_qvalue_current = 1 } 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 "Pause" button if (($did(cq_dialog_answers,202).text == Pause) && ($timer(cq1).secs)) { %cq_temptime1 = $timer(cq1).secs %cq_temptime2 = $timer(cq2).secs %cq_temptime3 = $timer(cq3).secs %cq_tempcmd1 = $timer(cq1).com %cq_tempcmd2 = $timer(cq2).com %cq_tempcmd3 = $timer(cq3).com .timercq? off did -r cq_dialog_answers 202 did -a cq_dialog_answers 202 Resume cq_getactive describe %cq_active $chr(91) Timer Paused $chr(93) } elseif (%cq_temptime1) { .timercq1 1 %cq_temptime1 %cq_tempcmd1 .timercq2 1 %cq_temptime2 %cq_tempcmd2 if (%cq_temptime3) { .timercq3 1 %cq_temptime3 %cq_tempcmd3 } unset %cq_temptime* unset %cq_tempcmd* did -r cq_dialog_answers 202 did -a cq_dialog_answers 202 Pause cq_getactive describe %cq_active $chr(91) Timer Resumed - [ $timer(cq1).secs ] sec remaining $chr(93) } } 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_update_filespointer 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 did -r cq_dialog_answers 322 did -r cq_dialog_answers 262 %cq_multi_answered = 0 %cq_qvalue_current = %cq_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_toggle_stripbrackets == TRUE) { var %answer var %temp = $regsub(%cq_answer,/\(.+?\)/g,,%answer) } else { var %answer = %cq_answer } if (%cq_hint_position < 1) { var %letters = $regsub(%answer,/[abcdefghijklmnopqrstuvwxyz0123456789]/gi,·,%cq_hint) } else { unset %cq_hint var %words = $gettok(%answer,0,32) var %loop = 1 while (%loop <= %words) { var %current = $gettok(%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_toggle_stripbrackets == TRUE) { var %answer var %temp = $regsub(%cq_answer,/\(.+?\)/g,,%answer) } else { var %answer = %cq_answer } if (%cq_hint_position == 0) { var %letters = $regsub(%answer,/[abcdefghijklmnopqrstuvwxyz0123456789]/gi,·,%cq_hint) } else { var %words = $gettok(%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(%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_toggle_stripbrackets == TRUE) { var %answer var %temp = $regsub(%cq_answer,/\(.+?\)/g,,%answer) } else { var %answer = %cq_answer } if (%cq_hint_position < 1) { var %letters = $regsub(%answer,/[abcdefghijklmnopqrstuvwxyz0123456789]/gi,·,%cq_hint) } else { unset %cq_hint var %words = $gettok(%answer,0,32) var %loop = 1 while (%loop <= %words) { var %hintpos = %cq_hint_position var %current = $gettok(%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 if (%cq_toggle_stripbrackets == TRUE) { var %answer var %temp = $regsub(%cq_answer,/\(.+?\)/g,,%answer) } else { var %answer = %cq_answer } var %vowels = $regsub(%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 if (%cq_toggle_stripbrackets == TRUE) { var %answer var %temp = $regsub(%cq_answer,/\(.+?\)/g,,%answer) } else { var %answer = %cq_answer } var %conson = $regsub(%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 if (%cq_toggle_stripbrackets == TRUE) { var %answer var %temp = $regsub(%cq_answer,/\(.+?\)/g,,%answer) } else { var %answer = %cq_answer } var %pattern = /[ $+ $did(cq_dialog_answers,264).text $+ ]/gi unset %cq_hint var %words = $gettok(%answer,0,32) var %loop = 1 while (%loop <= %words) { var %current = $gettok(%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-999) { %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-999) { %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" icon cq.ico size $calc(%cq_dialog_x + 448) $calc(%cq_dialog_y + %cq_dialog_offset) 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 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 var %nick = $gettok($did(cq_dialog_players,521).seltext,3,32) did -r cq_dialog 71 did -a cq_dialog 71 %nick } ; More options Scoreboard Management dialog box ; Buttons 600-630 ; Text 631-660 ; Edit 661-690 ; Box/Divider 691-700 ; Checkbox/radio 701-730 ; List/Combo 731-740 dialog cq_dialog_scores { title "More Scoreboard Options" icon cq.ico size %cq_dialog_x $calc(%cq_dialog_y + %cq_dialog_offset) 600 220 button "",2902, 0 0 0 0, cancel button "",2903, 0 0 0 0, ok ; COLUMN 1------------------------------------- check "Show running scores",701,1 1 150 20 check "Group same scores",705,1 20 150 20 check "Moderate on final",702,1 40 150 20 check "Reset on final", 704, 1 60 150 20 check "Show Q: value", 703, 1 80 150 20 check "Show Points Won", 707, 1 100 150 20 radio "Display all scores",712,1 130 145 20 radio "Display first",713,1 152 90 20 edit %cq_final_number,673,100 150 30 23 radio "Display winner only",714,1 174 145 20 check "Cumulative ranks",715,1 195 145 20 ; COLUMN 2------------------------------------- check "Autoaward winners",711,160 1 145 20 check "Notify Target", 706, 160 20 145 20 edit %cq_target, 663, 160 45 30 23 text "Target Score",633, 192 48 120 23 edit %cq_qvalue, 670, 160 85 30 23 text "Initial value of Q:", 640, 195 88 110 23 edit %cq_multi_decrease, 671, 160 110 30 23 text "Decrease Q: value", 641, 195 113 110 23 edit %cq_multi_number, 672, 160 135 30 23 text "Maximum winners", 642, 195 138 110 23 edit %cq_penalty, 662, 160 160 30 23 text "Hint penalty",632, 195 163 120 23 button "Load...",604,170 190 50 23 button "Save...",605,230 190 50 23 ; COLUMN 3------------------------------------- check "Team Quiz Mode",716,315 1 120 20 edit %cq_team_number, 675, 315 23 20 23 text "No. of Teams",643,340 26 115 23 text "Number",644,315 57 120 23 combo 731,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 140 20 check "Sort Team Scores",718,315 180 140 20 check "Strict Team Mode",719,315 200 140 20 ; COLUMN 4------------------------------------- check "Timed",720, 470 1 60 23 edit "",679, 540 1 30 23 text "sec",649,575 4 30 23 check "Warning",721, 470 25 60 23 edit "",680, 540 25 30 23 text "sec",650,575 29 30 23 check "Prefix",722, 470 55 60 23 edit "",681, 540 55 30 23 check "Guesses",723, 470 80 60 23 edit "",682, 540 80 30 23 text "Multi-Round Quiz",648,470 111 130 23 ;Dividers button "", 693,150 1 3 240 button "", 697, 458 105 210 3 button "", 691,153 75 153 3 button "", 692,1 125 150 3 button "", 694,305 1 3 240 button "", 695,455 1 3 240 } alias cq_update_morescoreoptions { did -r cq_dialog_scores 662,663,670,671,672,673,675,679,680,681,682 did -a cq_dialog_scores 662 %cq_penalty did -a cq_dialog_scores 663 %cq_target did -a cq_dialog_scores 670 %cq_qvalue did -a cq_dialog_scores 671 %cq_multi_decrease did -a cq_dialog_scores 672 %cq_multi_number did -a cq_dialog_scores 673 %cq_final_number did -a cq_dialog_scores 675 %cq_team_number did -a cq_dialog_scores 679 %cq_time did -a cq_dialog_scores 680 %cq_warning did -a cq_dialog_scores 681 %cq_aprefix did -a cq_dialog_scores 682 %cq_guesses if (%cq_toggle_scoreboard == TRUE) { did -c cq_dialog_scores 701 } else { did -u cq_dialog_scores 701 } if (%cq_toggle_moderate == TRUE) { did -c cq_dialog_scores 702 } else { did -u cq_dialog_scores 702 } if (%cq_toggle_qvalue == TRUE) { did -c cq_dialog_scores 703 } else { did -u cq_dialog_scores 703 } if (%cq_toggle_autoreset == TRUE) { did -c cq_dialog_scores 704 } else { did -u cq_dialog_scores 704 } if (%cq_toggle_grouped == TRUE) { did -c cq_dialog_scores 705 } else { did -u cq_dialog_scores 705 } if (%cq_toggle_notify == TRUE) { did -c cq_dialog_scores 706 } else { did -u cq_dialog_scores 706 } if (%cq_toggle_showpoints == TRUE) { did -c cq_dialog_scores 707 } else { did -u cq_dialog_scores 707 } if (%cq_toggle_autoaward == TRUE) { did -c cq_dialog_scores 711 } else { did -u cq_dialog_scores 711 } if (%cq_final_format == FULL) { did -c cq_dialog_scores 712 } else { did -u cq_dialog_scores 712 } if (%cq_final_format == ONLY) { did -c cq_dialog_scores 713 } else { did -u cq_dialog_scores 713 } if (%cq_final_format == WINNER) { did -c cq_dialog_scores 714 } else { did -u cq_dialog_scores 714 } if (%cq_toggle_cumulative == TRUE) { did -c cq_dialog_scores 715 } else { did -u cq_dialog_scores 715 } if (%cq_toggle_team == TRUE) { did -c cq_dialog_scores 716 did -e cq_dialog_scores 643,644,645,646,647,675,676,677,678,717,718,719,731 cq_update_teams } else { did -b cq_dialog_scores 643,644,645,646,647,675,676,677,678,717,718,719,731 did -u cq_dialog_scores 716 } if (%cq_toggle_teamscores == TRUE) { did -c cq_dialog_scores 717 } else { did -u cq_dialog_scores 717 } if (%cq_toggle_teamsort == TRUE) { did -c cq_dialog_scores 718 } else { did -u cq_dialog_scores 718 } if (%cq_toggle_strictteams == TRUE) { did -c cq_dialog_scores 719 } else { did -u cq_dialog_scores 719 } if (%cq_toggle_timed == TRUE) { did -c cq_dialog_scores 720 did -e cq_dialog_scores 679 did -e cq_dialog_scores 721 } else { did -u cq_dialog_scores 720 did -b cq_dialog_scores 679 %cq_toggle_warning = FALSE did -b cq_dialog_scores 721 } if (%cq_toggle_warning == TRUE) { did -e cq_dialog_scores 721 did -c cq_dialog_scores 721 did -e cq_dialog_scores 680 } else { did -u cq_dialog_scores 721 did -b cq_dialog_scores 680 } if (%cq_toggle_prefixed == TRUE) { did -c cq_dialog_scores 722 did -e cq_dialog_scores 681 } else { did -u cq_dialog_scores 722 did -b cq_dialog_scores 681 } if (%cq_toggle_guesses == TRUE) { did -c cq_dialog_scores 723 did -e cq_dialog_scores 682 } else { did -u cq_dialog_scores 723 did -b cq_dialog_scores 682 } } alias cq_update_teams { did -r cq_dialog_scores 731 var %loopcounter = 1 while (%loopcounter <= %cq_team_number) { did -a cq_dialog_scores 731 %loopcounter inc %loopcounter } did -c cq_dialog_scores 731 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 731 unset %cq_teams_* unset %cq_prefix_* unset %cq_teamrank_* var %loopcounter = 1 while (%loopcounter <= %cq_team_number) { did -a cq_dialog_scores 731 %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 731 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:{ cq_mdx SetMircVersion $version cq_mdx MarkDialog cq_dialog_scores cq_mdx SetControlMDX 691,692,697 divider tbborder > $mircdir\ctl_gen.mdx cq_mdx SetControlMDX 693,694,695 divider vertical lrborder > $mircdir\ctl_gen.mdx cq_update_morescoreoptions } on *:DIALOG:cq_dialog_scores:sclick:691,692,693,694,695,697:{ ;Event trap to prevent moving dividers tokenize 32 $did($did) if ($1 == moving) { did -a $dname 691 restrict top 78 did -a $dname 691 restrict bottom 78 did -a $dname 692 restrict top 125 did -a $dname 692 restrict bottom 125 did -a $dname 697 restrict top 108 did -a $dname 697 restrict bottom 108 did -a $dname 693 restrict left 153 did -a $dname 693 restrict right 153 did -a $dname 694 restrict left 307 did -a $dname 694 restrict right 307 did -a $dname 695 restrict left 457 did -a $dname 695 restrict right 457 } } 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:sclick:604:{ ; Triggered by clicking "Load" score options var %tempfile = $$sfile($mircdir,Please select scoring options file to open) if (%tempfile != $null) { var %checkfile = $read -nl 1 %tempfile var %checkstring = Cosmoquiz scoring options - do not modify! if (%checkfile == %checkstring) { var %file_lines = $lines(%tempfile) var %pointer = 1 while (%pointer < %file_lines) { inc %pointer var %next = $read -nl [ $+ [ %pointer ] ] %tempfile var %varname = $gettok(%next,1,32) var %temp = $remtok(%next,1,32) var %varname = %next set % $+ [ %varname ] %value } echo 4 -a -------------------------------------------------------------------- echo 4 -a Scoring options loaded from [ %tempfile ] echo 4 -a -------------------------------------------------------------------- cq_reset_teams cq_update_morescoreoptions } else { echo 4 -a ------------------------------------------------------------------------------------------ echo 4 -a [ %tempfile ] is not a valid Cosmoquiz scoring options file - ABORTING! echo 4 -a ------------------------------------------------------------------------------------------ } } } on *:dialog:cq_dialog_scores:sclick:605:{ ; Triggered by clicking "Save" score options var %tempfile = $?="Enter name of file to save score options to" if ($exists(%tempfile) == $true) { echo 4 -a ------------------------------- echo 4 -a Sorry, file exists - ABORTING! echo 4 -a ------------------------------- } elseif (!%tempfile) { echo 4 -a -------------------------------------------- echo 4 -a Sorry, you must enter a filename - ABORTING! echo 4 -a -------------------------------------------- } else { write -c %tempfile Cosmoquiz scoring options - do not modify! write %tempfile cq_toggle_scoreboard %cq_toggle_scoreboard write %tempfile cq_final_format %cq_final_format write %tempfile cq_toggle_moderate %cq_toggle_moderate write %tempfile cq_toggle_autoreset %cq_toggle_autoreset write %tempfile cq_toggle_qvalue %cq_toggle_qvalue write %tempfile cq_toggle_notify %cq_toggle_notify write %tempfile cq_toggle_team %cq_toggle_team write %tempfile cq_toggle_teamscores %cq_toggle_teamscores write %tempfile cq_toggle_teamsort %cq_toggle_teamsort write %tempfile cq_toggle_strictteams %cq_toggle_strictteams write %tempfile cq_toggle_autoaward %cq_toggle_autoaward write %tempfile cq_toggle_cumulative %cq_toggle_cumulative write %tempfile cq_toggle_grouped %cq_toggle_grouped write %tempfile cq_final_number %cq_final_number write %tempfile cq_qvalue %cq_qvalue write %tempfile cq_penalty %cq_penalty write %tempfile cq_target %cq_target write %tempfile cq_multi_number %cq_multi_number write %tempfile cq_multi_decrease %cq_multi_decrease write %tempfile cq_team_number %cq_team_number write %tempfile cq_toggle_timed %cq_toggle_timed write %tempfile cq_time %cq_time write %tempfile cq_toggle_warning %cq_toggle_warning write %tempfile cq_warning %cq_warning write %tempfile cq_toggle_prefixed %cq_toggle_prefixed write %tempfile cq_aprefix %cq_aprefix write %tempfile cq_toggle_guesses %cq_toggle_guesses var %numvars = $var(%cq_prefix*,0) var %pointer = 0 while (%pointer < %numvars) { inc %pointer var %currvar = $var(%cq_prefix*,%pointer) var %varname = $remove(%currvar,%) var %varvalue = %currvar write %tempfile %varname [ [ %varvalue ] ] } var %numvars = $var(%cq_teams_*_name,0) var %pointer = 0 while (%pointer < %numvars) { inc %pointer var %currvar = $var(%cq_teams_*_name,%pointer) var %varname = $remove(%currvar,%) var %varvalue = %currvar write %tempfile %varname [ [ %varvalue ] ] } var %numvars = $var(%cq_teams_*_prefix,0) var %pointer = 0 while (%pointer < %numvars) { inc %pointer var %currvar = $var(%cq_teams_*_prefix,%pointer) var %varname = $remove(%currvar,%) var %varvalue = %currvar write %tempfile %varname [ [ %varvalue ] ] } echo 4 -a -------------------------------------------------------------------- echo 4 -a Scoring options saved to [ %tempfile ] echo 4 -a -------------------------------------------------------------------- } } on *:dialog:cq_dialog_scores:edit:662:{ ; Triggered by editing penalty box if ($did(cq_dialog_scores, 662).text isnum 0-999) { %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 initial question value if ($did(cq_dialog_scores, 670).text isnum 1-999) { %cq_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-999) { %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 1-999) { %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,731).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,731).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,731).text %cq_teams_ [ $+ [ %team ] $+ _score ] = $did(cq_dialog_scores,678).text } else { did -r cq_dialog_scores 678 } } on *:dialog:cq_dialog_scores:edit:679:{ ; Triggered when data is entered into "Timed" if ($did(cq_dialog_scores,679).text isnum 1-999) { %cq_time = $did(cq_dialog_scores,679).text } else { did -r cq_dialog_scores 679 } } on *:dialog:cq_dialog_scores:edit:680:{ ; Triggered when data is entered into "Warning" if (($did(cq_dialog_scores,680).text isnum 1-999) && ($did(cq_dialog_scores,680).text < $did(cq_dialog_scores,679).text)) { %cq_warning = $did(cq_dialog_scores,680).text } else { did -r cq_dialog_scores 680 } } on *:dialog:cq_dialog_scores:edit:681:{ ; Triggered when data is entered into "Prefix" if ($len($did(cq_dialog_scores,681).text) == 1) { %cq_aprefix = $did(cq_dialog_scores,681).text } else { did -r cq_dialog_scores 681 } } on *:dialog:cq_dialog_scores:edit:682:{ ; Triggered when data is entered into "Guesses" if ($did(cq_dialog_scores,682).text isnum 1-999) { %cq_guesses = $did(cq_dialog_scores,682).text } else { did -r cq_dialog_scores 682 } } 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:707:{ ; Triggered when "show points won" checkbox is clicked cq_toggle showpoints } 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,731 cq_reset_teams } else { did -b cq_dialog_scores 643,644,645,646,647,675,676,677,678,717,718,719,731 } } 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:720:{ ; Triggered when Timed checkbox is clicked cq_toggle timed cq_update_morescoreoptions } on *:dialog:cq_dialog_scores:sclick:721:{ ; Triggered when Warning checkbox is clicked cq_toggle warning cq_update_morescoreoptions } on *:dialog:cq_dialog_scores:sclick:722:{ ; Triggered when Prefix checkbox is clicked cq_toggle prefixed cq_update_morescoreoptions } on *:dialog:cq_dialog_scores:sclick:723:{ ; Triggered when First Answer checkbox is clicked cq_toggle guesses cq_update_morescoreoptions } on *:dialog:cq_dialog_scores:sclick:731:{ ; Triggered when Team number combobox box is clicked did -r cq_dialog_scores 676,677,678 var %team = $did(cq_dialog_scores,731).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/Divider 881-900 ; Checkbox/radio 901-920 ; List/Combo 921-940 dialog cq_dialog_scriptoptions { title "More Script Options" icon cq.ico size %cq_dialog_x $calc(%cq_dialog_y + %cq_dialog_offset) 155 220 button "",2904, 0 0 0 0, cancel button "",2905, 0 0 0 0, ok button "Qfile Dir...", 802, 5 5 70 22 check "Save Q",905, 85 5 70 20 button "",881,1 35 320 3 text "Channel",831, 1 52 70 23 edit %cq_channel, 861, 75 47 70 23, autohs check "Floating Channel",902, 1 73 150 20 button "",882,1 100 320 3 check "Verbose management",903, 1 110 150 20 check "Immediate autohint",904, 1 130 150 20 check "Strip ( ) from hints",906, 1 150 150 20 text "Memory Dump",832, 1 175 150 23 button "Load...", 800, 10 192 60 22 button "Save...", 801, 83 192 60 22 } ; More script options dialog box events on *:dialog:cq_dialog_scriptoptions:init:0:{ cq_mdx SetMircVersion $version cq_mdx MarkDialog cq_dialog_scriptoptions cq_mdx SetControlMDX 881,882 divider tbborder > $mircdir\ctl_gen.mdx if (%cq_toggle_floating == TRUE) { did -c cq_dialog_scriptoptions 902 } if (%cq_toggle_verbose == TRUE) { did -c cq_dialog_scriptoptions 903 } if (%cq_toggle_autohint == TRUE) { did -c cq_dialog_scriptoptions 904 } if (%cq_toggle_qsave == TRUE) { did -c cq_dialog_scriptoptions 905 } if (%cq_toggle_stripbrackets == TRUE) { did -c cq_dialog_scriptoptions 906 } } on *:DIALOG:cq_dialog_scriptoptions:sclick:881,882:{ ;Event trap to prevent moving dividers tokenize 32 $did($did) if ($1 == moving) { did -a $dname 881 restrict top 38 did -a $dname 881 restrict bottom 38 did -a $dname 882 restrict top 103 did -a $dname 882 restrict bottom 103 } } on *:dialog:cq_dialog_scriptoptions:sclick:800:{ ; ; Triggered by clicking "Load" Script Settings Dump ; var %tempfile = $$sfile($mircdir,Please select dump file to open) if (%tempfile != $null) { var %checkfile = $read -nl 1 %tempfile var %checkstring = File created by Cosmoquiz - do not modify! if (%checkfile == %checkstring) { unset %cq_* cq_close_dialogs var %file_lines = $lines(%tempfile) var %pointer = 1 while (%pointer < %file_lines) { inc %pointer var %next = $read -nl [ $+ [ %pointer ] ] %tempfile var %varname = $gettok(%next,1,32) var %temp = $remtok(%next,1,32) var %varname = %next set % $+ [ %varname ] %value } echo 4 -a -------------------------------------------------------------------- echo 4 -a Variables loaded from [ %tempfile ] echo 4 -a -------------------------------------------------------------------- cq } else { echo 4 -a ------------------------------------------------------------------------------------- echo 4 -a [ %tempfile ] is not a valid Cosmoquiz dumpfile - ABORTING! echo 4 -a ------------------------------------------------------------------------------------- } } } on *:dialog:cq_dialog_scriptoptions:sclick:801:{ ; ; Triggered by clicking "Save" Script Settings Dump ; var %tempfile = $?="Enter name of file to dump to" if ($exists(%tempfile) == $true) { echo 4 -a ------------------------------- echo 4 -a Sorry, file exists - ABORTING! echo 4 -a ------------------------------- } elseif (!%tempfile) { echo 4 -a -------------------------------------------- echo 4 -a Sorry, you must enter a filename - ABORTING! echo 4 -a -------------------------------------------- } else { write -c %tempfile File created by Cosmoquiz - do not modify! var %numvars = $var(%cq_*,0) var %pointer = 0 while (%pointer < %numvars) { inc %pointer var %currvar = $var(%cq_*,%pointer) var %varname = $remove(%currvar,%) var %varvalue = %currvar write %tempfile %varname [ [ %varvalue ] ] } echo 4 -a -------------------------------------------------------------------- echo 4 -a Variables dumped to [ %tempfile ] echo 4 -a -------------------------------------------------------------------- } } on *:dialog:cq_dialog_scriptoptions:sclick:802:{ ; Triggered when "QFile Dir..." button is clicked var %tempdir = $$sdir(%cq_qfile_directory,Please select directory containing question files) if (%tempdir) { %cq_qfile_directory = %tempdir echo 4 -a *** Question file directory set to %tempdir } } on *:dialog:cq_dialog_scriptoptions:sclick:901:{ ; Triggered when "Random Q:" checkbox is clicked cq_toggle random } on *:dialog:cq_dialog_scriptoptions:sclick:902:{ ; Triggered when "Floating channel" checkbox is clicked cq_toggle floating } on *:dialog:cq_dialog_scriptoptions:sclick:903:{ ; Triggered when "Verbose management" checkbox is clicked cq_toggle verbose } on *:dialog:cq_dialog_scriptoptions:sclick:904:{ ; Triggered when "Immediate autohint" checkbox is clicked cq_toggle autohint } on *:dialog:cq_dialog_scriptoptions:sclick:905:{ ; Triggered when "Save Q:" checkbox is clicked cq_toggle qsave if ($dialog(cq_dialog).title != $null) { if (%cq_toggle_qsave == TRUE) { did -e cq_dialog 26 } else { did -b cq_dialog 26 } } } on *:dialog:cq_dialog_scriptoptions:sclick:906:{ ; Triggered when "Strip ( ) from hints" checkbox is clicked cq_toggle stripbrackets } on *:dialog:cq_dialog_scriptoptions:edit:861:{ ; Triggered by editing "channel" edit box if ($left($did(cq_dialog_scriptoptions, 861).text,1) == $chr(35)) { %cq_channel = $did(cq_dialog_scriptoptions, 861).text } else { %cq_channel = #quiz did -r cq_dialog_scriptoptions 861 did -a cq_dialog_scriptoptions 861 %cq_channel } } dialog cq_dialog_files { ; Buttons 2001-2030 ; Text 2031-2060 ; Edit 2061-2080 ; Box/Divider 2081-2100 ; Checkbox/radio 2101-2120 ; List 2121-2130 title "Question Files - Double click to select file to use" icon cq.ico size %cq_dialog_x $calc(%cq_dialog_y + %cq_dialog_offset) 600 220 button "",2910, 0 0 0 0, cancel button "",2911, 0 0 0 0, ok list 2121, 1 30 500 170, size extsel text "Total Files:", 2038, 5 5 70 18 text %cq_files_total, 2039, 75 5 60 18 text "Total Questions:", 2040, 150 5 85 18 text %cq_questions_total, 2041, 240 5 60 18 text "Asked:", 2042, 325 5 50 18 text %cq_asked_total, 2043, 375 5 60 18 text "Remaining:", 2044, 450 5 75 18 text %cq_remaining_total, 2045, 520 5 50 18 button "Up", 2006, 155 200 35 20 button "Down", 2007, 195 200 45 20 button "Remove", 2002, 245 200 60 20 button "Reset", 2003, 310 200 60 20 button "Enable", 2004, 375 200 60 20 button "Disable", 2005, 440 200 60 20 button "Add File...", 2001, 505 180 93 38 radio "Only Current",2101, 505 35 95 22 radio "1 from each", 2102, 505 60 95 22 radio "Random File", 2103, 505 85 95 22 check "Random Q:", 2104, 505 115 95 22 check "Show Genre", 2105, 505 135 95 22 check "Show QNums", 2106, 505 155 95 22 text "Genre:", 2032, 5 203 40 22 edit "", 2061, 50 199 100 22,autohs } alias cq_update_files { did -r cq_dialog_files 2121 var %count = 1 while (%count <= %cq_files_total) { var %converted = %cq_fileid_ [ $+ [ %count ] ] var %current = %cq_filepointer_ [ $+ [ %converted ] ] var %total = %cq_filequestions_ [ $+ [ %converted ] ] var %asked = %cq_fileasked_ [ $+ [ %converted ] ] var %remaining = %cq_fileremaining_ [ $+ [ %converted ] ] var %genre = %cq_filegenre_ [ $+ [ %converted ] ] var %file = %cq_filename_ [ $+ [ %converted ] ] if (%cq_fileenabled_ [ $+ [ %converted ] ] == TRUE) { did -a cq_dialog_files 2121 $chr(160) %count $chr(160) $+ $chr(9) $+ $chr(160) %current / %total $chr(160) $+ $chr(9) $+ $chr(160) %asked $chr(160) $+ $chr(9) $+ $chr(160) %remaining $chr(160) $+ $chr(9) $+ $chr(160) %genre $chr(160) $+ $chr(9) $+ $gettok(%file,-1,92) } else { did -a cq_dialog_files 2121 $chr(160) %count $chr(160) $+ $chr(9) $+ $chr(160) DISABLED $chr(160) $+ $chr(9) $+ $chr(160) %asked $chr(160) $+ $chr(9) $+ $chr(160) %remaining $chr(160) $+ $chr(9) $+ $chr(160) %genre $chr(160) $+ $chr(9) $+ $gettok(%file,-1,92) } inc %count } did -r cq_dialog_files 2039,2041,2043,2045,2061 did -a cq_dialog_files 2039 %cq_files_total did -a cq_dialog_files 2041 %cq_questions_total did -a cq_dialog_files 2043 %cq_asked_total did -a cq_dialog_files 2045 %cq_remaining_total var %converted = %cq_fileid_ [ $+ [ %cq_files_pointer ] ] did -c cq_dialog_files 2121 $calc(%cq_files_pointer + 1) did -a cq_dialog_files 2061 %cq_filegenre_ [ $+ [ %converted ] ] did -f cq_dialog_files 2061 } on *:dialog:cq_dialog_files:init:0:{ ; Triggered when the "Question Files" dialog box is opened cq_mdx SetMircVersion $version cq_mdx MarkDialog cq_dialog_files cq_mdx SetControlMDX 2121 ListView grid report single rowselect showsel > $mircdir\views.mdx did -i cq_dialog_files 2121 1 headerdims 50:1 100:2 50:3 50:4 115:5 115:6 did -i cq_dialog_files 2121 1 headertext +c 0 No. $+ $chr(9) $+ +c 0 Current/Total $+ $chr(9) $+ +c 0 Asked $+ $chr(9) $+ +c 0 Left $+ $chr(9) $+ +c 0 Genre $+ $chr(9) $+ +c 0 Filename if (%cq_file_format == ONLY) { did -c cq_dialog_files 2101 } if (%cq_file_format == ONE) { did -c cq_dialog_files 2102 } if (%cq_file_format == RANDOM) { did -c cq_dialog_files 2103 } if (%cq_toggle_random == TRUE) { did -c cq_dialog_files 2104 } if (%cq_toggle_genre == TRUE) { did -c cq_dialog_files 2105 } if (%cq_toggle_qnumbers == TRUE) { did -c cq_dialog_files 2106 } cq_update_files } on *:dialog:cq_dialog_files:sclick:2101:{ ; Triggered when "Only Current" radio is selected %cq_file_format = ONLY echo 4 -a *** Only current file will be used for questions } on *:dialog:cq_dialog_files:sclick:2102:{ ; Triggered when "1 from each" radio is selected %cq_file_format = ONE echo 4 -a *** One question will be taken from each file sequentially } on *:dialog:cq_dialog_files:sclick:2103:{ ; Triggered when "Random File" radio is selected %cq_file_format = RANDOM echo 4 -a *** A random file will be used for questions } on *:dialog:cq_dialog_files:sclick:2001:{ ; Triggered when "Add file..." button is clicked cq_loadfile cq_update_files did -r cq_dialog_files 2061 if (%cq_previewed != TRUE) { cq_update_filespointer cq_preview cq_update_preview } cq_update_qfilestat } on *:dialog:cq_dialog_files:sclick:2002:{ ; Triggered when "Remove" button is clicked var %selected = $calc($did(cq_dialog_files,2121,1).sel - 1)) var %converted = %cq_fileid_ [ $+ [ %selected ] ] if (%selected > 0) { dec %cq_questions_total %cq_filequestions_ [ $+ [ %converted ] ] dec %cq_remaining_total %cq_fileremaining_ [ $+ [ %converted ] ] unset %cq_fileid_ [ $+ [ %selected ] ] unset %cq_filename_ [ $+ [ %converted ] ] unset %cq_filelines_ [ $+ [ %converted ] ] unset %cq_filequestions_ [ $+ [ %converted ] ] unset %cq_filepointer_ [ $+ [ %converted ] ] unset %cq_fileasked_ [ $+ [ %converted ] ] unset %cq_fileremaining_ [ $+ [ %converted ] ] unset %cq_fileenabled_ [ $+ [ %converted ] ] unset %cq_filegenre_ [ $+ [ %converted ] ] unset %cq_asked_ [ $+ [ %converted ] $+ _ $+ * ] var %loop1 = %selected var %loop2 = %selected while (%loop1 < %cq_files_total) { inc %loop1 var %next = %cq_fileid_ [ $+ [ %loop1 ] ] %cq_fileid_ [ $+ [ %loop2 ] ] = %next unset %cq_fileid_ [ $+ [ %loop1 ] ] inc %loop2 } dec %cq_files_total if (%selected == %cq_files_pointer) { cq_update_filespointer cq_preview cq_update_preview } elseif (%selected < %cq_files_pointer) { dec %cq_files_pointer } cq_update_qfilestat did -r cq_dialog_files 2061 cq_update_files } } on *:dialog:cq_dialog_files:sclick:2003:{ ; Triggered when "Reset" button is clicked var %selected = $calc($did(cq_dialog_files,2121,1).sel - 1)) if (%selected > 0) { var %converted = %cq_fileid_ [ $+ [ %selected ] ] var %tempfile = %cq_filename_ [ $+ [ %converted ] ] var %lines = $lines(%tempfile) var %questions = $calc(%lines / 2) if (2 // %lines) { dec %cq_remaining_total %cq_fileremaining_ [ $+ [ %converted ] ] %cq_fileremaining_ [ $+ [ %converted ] ] = %questions inc %cq_remaining_total %questions dec %cq_questions_total %cq_filequestions_ [ $+ [ %converted ] ] %cq_filequestions_ [ $+ [ %converted ] ] = %questions inc %cq_questions_total %questions %cq_fileasked_ [ $+ [ %converted ] ] = 0 unset %cq_asked_ [ $+ [ %converted ] ] $+ _* %cq_filepointer_ [ $+ [ %converted ] ] = 0 %cq_filelines_ [ $+ [ %converted ] ] = %lines if (%cq_previewed != TRUE) { %cq_files_pointer = %selected cq_preview cq_update_preview } cq_update_qfilestat did -r cq_dialog_files 2061 cq_update_files } else { echo 4 -a *** Sorry, [ %tempfile ] has an uneven number of lines! } } } on *:dialog:cq_dialog_files:sclick:2004:{ ; Triggered when "Enable" button is clicked var %selected = $calc($did(cq_dialog_files,2121,1).sel - 1)) var %converted = %cq_fileid_ [ $+ [ %selected ] ] if (%cq_fileenabled_ [ $+ [ %converted ] ] == FALSE ) { %cq_fileenabled_ [ $+ [ %converted ] ] = TRUE inc %cq_questions_total %cq_filequestions_ [ $+ [ %converted ] ] inc %cq_remaining_total %cq_fileremaining_ [ $+ [ %converted ] ] if (%cq_previewed != TRUE) { %cq_files_pointer = %selected var %point = %cq_filepointer_ [ $+ [ %converted ] ] if (%point == 0) { inc %cq_filepointer_ [ $+ [ %converted ] ] inc %point } %cq_question_preview = $read -nl [ $+ [ $calc((%point * 2)-1) ] ] %cq_filename_ [ $+ [ %converted ] ] %cq_answer_preview = $read -nl [ $+ [ $calc(%point * 2) ] ] %cq_filename_ [ $+ [ %converted ] ] %cq_previewed = TRUE cq_update_preview } cq_update_qfilestat did -r cq_dialog_files 2061 } } on *:dialog:cq_dialog_files:sclick:2005:{ ; Triggered when "Disable" button is clicked var %selected = $calc($did(cq_dialog_files,2121,1).sel - 1)) var %converted = %cq_fileid_ [ $+ [ %selected ] ] if (%cq_fileenabled_ [ $+ [ %converted ] ] == TRUE ) { %cq_fileenabled_ [ $+ [ %converted ] ] = FALSE dec %cq_questions_total %cq_filequestions_ [ $+ [ %converted ] ] dec %cq_remaining_total %cq_fileremaining_ [ $+ [ %converted ] ] if (%cq_files_pointer == %selected) { cq_update_filespointer cq_preview cq_update_preview } cq_update_qfilestat did -r cq_dialog_files 2061 } } on *:dialog:cq_dialog_files:sclick:2006:{ ; Triggered when "UP" button is clicked var %selected = $calc($did(cq_dialog_files,2121,1).sel - 1)) var %converted = %cq_fileid_ [ $+ [ %selected ] ] if (%selected > 1) { var %before = $calc(%selected - 1) var %convertedbefore = %cq_fileid_ [ $+ [ %before ] ] %cq_fileid_ [ $+ [ %before ] ] = %converted %cq_fileid_ [ $+ [ %selected ] ] = %convertedbefore cq_update_files did -c cq_dialog_files 2121 $calc(%before + 1) } } on *:dialog:cq_dialog_files:sclick:2007:{ ; Triggered when "DOWN" button is clicked var %selected = $calc($did(cq_dialog_files,2121,1).sel - 1)) var %converted = %cq_fileid_ [ $+ [ %selected ] ] if (%selected < %cq_files_total) { var %after = $calc(%selected + 1) var %convertedafter = %cq_fileid_ [ $+ [ %after ] ] %cq_fileid_ [ $+ [ %after ] ] = %converted %cq_fileid_ [ $+ [ %selected ] ] = %convertedafter cq_update_files did -c cq_dialog_files 2121 $calc(%after + 1) } } on *:dialog:cq_dialog_files:edit:2061:{ ; Triggered when "Genre" editbox is changed var %selected = $calc($did(cq_dialog_files,2121,1).sel - 1)) var %converted = %cq_fileid_ [ $+ [ %selected ] ] %cq_filegenre_ [ $+ [ %converted ] ] = $did(cq_dialog_files,2061).text if ($right($did(cq_dialog_files,2061).text,1) == $chr(32)) { var %space = $chr(160) } cq_update_files did -r cq_dialog_files 2061 did -a cq_dialog_files 2061 %cq_filegenre_ [ $+ [ %converted ] ] $+ %space did -c cq_dialog_files 2121 $calc(%selected + 1) } on *:dialog:cq_dialog_files:sclick:2104:{ ; Triggered when "Random" checkbox is clicked cq_toggle random } on *:dialog:cq_dialog_files:sclick:2105:{ ; Triggered when "Genre" checkbox is clicked cq_toggle genre } on *:dialog:cq_dialog_files:sclick:2106:{ ; Triggered when "Question Numbers" checkbox is clicked cq_toggle qnumbers } on *:dialog:cq_dialog_files:sclick:2121:{ ; Triggered when entry in files listbox is single clicked var %selected = $$calc($did(cq_dialog_files,2121,1).sel - 1)) var %converted = %cq_fileid_ [ $+ [ %selected ] ] did -r cq_dialog_files 2061 did -a cq_dialog_files 2061 %cq_filegenre_ [ $+ [ %converted ] ] did -f cq_dialog_files 2061 } on *:dialog:cq_dialog_files:dclick:2121:{ ; Triggered when entry in files listbox is double clicked var %selected = $calc($did(cq_dialog_files,2121,1).sel - 1)) var %converted = %cq_fileid_ [ $+ [ %selected ] ] if ((%cq_fileremaining_ [ $+ [ %converted ] ] > 0) && (%cq_fileenabled_ [ $+ [ %converted ] ] == TRUE)) { %cq_files_pointer = %selected echo 4 -a *** %cq_filename_ [ $+ [ %converted ] ] is now the active file var %point = %cq_filepointer_ [ $+ [ %converted ] ] if (%point == 0) { inc %cq_filepointer_ [ $+ [ %converted ] ] inc %point } %cq_question_preview = $read -nl [ $+ [ $calc((%point * 2)-1) ] ] %cq_filename_ [ $+ [ %converted ] ] %cq_answer_preview = $read -nl [ $+ [ $calc(%point * 2) ] ] %cq_filename_ [ $+ [ %converted ] ] %cq_previewed = TRUE cq_update_preview cq_update_qfilestat did -r cq_dialog_files 2061 did -a cq_dialog_files 2061 %cq_filegenre_ [ $+ [ %converted ] ] did -c cq_dialog_files 2121 $calc(%selected + 1) } else { echo 4 -a *** Sorry, %cq_filename_ [ $+ [ %converted ] ] has no files or is disabled } }