; ; Cosmoquiz v1.62 beta 5 ; ; by Cosmos (cosmos_42@yahoo.com.au) ; ; Last modified 10/01/06 ; ; 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 how the script operates when first loaded %cq_advert = Cosmoquiz v1.62 beta 5 - http://www.geocities.com/cosmos_42 %cq_advertdelay = 2 %cq_advertmode = OFF %cq_aprefix = - %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_hintcharacter = · %cq_multi_decrease = 1 %cq_multi_number = 3 %cq_penalty = 1 %cq_qfile_directory = $mircdir %cq_qnumtarget = 50 %cq_qvalue = 3 %cq_randmin = 1 %cq_randmax = 5 %cq_target = 30 %cq_target_rounds = 3 %cq_team_number = 2 %cq_time = 30 %cq_warning = 10 %cq_toggle_allowsave = FALSE %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_multiround = FALSE %cq_toggle_notify = TRUE %cq_toggle_notifymulti = TRUE %cq_toggle_notifyqnum = TRUE %cq_toggle_prefixed = FALSE %cq_toggle_privmsg = FALSE %cq_toggle_qnumbers = FALSE %cq_toggle_random = TRUE %cq_toggle_randpoints = FALSE %cq_toggle_roundscores = TRUE %cq_toggle_qvalue = FALSE %cq_toggle_scoreboard = TRUE %cq_toggle_showpattern = FALSE %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 .disable #cq_privanswermode %cq_answermode = OFF %cq_previewed = FALSE %cq_hint_position = 0 %cq_questions_total = 0 %cq_files_total = 0 %cq_files_id = 0 %cq_files_pointer = 0 %cq_asked_total = 0 %cq_remaining_total = 0 %cq_round_number = 1 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 .disable #cq_privanswermode %cq_answermode = OFF } alias cq_enable_answermode { if (%cq_toggle_privmsg == TRUE) { .enable #cq_privanswermode } else { .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 = $?!="Reset scores for this round?" if (%sure == $true) { if (%cq_toggle_multiround == TRUE) { if ((%cq_round_number == %cq_target_rounds) && (%cq_toggle_notifymulti == TRUE) && (%cq_total_multi != TRUE)) { beep var %sure2 = $?!="Target of [ %cq_target_rounds ] rounds reached - show leaderboards?" if (%sure2 == $true) { if (%cq_toggle_team == TRUE) { beep var %sure3 = $?!="Show TEAM leaderboard?" if (%sure3 == $true) { cq_scores_multiround_team } beep var %sure4 = $?!="Show INDIVIDUAL leaderboard?" if (%sure4 == $true) { cq_scores_multiround individual } } else { cq_scores_multiround } cq_scores_reset_multi } else { inc %cq_round_number %cq_total_multi = TRUE } } else { if ((%cq_toggle_notifymulti == TRUE) && (%cq_total_multi != TRUE)) { if (%cq_toggle_team == TRUE) { beep var %sure3 = $?!="Show TEAM leaderboard?" if (%sure3 == $true) { cq_scores_multiround_team } beep var %sure4 = $?!="Show INDIVIDUAL leaderboard?" if (%sure4 == $true) { cq_scores_multiround individual } } elseif (%cq_round_number > 1) { beep var %sure5 = $?!="Show leaderboard?" if (%sure5 == $true) { cq_scores_multiround } } } inc %cq_round_number } } elseif (%cq_round_number == 1) { unset %cq_host2id* unset %cq_id2host* unset %cq_nick2id* unset %cq_id2nick* unset %cq_total_* unset %cq_position* unset %cq_player* unset %cq_id2player* unset %cq_round_* unset %cq_question_number %cq_round_number = 1 cq_update_players } unset %cq_player* unset %cq_id2player* unset %cq_round_players unset %cq_question_number cq_update_players echo 4 -a *** Scores reset if (%cq_toggle_multiround == FALSE) { cq_advert } } } alias cq_scores_reset_multi { ; Alias to reset multiround beep var %sure = $?!="Reset MULTIROUND scores?" if (%sure == $true) { unset %cq_host2id* unset %cq_id2host* unset %cq_nick2id* unset %cq_id2nick* unset %cq_total_* unset %cq_position* unset %cq_player* unset %cq_id2player* unset %cq_round_* unset %cq_question_number if (%cq_toggle_team == TRUE) { var %loopcounter = 1 while (%loopcounter <= %cq_team_number) { %cq_total_team_ [ $+ [ %loopcounter ] ] = 0 inc %loopcounter } } %cq_round_number = 1 cq_update_players echo 4 -a *** Multiround Scores Reset! cq_advert } } 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 var %genre = 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_advert { cq_getactive var %waiting = $timer(sb).secs %waiting = $calc(%waiting + %cq_advertdelay) if (%cq_advertmode == AUTO) { .timer 1 %waiting describe %cq_active %cq_advert } elseif (%cq_advertmode == ASK) { var %sure = $?!="Show advert after scoreboard?" if (%sure == $true) { .timer 1 %waiting describe %cq_active %cq_advert } } } 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_qvalue == 1) { var %points = point } else { var %points = points } if (%cq_multi_decrease == 1) { var %points2 = point } else { var %points2 = points } if (%cq_penalty == 1) { var %points3 = point } else { var %points3 = points } if (%cq_guesses == 1) { var %attempts = attempt } else { var %attempts = attempts } if (%cq_toggle_notify == TRUE) { var %wintarget = First %team to %cq_target points wins! } if (%cq_toggle_notifyqnum == TRUE) { var %wintarget = %wintarget The game will end after %cq_qnumtarget questions have been asked. } if (%cq_toggle_randpoints == TRUE) { .timer 1 %delay describe %cq_active [ %blurb ] Points are awarded randomly! %wintarget } else { if (%cq_multi_number > 1) { .timer 1 %delay describe %cq_active [ %blurb ] Each question starts at %cq_qvalue %points and decreases by %cq_multi_decrease %points2 with each correct answer, with a penalty of %cq_penalty %points3 for each hint given. %wintarget } else { .timer 1 %delay describe %cq_active [ %blurb ] Each question is worth %cq_qvalue %points with a penalty of %cq_penalty %points3 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 ] [ %attempts ] 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 ] } if (%cq_toggle_privmsg == TRUE) { inc %delay .timer 1 %delay describe %cq_active This is a PRIVATE MESSAGE quiz - please /msg $me your answers! } } 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_skip { ; Alias to skip 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) && (%cq_toggle_randpoints == FALSE)) { 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 if (%cq_toggle_randpoints == TRUE) { %cq_qvalue_current = $rand(%cq_randmin,%cq_randmax) } else { %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) } if (%cq_toggle_privmsg == TRUE) { var %private = $chr(40) $+ /msg $me answer $+ $chr(41) } describe %cq_active %cq_questionstring [ %timed ] [ %private ] 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 if (%cq_toggle_randpoints == FALSE) { 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_addplayer { inc %cq_total_players %cq_host2id_ [ $+ [ $address($1, 3) ] ] = %cq_total_players %cq_nick2id_ [ $+ [ $ial($address($1, 3), 1).nick ] ] = %cq_total_players %cq_id2host_ [ $+ [ %cq_total_players ] ] = $address($1, 3) %cq_id2nick_ [ $+ [ %cq_total_players ] ] = $ial($address($1, 3), 1).nick %cq_position_ [ $+ [ %cq_total_players ] ] = %cq_total_players %cq_total_ [ $+ [ %cq_total_players ] ] = 0 } 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) && (%cq_toggle_random == FALSE)) { 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_host2id_ [ $+ [ $address($1, 3) ] ] var %lookup_id = %cq_id2player_ [ $+ [ %lookup_player ] ] var %lookup_score = %cq_player_ [ $+ [ %lookup_id ] $+ _score ] if (%lookup_player == $null) { cq_addplayer $1 } if (%lookup_score == $null) { inc %cq_round_players %cq_player_ [ $+ [ %cq_round_players ] $+ _score ] = %cq_qvalue_current %cq_player_ [ $+ [ %cq_round_players ] $+ _id ] = %cq_host2id_ [ $+ [ $address($1, 3) ] ] %cq_id2player_ [ $+ [ %cq_host2id_ [ $+ [ $address($1, 3) ] ] ] ] = %cq_round_players if (%cq_toggle_multiround == TRUE) { %cq_round_ [ $+ [ %cq_round_number ] $+ _player_ [ $+ [ %cq_host2id_ [ $+ [ $address($1, 3) ] ] ] ] ] = %cq_qvalue_current inc %cq_total_ [ $+ [ %cq_host2id_ [ $+ [ $address($1, 3) ] ] ] ] %cq_qvalue_current } } else { var %player = %cq_id2player_ [ $+ [ %lookup_player ] ] inc %cq_player_ [ $+ [ %player ] $+ _score ] %cq_qvalue_current if (%cq_toggle_multiround == TRUE) { inc %cq_round_ [ $+ [ %cq_round_number ] $+ _player_ [ $+ [ %cq_host2id_ [ $+ [ $address($1, 3) ] ] ] ] ] %cq_qvalue_current inc %cq_total_ [ $+ [ %cq_host2id_ [ $+ [ $address($1, 3) ] ] ] ] %cq_qvalue_current } if (%cq_id2nick_ [ $+ [ %lookup_player ] ] != $ial($address($1, 3), 1).nick) { unset %cq_nick2id_ [ $+ [ %cq_id2nick_ [ $+ [ %lookup_player ] ] ] ] %cq_nick2id_ [ $+ [ $ial($address($1, 3), 1).nick ] ] = %lookup_player %cq_id2nick_ [ $+ [ %lookup_player ] ] = $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/qnumber has been reached if ((%cq_toggle_notifyqnum == TRUE) && (%cq_player_qnum != TRUE) && (%cq_question_number >= %cq_qnumtarget)) { %cq_player_qnum = TRUE beep var %sure = $?!=" [ %cq_qnumtarget ] questions have been asked - show scores?" if (%sure == $true) { cq_scores_final } } if ((%cq_toggle_notify == TRUE) && (%cq_player_target != TRUE) && (%cq_toggle_team == FALSE)) { cq_sort var %highscore = %cq_player_1_score var %highnick = %cq_id2nick_ [ $+ [ %cq_player_1_id ] ] 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_round_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_round_players) { %scorestring = [ %scorestring ] $chr(91) $+ %cq_player_ [ $+ [ %loopcounter ] $+ _score ] $+ $chr(93) $+ < $+ %cq_id2nick_ [ $+ [ %cq_player_ [ $+ [ %loopcounter ] $+ _id ] ] ] inc %loopcounter while (%cq_player_ [ $+ [ %loopcounter ] $+ _score ] == %cq_player_ [ $+ [ $calc(%loopcounter - 1) ] $+ _score ]) { %scorestring = [ %scorestring ] $+ , %cq_id2nick_ [ $+ [ %cq_player_ [ $+ [ %loopcounter ] $+ _id ] ] ] inc %loopcounter } %scorestring = [ %scorestring ] $+ > $+ , } } else { while (%loopcounter <= %cq_round_players) { %scorestring = [ %scorestring ] %cq_id2nick_ [ $+ [ %cq_player_ [ $+ [ %loopcounter ] $+ _id ] ] ] $+ ( $+ %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_id2nick_ [ $+ [ %cq_player_1_id ] ] <--- with %cq_player_1_score points! describe %cq_active ---------------------------------------------------------------- if (%cq_toggle_multiround == TRUE) { inc %cq_total_team_ [ $+ [ %tempteam ] ] cq_sort_multi } if (%cq_toggle_autoreset == TRUE) { cq_scores_reset cq_teamscore_reset } } else { if (%cq_round_players > 0) { cq_sort if (%cq_final_format == WINNER) { describe %cq_active ---------------------------------------------------- describe %cq_active The winner is: ---> %cq_id2nick_ [ $+ [ %cq_player_1_id ] ] <--- 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 } if (%cq_toggle_multiround == TRUE) { var %multi = FOR ROUND %cq_round_number } .timer 1 %mod_delay describe %cq_active ------ FINAL SCORES %multi ------ var %loopcounter = 0 var %placemarker = 0 var %lines = 0 var %longestscore = $len(%cq_player_1_score) while ((%loopcounter < %cq_round_players) && (%lines < %displayto)) { inc %loopcounter inc %placemarker inc %lines if (%cq_toggle_cumulative == TRUE) { %placemarker = %loopcounter } var %howlong = $len(%cq_player_ [ $+ [ %loopcounter ] $+ _score ]) var %difference = $calc(%longestscore - %howlong) var %leadingspace = $str($chr(160),%difference) if (%loopcounter < 10) { var %rankspace = $chr(160) } else { var %rankspace = $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_id2nick_ [ $+ [ %cq_player_ [ $+ [ %loopcounter ] $+ _id ] ] ] ] 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_id2nick_ [ $+ [ %cq_player_ [ $+ [ %loopcounter ] $+ _id ] ] ] } .timer 1 $calc(%lines + %mod_delay) describe %cq_active [ %rankspace ] $+ [ %equal ] $+ [ %scorestring ] } .timersb 1 $calc(%lines + 3) var %test = test 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_scores_multiround { ; Alias to display final multiround scoreboard if ($1 == individual) { var %individual = INDIVIDUAL } cq_sort_multi if (%cq_question_number) { var %roundnum = %cq_round_number } else { var %roundnum = $calc(%cq_round_number - 1) if (%roundnum < 1) { var %roundnum = 1 } } cq_getactive var %waiting = $timer(sb).secs if (%waiting == $null) { %waiting = 0 } if (%cq_total_players > 0) { cq_sort if (%cq_final_format == WINNER) { describe %cq_active --------------------------------------------------------------------- describe %cq_active The leader after %roundnum rounds is: ---> %cq_id2nick_ [ $+ [ %cq_position_1 ] ] <--- with %cq_total_ [ $+ [ %cq_position_1 ] ] 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)) { .timer 1 %waiting mode $active +m var %mod_delay = $calc(1 + %waiting) } else { var %mod_delay = %waiting } if (%roundnum = 1) { var %rounds = ROUND } else { var %rounds = ROUNDS } .timer 1 %mod_delay describe %cq_active ---- %individual LEADERBOARD AFTER %roundnum %rounds ---- var %loopcounter = 0 var %placemarker = 0 var %lines = 0 while ((%loopcounter < %cq_total_players) && (%lines < %displayto) && (%cq_total_ [ $+ [ %cq_position_ [ $+ [ $calc(%loopcounter + 1) ] ] ] ] > 0)) { inc %loopcounter inc %placemarker inc %lines if (%cq_toggle_cumulative == TRUE) { %placemarker = %loopcounter } if (%cq_total_ [ $+ [ %cq_position_ [ $+ [ %loopcounter ] ] ] ] < 10) { var %leadingspace = $chr(160) } else { var %leadingspace = $null } if (%cq_total_ [ $+ [ %cq_position_ [ $+ [ %loopcounter ] ] ] ] == 1) { var %points = pt $+ $chr(160) } else { var %points = pts } var %scorestring = [ $ord(%placemarker) ] - %leadingspace $+ %cq_total_ [ $+ [ %cq_position_ [ $+ [ %loopcounter ] ] ] ] %points - %cq_id2nick_ [ $+ [ %cq_position_ [ $+ [ %loopcounter ] ] ] ] if ((%cq_toggle_roundscores == TRUE) && (%cq_round_number > 1)) { var %scorestring = [ %scorestring ] $chr(40) var %roundcounter = 0 while (%roundcounter < %roundnum) { inc %roundcounter unset %nextscore var %nextscore = %cq_round_ [ $+ [ %roundcounter ] $+ _player_ $+ [ %cq_position_ [ $+ [ %loopcounter ] ] ] ] if (%nextscore == $null) { %nextscore = 0 } %scorestring = [ %scorestring ] $+ %nextscore $+ - } %scorestring = $left(%scorestring,-1) %scorestring = [ %scorestring ] $+ $chr(41) } if (%cq_toggle_cumulative == TRUE) { var %equal = $chr(160) } while (%cq_total_ [ $+ [ %cq_position_ [ $+ [ %loopcounter ] ] ] ] == %cq_total_ [ $+ [ %cq_position_ [ $+ [ $calc(%loopcounter + 1) ] ] ] ] ) { if (%cq_toggle_cumulative == TRUE) { var %equal $chr(61) } inc %loopcounter %scorestring = [ %scorestring ] $+ , %cq_id2nick_ [ $+ [ %cq_position_ [ $+ [ %loopcounter ] ] ] ] if ((%cq_toggle_roundscores == TRUE) && (%cq_round_number > 1)) { var %roundcounter = 0 var %scorestring = [ %scorestring ] $chr(40) while (%roundcounter < %roundnum) { inc %roundcounter unset %nextscore var %nextscore = %cq_round_ [ $+ [ %roundcounter ] $+ _player_ $+ [ %cq_position_ [ $+ [ %loopcounter ] ] ] ] if (%nextscore == $null) { %nextscore = 0 } %scorestring = [ %scorestring ] $+ %nextscore $+ - } %scorestring = $left(%scorestring,-1) %scorestring = [ %scorestring ] $+ $chr(41) } } .timer 1 $calc(%lines + %mod_delay) describe %cq_active [ %equal ] $+ [ %scorestring ] } .timersb 1 $calc(%lines + 3) var %test = test if ($me isop $active) { .timer 1 $calc(%lines + 2 + %waiting) mode $active -m } } } else { echo 4 -a *** The scoreboard is empty! } } alias cq_scores_multiround_team { ; Alias to display final multiround scoreboard cq_sort_multi if (%cq_question_number) { var %roundnum = %cq_round_number } else { var %roundnum = $calc(%cq_round_number - 1) if (%roundnum < 1) { var %roundnum = 1 } } cq_getactive var %waiting = $timer(sb).secs if (%waiting == $null) { %waiting = 0 } if (%cq_total_players > 0) { cq_sort if (%cq_final_format == WINNER) { describe %cq_active --------------------------------------------------------------------- describe %cq_active The leaders after %roundnum rounds are: ---> %cq_teams_ [ $+ [ %cq_teamposition_1 ] $+ _name ] <--- winning %cq_total_team_ [ $+ [ %cq_teamposition_1 ] ] rounds! 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)) { .timer 1 %waiting mode $active +m var %mod_delay = $calc(1 + %waiting) } else { var %mod_delay = %waiting } if (%roundnum = 1) { var %rounds = ROUND } else { var %rounds = ROUNDS } .timer 1 %mod_delay describe %cq_active ---- TEAM LEADERBOARD AFTER %roundnum %rounds ---- var %loopcounter = 0 var %placemarker = 0 var %lines = 0 while ((%loopcounter < %cq_team_number) && (%lines < %displayto)) { inc %loopcounter inc %placemarker inc %lines if (%cq_toggle_cumulative == TRUE) { %placemarker = %loopcounter } if (%cq_total_team_ [ $+ [ %cq_teamposition_ [ $+ [ %loopcounter ] ] ] ] < 10) { var %leadingspace = $chr(160) } else { var %leadingspace = $null } if (%cq_total_team_ [ $+ [ %cq_teamposition_ [ $+ [ %loopcounter ] ] ] ] == 1) { var %points = round $+ $chr(160) } else { var %points = rounds } var %scorestring = [ $ord(%placemarker) ] - %leadingspace $+ %cq_total_team_ [ $+ [ %cq_teamposition_ [ $+ [ %loopcounter ] ] ] ] %points - %cq_teams_ [ $+ [ %cq_teamposition_ [ $+ [ %loopcounter ] ] ] $+ _name ] if (%cq_toggle_cumulative == TRUE) { var %equal = $chr(160) } while (%cq_total_team_ [ $+ [ %cq_teamposition_ [ $+ [ %loopcounter ] ] ] ] == %cq_total_team [ $+ [ %cq_teamposition_ [ $+ [ $calc(%loopcounter + 1) ] ] ] ] ) { if (%cq_toggle_cumulative == TRUE) { var %equal $chr(61) } inc %loopcounter %scorestring = [ %scorestring ] $+ , %cq_teams_ [ $+ [ %cq_teamposition_ [ $+ [ %loopcounter ] ] ] $+ _name ] } .timer 1 $calc(%lines + %mod_delay) describe %cq_active [ %equal ] $+ [ %scorestring ] } .timersb 1 $calc(%lines + 3) var %test = test if ($me isop $active) { .timer 1 $calc(%lines + 2 + %waiting) mode $active -m } } } else { echo 4 -a *** The scoreboard is empty! } } alias cq_player_add { ; Alias to add one or more points to a player's score (or set to a particular value) if (($2 != $null) && ($2 isnum 1-999)) { var %toadd = $2 } else { var %toadd = 1 } if (%toadd > 1) { var %points = points } else { var %points = point } if ($3 == SET) { var %addorset = set to } else { var %addorset = increased by } var %tempnickid = %cq_nick2id_ [ $+ [ $1 ] ] if (%cq_id2player_ [ $+ [ %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 { if (%tempnickid == $null) { cq_addplayer $1 } inc %cq_round_players %cq_player_ [ $+ [ %cq_round_players ] $+ _score ] = %toadd %cq_player_ [ $+ [ %cq_round_players ] $+ _id ] = %cq_host2id_ [ $+ [ $address($1, 3) ] ] %cq_id2player_ [ $+ [ %cq_host2id_ [ $+ [ $address($1, 3) ] ] ] ] = %cq_round_players if (%cq_toggle_multiround == TRUE) { %cq_round_ [ $+ [ %cq_round_number ] $+ _player_ [ $+ [ %cq_host2id_ [ $+ [ $address($1, 3) ] ] ] ] ] = %toadd inc %cq_total_ [ $+ [ %cq_host2id_ [ $+ [ $address($1, 3) ] ] ] ] %toadd } cq_sort if (%cq_toggle_verbose == TRUE) { cq_getactive describe %cq_active *** $1 $+ 's score %addorset %toadd %points *** } else { echo 4 -a *** $1 $+ 's score %addorset %toadd %points *** } unset %cq_player_ial* } } else { var %player = %cq_id2player_ [ $+ [ %tempnickid ] ] if ($3 == SET) { %cq_player_ [ $+ [ %player ] $+ _score ] = %toadd if (%cq_toggle_multiround == TRUE) { %cq_round_ [ $+ [ %cq_round_number ] $+ _player_ [ $+ [ %cq_host2id_ [ $+ [ $address($1, 3) ] ] ] ] ] = %toadd var %tot = %cq_total_ [ $+ [ %tempnickid ] ] var %diff = $calc(%toadd - %tot) inc %cq_total_ [ $+ [ %cq_host2id_ [ $+ [ $address($1, 3) ] ] ] ] %diff } } else { inc %cq_player_ [ $+ [ %player ] $+ _score ] %toadd if (%cq_toggle_multiround == TRUE) { inc %cq_round_ [ $+ [ %cq_round_number ] $+ _player_ [ $+ [ %cq_host2id_ [ $+ [ $address($1, 3) ] ] ] ] ] %toadd inc %cq_total_ [ $+ [ %cq_host2id_ [ $+ [ $address($1, 3) ] ] ] ] %toadd } } cq_sort if (%cq_toggle_verbose == TRUE) { cq_getactive describe %cq_active *** $1 $+ 's score %addorset %toadd %points *** } else { echo 4 -a *** $1 $+ 's score %addorset %toadd %points *** } } if ((%cq_toggle_team == TRUE) && ($3 == $null)) { 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 %points added to %cq_teams_ [ $+ [ %winnerteam ] $+ _name ] *** } else { echo 4 -a *** %toadd %points 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 } if (%tosub > 1) { var %points = points } else { var %points = point } var %tempnickid = %cq_nick2id_ [ $+ [ $1 ] ] if (%cq_id2player_ [ $+ [ %tempnickid ] ] == $null) { echo 4 -a *** Sorry, [ $1 ] is not on the scoreboard } else { if (%cq_player_ [ $+ [ %cq_id2player_ [ $+ [ %tempnickid ] ] ] $+ _score ] < %tosub) { var %tosub = %cq_player_ [ $+ [ %cq_id2player_ [ $+ [ %tempnickid ] ] ] $+ _score ] } dec %cq_player_ [ $+ [ %cq_id2player_ [ $+ [ %tempnickid ] ] ] $+ _score ] %tosub if (%cq_toggle_multiround == TRUE) { dec %cq_round_ [ $+ [ %cq_round_number ] $+ _player_ [ $+ [ %cq_host2id_ [ $+ [ $address($1, 3) ] ] ] ] ] %tosub dec %cq_total_ [ $+ [ %cq_host2id_ [ $+ [ $address($1, 3) ] ] ] ] %tosub } if (%cq_toggle_verbose == TRUE) { cq_getactive describe %cq_active *** $1 $+ 's score decreased by %tosub %points *** } else { echo 4 -a *** $1 $+ 's score decreased by %tosub %points *** } if (%cq_player_ [ $+ [ %cq_id2player_ [ $+ [ %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 %points subtracted %cq_teams_ [ $+ [ %winnerteam ] $+ _name ] *** } else { echo 4 -a *** %tosub %points subtracted %cq_teams_ [ $+ [ %winnerteam ] $+ _name ] *** } } } } alias cq_player_delete { ; Alias to delete a player from the scoreboard var %tempnickid = %cq_nick2id_ [ $+ [ $1 ] ] if (%cq_id2player_ [ $+ [ %tempnickid ] ] == $null) { echo 4 -a *** Sorry, [ $1 ] is not on the scoreboard } else { if (%cq_toggle_multiround == TRUE) { var %decrease = %cq_round_ [ $+ [ %cq_round_number ] $+ _player_ [ $+ [ %cq_host2id_ [ $+ [ $address($1, 3) ] ] ] ] ] if (%decrease == $null) { %decrease = 0 } dec %cq_total_ [ $+ [ %cq_host2id_ [ $+ [ $address($1, 3) ] ] ] ] %decrease unset %cq_round_ [ $+ [ %cq_round_number ] $+ _player_ [ $+ [ %cq_host2id_ [ $+ [ $address($1, 3) ] ] ] ] ] } %cq_player_ [ $+ [ %cq_id2player_ [ $+ [ %tempnickid ] ] ] $+ _score ] = -1000 cq_sort var %id = %cq_player_ [ $+ [ %cq_round_players ] $+ _id ] unset %cq_player_ [ $+ [ %cq_round_players ] $+ _ ] $+ * unset %cq_id2player_ [ $+ [ %id ] ] dec %cq_round_players if (%cq_toggle_verbose == TRUE) { cq_getactive describe %cq_active *** $1 removed from the scoreboard *** } else { echo 4 -a *** $1 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_round_players - %loopcounter2)) { if ( %cq_player_ [ $+ [ %loopcounter ] $+ _score ] < %cq_player_ [ $+ [ $calc(%loopcounter + 1) ] $+ _score ] ) { var %tempscore1 = %cq_player_ [ $+ [ %loopcounter ] $+ _score ] var %tempplayerid1 = %cq_player_ [ $+ [ %loopcounter ] $+ _id ] var %tempid2player1 = %cq_id2player_ [ $+ [ %tempplayerid1 ] ] var %tempscore2 = %cq_player_ [ $+ [ $calc(%loopcounter + 1) ] $+ _score ] var %tempplayerid2 = %cq_player_ [ $+ [ $calc(%loopcounter + 1) ] $+ _id ] var %tempid2player2 = %cq_id2player_ [ $+ [ %tempplayerid2 ] ] %cq_player_ [ $+ [ %loopcounter ] $+ _score ] = %tempscore2 %cq_player_ [ $+ [ %loopcounter ] $+ _id ] = %tempplayerid2 %cq_id2player_ [ $+ [ %tempplayerid1 ] ] = %tempid2player2 %cq_player_ [ $+ [ $calc(%loopcounter + 1) ] $+ _score ] = %tempscore1 %cq_player_ [ $+ [ $calc(%loopcounter + 1) ] $+ _id ] = %tempplayerid1 %cq_id2player_ [ $+ [ %tempplayerid2 ] ] = %tempid2player1 %swapflag = TRUE } inc %loopcounter } } if (%cq_toggle_multiround == TRUE) { cq_sort_multi } } alias cq_sort_multi { ; Bubblesort routine to sort multiround 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_total_ [ $+ [ %cq_position_ [ $+ [ %loopcounter ] ] ] ] < %cq_total_ [ $+ [ %cq_position_ [ $+ [ $calc(%loopcounter + 1) ] ] ] ] ) { var %tempid1 = %cq_position_ [ $+ [ %loopcounter ] ] var %tempid2 = %cq_position_ [ $+ [ $calc(%loopcounter + 1) ] ] %cq_position_ [ $+ [ %loopcounter ] ] = %tempid2 %cq_position_ [ $+ [ $calc(%loopcounter + 1) ] ] = %tempid1 %swapflag = TRUE } inc %loopcounter } } if (%cq_toggle_team == TRUE) { var %swapflag = TRUE var %loopcounter2 = 0 while (%swapflag == TRUE) { var %swapflag == FALSE var %loopcounter = 1 inc %loopcounter2 while (%loopcounter <= $calc(%cq_team_number - %loopcounter2)) { if ( %cq_total_team_ [ $+ [ %cq_teamposition_ [ $+ [ %loopcounter ] ] ] ] < %cq_total_team_ [ $+ [ %cq_teamposition_ [ $+ [ $calc(%loopcounter + 1) ] ] ] ] ) { var %tempid1 = %cq_teamposition_ [ $+ [ %loopcounter ] ] var %tempid2 = %cq_teamposition_ [ $+ [ $calc(%loopcounter + 1) ] ] %cq_teamposition_ [ $+ [ %loopcounter ] ] = %tempid2 %cq_teamposition_ [ $+ [ $calc(%loopcounter + 1) ] ] = %tempid1 %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_host2id_ [ $+ [ $address($newnick, 3) ] ] if (%temphostid != $null ) { unset %cq_nick2id_ [ $+ [ %cq_id2nick_ [ $+ [ %temphostid ] ] ] ] %cq_nick2id_ [ $+ [ $newnick ] ] = %temphostid %cq_id2nick_ [ $+ [ %temphostid ] ] = $newnick } 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.62 beta 5 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 485 21, autohs button "X",27,580 121 20 20 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 40 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 "Next Q:",6,1 80 60 20 button "Next File",9,1 101 60 20 button "Skip 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, center 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_allowsave == FALSE) { did -b cq_dialog 26,27 } } 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 "Next Q:" button is pressed cq_preview cq_update_preview cq_update_qfilestat did -f cq_dialog 1 } on *:dialog:cq_dialog:sclick:7:{ ; Triggered when "Skip Q:" button is pressed cq_skip 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 (Blank = Abort)" 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_id2player_ [ $+ [ %cq_nick2id_ [ $+ [ %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_id2player_ [ $+ [ %cq_nick2id_ [ $+ [ %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_add %nick $did(cq_dialog, 72).text SET cq_update_players var %newid = %cq_id2player_ [ $+ [ %cq_nick2id_ [ $+ [ %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 SET cq_update_players } } else { cq_player_add $did(cq_dialog, 71).text $did(cq_dialog, 72).text SET } } 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:sclick:27:{ ; Triggered when mark for deletion "X" 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 ] ] %cq_filetodelete_ [ $+ [ %converted ] ] = $addtok(%cq_filetodelete_ [ $+ [ %converted ] ],%pointer,124) %cq_filetodelete_ [ $+ [ %converted ] ] = $sorttok(%cq_filetodelete_ [ $+ [ %converted ] ],124,n) cq_skip cq_update_qfilestat cq_update_preview did -f cq_dialog 1 echo 4 -a *** Question [ %pointer ] from [ %filename ] will be deleted when file is reset } } 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 "POS:",237, 2 202 40 20 edit %cq_hint_position, 263, 40 199 30 22, center 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, 360 199 60 20 edit "",264, 427 199 100 22, autohs button "Clr Hint",213, 467 172 60 23 edit %cq_qvalue_current, 262, 570 14 30 25, center 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 420 21, autohs } ; Answer mode dialog box events #cq_answermode on 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 #cq_privanswermode off on ^*:OPEN:?:*:{ cq_handleprivmsg $nick $1- halt } alias cq_handleprivmsg { if ((%cq_toggle_prefixed == FALSE) || ($left($2,1) == %cq_aprefix)) { if ((%cq_toggle_guesses == FALSE) || (!%cq_answered_ [ $+ [ $1 ] ]) || (%cq_answered_ [ $+ [ $1 ] ] < %cq_guesses)) { inc %cq_answered_ [ $+ [ $1 ] ] if ((%cq_toggle_team == TRUE) && (%cq_toggle_strictteams == TRUE)) { var %winnerprefix = $left($1,2) var %winnerteam = %cq_prefix_ [ $+ [ $right(%winnerprefix,1) ] ] if (($left(%winnerprefix,1) == $chr(94)) && (%winnerteam != $null)) { did -a cq_dialog_answers 321 $1 > $2- } } else { did -a cq_dialog_answers 321 $1 > $2- } } } } on *:text:*:?:{ 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_privanswermode 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 if (%cq_toggle_randpoints == FALSE) { dec %cq_qvalue_current %cq_multi_decrease if (%cq_qvalue_current < 1) { %cq_qvalue_current = 1 } } else { %cq_qvalue_current = $rand(%cq_randmin,%cq_randmax) } 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_check_target 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 ($right(%answer,1) == .) { %answer = $left(%answer,-1) } if (%cq_hint_position < 1) { var %letters = $regsub(%answer,/[abcdefghijklmnopqrstuvwxyz0123456789]/gi,%cq_hintcharacter,%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 $+ %cq_hintcharacter } } inc %loop } } 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 ($right(%answer,1) == .) { %answer = $left(%answer,-1) } if (%cq_hint_position == 0) { var %letters = $regsub(%answer,/[abcdefghijklmnopqrstuvwxyz0123456789]/gi,%cq_hintcharacter,%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,%cq_hintcharacter) var %replaced = 0 while ((%blanks > 0) && (%replaced == 0)) { var %random = $rand(1,%length) if ($mid(%current,%random,1) == %cq_hintcharacter) { 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 } } 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 ($right(%answer,1) == .) { %answer = $left(%answer,-1) } if (%cq_hint_position < 1) { var %letters = $regsub(%answer,/[abcdefghijklmnopqrstuvwxyz0123456789]/gi,%cq_hintcharacter,%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 = %cq_hintcharacter $+ %temphint2 } } %cq_hint = %cq_hint %temphint2 $+ %temphint1 unset %temphint2 inc %loop } } 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 } if ($right(%answer,1) == .) { %answer = $left(%answer,-1) } var %vowels = $regsub(%answer,/[bcdfghjklmnpqrstvwxyz0123456789]/gi,%cq_hintcharacter,%cq_hint) if (%cq_toggle_showpattern == TRUE) { %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 } if ($right(%answer,1) == .) { %answer = $left(%answer,-1) } var %conson = $regsub(%answer,/[aeiou0123456789]/gi,%cq_hintcharacter,%cq_hint) if (%cq_toggle_showpattern == TRUE) { %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 } if ($right(%answer,1) == .) { %answer = $left(%answer,-1) } 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 $+ %cq_hintcharacter } inc %hintpos } inc %loop %cq_hint = %cq_hint %temphint unset %temphint } if (%cq_toggle_showpattern == TRUE) { %cq_hint = %cq_hint ( $+ $did(cq_dialog_answers,264).text $+ ) } cq_update_hint } on *:dialog:cq_dialog_answers:sclick:213:{ ; Triggered by clicking the "Clear Hint" button unset %cq_hint %cq_hint_position = 0 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_round_players) { var %nick = %cq_id2nick_ [ $+ [ %cq_player_ [ $+ [ %loopcounter ] $+ _id ] ] ] 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_nick2id_ [ $+ [ $nick($active,%loopcounter) ] ] if (%cq_id2player_ [ $+ [ %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, center radio "Display winner only",714,1 174 145 20 check "Cumulative ranks",715,1 195 145 20 ; COLUMN 2------------------------------------- check "Notify Qnumber",711,160 1 100 20 edit %cq_qnumtarget, 666, 260 1 30 23, center check "Notify Score", 706, 160 25 100 20 edit %cq_target, 663, 260 25 30 23, center edit %cq_qvalue, 670, 160 65 30 23, center text "Initial value of Q:", 640, 195 68 110 23 edit %cq_multi_decrease, 671, 160 90 30 23, center text "Decrease Q: value", 641, 195 93 110 23 edit %cq_multi_number, 672, 160 115 30 23, center text "Maximum winners", 642, 195 118 110 23 edit %cq_penalty, 662, 160 140 30 23, center text "Hint penalty",632, 195 143 110 23 check "Rand Pts",708, 160 165 70 23 edit %cq_randmin, 664, 230 165 30 23, center text "to",633, 260 168 10 23 edit %cq_randmax, 665, 270 165 30 23, center button "Load...",604,170 195 50 23 button "Save...",605,230 195 50 23 ; COLUMN 3------------------------------------- check "Team Quiz Mode",716,315 1 120 20 edit %cq_team_number, 675, 315 23 20 23, center 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, center text "Score",647,315 137 45 23 edit "",678,360 135 30 23, center 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, center text "sec",649,575 4 30 23 check "Warning",721, 470 25 60 23 edit "",680, 540 25 30 23, center text "sec",650,575 29 30 23 check "Prefix",722, 470 50 60 23 edit "",681, 540 50 30 23, center check "Guesses",723, 470 75 60 23 edit "",682, 540 75 30 23, center check "Answer via Privmsg?",727,470 98 120 23 check "Multi-Round Quiz",724,470 123 130 23 check "Target",725,470 146 60 23 edit "",683, 540 146 30 23, center check "Show Round Scores",726,470 170 130 23 button "Show", 606, 470 195 50 23 button "Reset", 607, 540 195 50 23 ;Dividers button "", 693,150 1 3 240 button "", 697, 458 120 210 3 button "", 691,153 55 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,664,665,666,670,671,672,673,675,679,680,681,682,683 did -a cq_dialog_scores 662 %cq_penalty did -a cq_dialog_scores 663 %cq_target did -a cq_dialog_scores 664 %cq_randmin did -a cq_dialog_scores 665 %cq_randmax did -a cq_dialog_scores 666 %cq_qnumtarget 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 did -a cq_dialog_scores 683 %cq_target_rounds 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 did -e cq_dialog_scores 663 } else { did -u cq_dialog_scores 706 did -b cq_dialog_scores 663 } if (%cq_toggle_showpoints == TRUE) { did -c cq_dialog_scores 707 } else { did -u cq_dialog_scores 707 } if (%cq_toggle_randpoints == TRUE) { did -c cq_dialog_scores 708 did -b cq_dialog_scores 632,640,641,662,670,671 did -e cq_dialog_scores 633,664,665 } else { did -u cq_dialog_scores 708 did -e cq_dialog_scores 632,640,641,662,670,671 did -b cq_dialog_scores 633,664,665 } if (%cq_toggle_notifyqnum == TRUE) { did -c cq_dialog_scores 711 did -e cq_dialog_scores 666 } else { did -u cq_dialog_scores 711 did -b cq_dialog_scores 666 } 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 } if (%cq_toggle_multiround == TRUE) { did -c cq_dialog_scores 724 did -e cq_dialog_scores 725,726,606,607 } else { did -u cq_dialog_scores 724 did -b cq_dialog_scores 725,726,683,606,607 } if (%cq_toggle_notifymulti == TRUE) { did -c cq_dialog_scores 725 did -e cq_dialog_scores 683 } else { did -u cq_dialog_scores 725 did -b cq_dialog_scores 683 } if (%cq_toggle_roundscores == TRUE) { did -c cq_dialog_scores 726 } else { did -u cq_dialog_scores 726 } if (%cq_toggle_privmsg == TRUE) { did -c cq_dialog_scores 727 } else { did -u cq_dialog_scores 727 } } 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_* unset %cq_teamposition_* unset %cq_total_team_* 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 %cq_teamposition_ [ $+ [ %loopcounter ] ] = %loopcounter %cq_total_team_ [ $+ [ %loopcounter ] ] = 0 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 58 did -a $dname 691 restrict bottom 58 did -a $dname 692 restrict top 125 did -a $dname 692 restrict bottom 125 did -a $dname 697 restrict top 123 did -a $dname 697 restrict bottom 123 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_aprefix %cq_aprefix write " $+ %tempfile $+ " cq_guesses %cq_guesses write " $+ %tempfile $+ " cq_multi_decrease %cq_multi_decrease write " $+ %tempfile $+ " cq_multi_number %cq_multi_number write " $+ %tempfile $+ " cq_penalty %cq_penalty write " $+ %tempfile $+ " cq_qvalue write " $+ %tempfile $+ " cq_randmin %cq_randmin write " $+ %tempfile $+ " cq_randmax %cq_randmax write " $+ %tempfile $+ " cq_target_rounds %cq_target_rounds write " $+ %tempfile $+ " cq_team_number %cq_team_number write " $+ %tempfile $+ " cq_time %cq_time write " $+ %tempfile $+ " cq_warning %cq_warning write " $+ %tempfile $+ " cq_toggle_guesses %cq_toggle_guesses write " $+ %tempfile $+ " cq_toggle_moderate %cq_toggle_moderate write " $+ %tempfile $+ " cq_toggle_multiround %cq_toggle_multiround write " $+ %tempfile $+ " cq_toggle_prefixed %cq_toggle_prefixed write " $+ %tempfile $+ " cq_toggle_privmsg %cq_toggle_privmsg write " $+ %tempfile $+ " cq_toggle_qnumbers %cq_toggle_qnumbers write " $+ %tempfile $+ " cq_toggle_randpoints %cq_toggle_randpoints write " $+ %tempfile $+ " cq_toggle_roundscores %cq_toggle_roundscores write " $+ %tempfile $+ " cq_toggle_qvalue %cq_toggle_qvalue write " $+ %tempfile $+ " cq_toggle_scoreboard %cq_toggle_scoreboard write " $+ %tempfile $+ " cq_toggle_showpoints %cq_toggle_showpoints write " $+ %tempfile $+ " cq_toggle_strictteams %cq_toggle_strictteams 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_timed %cq_toggle_timed write " $+ %tempfile $+ " cq_toggle_warning %cq_toggle_warning 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:sclick:606:{ ; Triggered by clicking "Show" multi-round scores options if (%cq_toggle_team == TRUE) { beep var %sure3 = $?!="Show TEAM leaderboard?" if (%sure3 == $true) { cq_scores_multiround_team } beep var %sure4 = $?!="Show INDIVIDUAL leaderboard?" if (%sure4 == $true) { cq_scores_multiround individual } } else { cq_scores_multiround } } on *:dialog:cq_dialog_scores:sclick:607:{ ; Triggered by clicking "Reset" multi-round scores options cq_scores_reset_multi } 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:664:{ ; Triggered by editing random points minumum if ($did(cq_dialog_scores, 664).text isnum 1-999) { %cq_randmin = $did(cq_dialog_scores, 664).text } else { did -r cq_dialog_scores 664 } } on *:dialog:cq_dialog_scores:edit:665:{ ; Triggered by editing random points maximum if ($did(cq_dialog_scores, 665).text isnum 1-999) { %cq_randmax = $did(cq_dialog_scores, 665).text } else { did -r cq_dialog_scores 665 } } on *:dialog:cq_dialog_scores:edit:666:{ ; Triggered by editing question number target if ($did(cq_dialog_scores, 666).text isnum 1-999) { %cq_qnumtarget = $did(cq_dialog_scores, 666).text } else { did -r cq_dialog_scores 666 } } 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:edit:683:{ ; Triggered when data is entered into multiround "Target" if ($did(cq_dialog_scores,683).text isnum 1-999) { %cq_target_rounds = $did(cq_dialog_scores,683).text } else { did -r cq_dialog_scores 683 } } 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 if (%cq_toggle_notify == TRUE) { did -e cq_dialog_scores 663 } else { did -b cq_dialog_scores 663 } } on *:dialog:cq_dialog_scores:sclick:707:{ ; Triggered when "show points won" checkbox is clicked cq_toggle showpoints } on *:dialog:cq_dialog_scores:sclick:708:{ ; Triggered when "random points" checkbox is clicked cq_toggle randpoints if (%cq_toggle_randpoints == TRUE) { did -b cq_dialog_scores 632,640,641,662,670,671 did -e cq_dialog_scores 633,664,665 } else { did -e cq_dialog_scores 632,640,641,662,670,671 did -b cq_dialog_scores 633,664,665 } } on *:dialog:cq_dialog_scores:sclick:711:{ ; Triggered when "Notify Question Number" checkbox is clicked cq_toggle notifyqnum if (%cq_toggle_notifyqnum == TRUE) { did -e cq_dialog_scores 666 } else { did -b cq_dialog_scores 666 } } 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:724:{ ; Triggered when Multi-Round checkbox is clicked cq_toggle multiround cq_update_morescoreoptions } on *:dialog:cq_dialog_scores:sclick:725:{ ; Triggered when notify Multi-Round target checkbox is clicked cq_toggle notifymulti cq_update_morescoreoptions } on *:dialog:cq_dialog_scores:sclick:726:{ ; Triggered when Show Round Scores checkbox is clicked cq_toggle roundscores cq_update_morescoreoptions } on *:dialog:cq_dialog_scores:sclick:727:{ ; Triggered when "Answer via Privmsg" checkbox is clicked cq_toggle privmsg 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) 600 220 button "",2904, 0 0 0 0, cancel button "",2905, 0 0 0 0, ok ; COLUMN 1------------------------------------- button "Qfile Directory...", 802, 5 5 140 22 text "Default Channel",831, 1 90 140 23 edit %cq_channel, 861, 1 107 70 23, autohs check "Float",902, 77 108 70 20 text "Memory Dump",832, 1 175 140 23 button "Load...", 800, 10 192 60 22 button "Save...", 801, 83 192 60 22 ; COLUMN 2------------------------------------- check "Allow save/delete from Qfile",905, 165 10 170 20 check "Verbose score management",903, 165 50 170 20 check "Auto-award winners",911,165 90 170 20 check "Immediate autohint",904, 165 110 170 20 check "Strip ( ) from end of hints",906, 165 150 170 20 check "Show pattern in hint",907, 165 170 170 20 edit %cq_hintcharacter, 864, 162 195 20 20, center text "Hint character", 835, 190 198 80 20 button "Default", 804, 285 195 60 22 ; COLUMN 3------------------------------------- text "Advert",833, 370 12 50 20 radio "Off",908,425 10 50 20 radio "Ask",909,475 10 50 20 radio "Auto",910,525 10 50 20 edit %cq_advert, 862, 369 30 220 60, multi vsbar edit %cq_advertdelay, 863, 370 97 30 23, center text "seconds delay",834, 410 100 80 20 button "Show NOW!", 803, 510 97 70 22 ; DIVIDERS------------------------------------- ;button "",881,1 35 150 3 ;button "",882,1 80 150 3 button "",883,150 1 5 220 ;button "",884,150 35 150 3 button "",885,355 130 245 3 button "",886,350 1 5 220 } ; 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 885 divider tbborder > $mircdir\ctl_gen.mdx cq_mdx SetControlMDX 883,886 divider vertical lrborder > $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_allowsave == TRUE) { did -c cq_dialog_scriptoptions 905 } if (%cq_toggle_stripbrackets == TRUE) { did -c cq_dialog_scriptoptions 906 } if (%cq_toggle_showpattern == TRUE) { did -c cq_dialog_scriptoptions 907 } if (%cq_advertmode == OFF) { did -c cq_dialog_scriptoptions 908 } elseif (%cq_advertmode == ASK) { did -c cq_dialog_scriptoptions 909 } else { did -c cq_dialog_scriptoptions 910 } if (%cq_toggle_autoaward == TRUE) { did -c cq_dialog_scriptoptions 911 } } on *:DIALOG:cq_dialog_scriptoptions:sclick:881,882,883,884,885,886:{ ;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 83 ;did -a $dname 882 restrict bottom 83 did -a $dname 883 restrict left 155 did -a $dname 883 restrict right 155 ;did -a $dname 884 restrict top 38 ;did -a $dname 884 restrict bottom 38 did -a $dname 885 restrict top 133 did -a $dname 885 restrict bottom 133 did -a $dname 886 restrict left 355 did -a $dname 886 restrict right 355 } } 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) { beep var %clear = $?!="Clear current Cosmoquiz variables first? (No = Upgrade)" if (%clear) { 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:803:{ ; Triggered when "Show advert" button is clicked cq_getactive describe %cq_active %cq_advert } on *:dialog:cq_dialog_scriptoptions:sclick:804:{ ; Triggered when "Default Hint Character" button is clicked %cq_hintcharacter = · did -r cq_dialog_scriptoptions 864 did -a cq_dialog_scriptoptions 864 · } 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 "Allow Save" checkbox is clicked cq_toggle allowsave if ($dialog(cq_dialog).title != $null) { if (%cq_toggle_allowsave == TRUE) { did -e cq_dialog 26,27 } else { did -b cq_dialog 26,27 } } } on *:dialog:cq_dialog_scriptoptions:sclick:906:{ ; Triggered when "Strip ( ) from hints" checkbox is clicked cq_toggle stripbrackets } on *:dialog:cq_dialog_scriptoptions:sclick:907:{ ; Triggered when "Show pattern after hint" checkbox is clicked cq_toggle showpattern } on *:dialog:cq_dialog_scriptoptions:sclick:908:{ ; Triggered when "Advertmode OFF" radio is selected %cq_advertmode = OFF echo 4 -a *** Advert will not be displayed } on *:dialog:cq_dialog_scriptoptions:sclick:909:{ ; Triggered when "Advertmode ASK" radio is selected %cq_advertmode = ASK echo 4 -a *** You will be asked whether to show the advert at the end of each quiz } on *:dialog:cq_dialog_scriptoptions:sclick:910:{ ; Triggered when "Advertmode AUTO" radio is selected %cq_advertmode = AUTO echo 4 -a *** Advert automatically displayed at the end of each quiz } on *:dialog:cq_dialog_scriptoptions:sclick:911:{ ; Triggered when "Autoaward" checkbox is clicked cq_toggle autoaward } 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 } } on *:dialog:cq_dialog_scriptoptions:edit:862:{ ; Triggered by editing "advert" edit box var %lines = $did(cq_dialog_scriptoptions, 862).lines var %x = 1 while (%x <= %lines) { var %ad = %ad $did(cq_dialog_scriptoptions, 862, %x).text inc %x } %cq_advert = %ad } on *:dialog:cq_dialog_scriptoptions:edit:863:{ ; Triggered by changing value of advert delay if ($did(cq_dialog_scriptoptions, 863).text isnum 1-999) { %cq_advertdelay = $did(cq_dialog_scriptoptions, 863).text } else { did -r cq_dialog_scriptoptions 863 } } on *:dialog:cq_dialog_scriptoptions:edit:864:{ ; Triggered by changing hint character if ($len($did(cq_dialog_scriptoptions, 864).text) == 1) { %cq_hintcharacter = $did(cq_dialog_scriptoptions, 864).text } else { did -r cq_dialog_scriptoptions 864 } } 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 (%cq_filetodelete_ [ $+ [ %converted ] ]) { var %numtodelete = $gettok(%cq_filetodelete_ [ $+ [ %converted ] ],0,124) beep var %sure = $?!="PERMANENTLY remove the [ %numtodelete ] questions marked for deletion?" if (%sure) { var %loopcount = 1 echo 4 -a *** Deleting questions - please wait... while (%loopcount <= %numtodelete) { var %currentq = $gettok(%cq_filetodelete_ [ $+ [ %converted ] ],%loopcount,124) var %originalline = $calc(%currentq * 2 - 1) var %offset1 = $calc(%loopcount - 1) var %offset2 = $calc(%offset1 * 2) var %currentline = $calc(%originalline - %offset2) write -dl $+ %currentline " $+ %tempfile $+ " write -dl $+ %currentline " $+ %tempfile $+ " inc %loopcount } echo 4 -a *** Done! var %lines = $lines(%tempfile) var %questions = $calc(%lines / 2) unset %cq_filetodelete_ [ $+ [ %converted ] ] } } 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 } }