0 registered members (),
18,767
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
function call
#145229
08/02/07 12:52
08/02/07 12:52
|
Joined: Apr 2007
Posts: 83
prog
OP
Junior Member
|
OP
Junior Member
Joined: Apr 2007
Posts: 83
|
hi, In the code below count_down() function is called when a question pop-up. If the correct answer is selected the timer should disappear (or) if the timer is (0:00) it should disappear(i.e., count_down should stop).
//////timer////////// string time_str; string temp_str; var seconds = 30; // number of seconds to be counted down var temp_seconds;
function count_down() { while(seconds > 0) { sleep (1); seconds -= 1; temp = int(seconds / 60); // compute the number of minutes str_for_num(time_str, temp); str_cat (time_str, " : "); temp_seconds = seconds - temp * 60; // compute the remainder (the number of sec) str_for_num(temp_str, temp_seconds); if (temp_seconds < 10) { str_cat (time_str, "0"); // add a zero (if needed) } str_cat (time_str, temp_str); } }
///////////////////quiz function give_quiz1() { current_quiz = 2; toggle_quiz_panels(1);
count_down(); if(current_quiz==2) { str_cpy(quiz_string, quiz2_string); str_cpy(answerA_string, answer2_optionA_string); str_cpy(answerB_string, answer2_optionB_string); str_cpy(answerC_string, answer2_optionC_string); str_cpy(answerD_string, answer2_optionD_string);
this_answer_is_correct=1; } }
function answer_quizA() { answer_quiz(1);
} function answer_quizB() { answer_quiz(2); }
function answer_quizC() { answer_quiz(3); } function answer_quizD() { answer_quiz(4); }
function answer_quiz(answer) { player_var = answer; if(answer == this_answer_is_correct) { str_cpy(response_string, "C O R R E C T ! Well done");
snd_play (correct_answer_wav, 200, 0); //play select sound } else { str_cpy(response_string, "Sorry, you got this one wrong."); snd_play (wrong_answer_wav, 200, 0); //play select sound } wait(2); quiz_text.visible= off; toggle_quiz_panels(0); quiz_panel.visible = on; response_text.visible = on; sleep(1); toggle_quiz_panels(0);
|
|
|
|