// // // Haida Language Tutor v0.62 // // Written by Stephen Kozik // zod@circleofthunder.com // http://www.circleofthunder.com // // License: GPL // // // Initialize Program (Load XML, Reset Arrays, Set Projector Options) if (!initialize) { fscommand("allowscale", "false"); fscommand("fullscreen", "false"); system.useCodepage = true; quizcontent = new XML(); quizcontent.ignoreWhite = true; quizcontent.load("./data/" add quizcontentfile); quizconfig = new XML(); quizconfig.ignoreWhite = true; quizconfig.load("./data/" add quizconfigfile); questions = new Array(); pictures = new Array(); audio = new Array(); answers = new Array(); qprefix = new Array(); answertypes = new Array(); questionnumber = 0; numbercorrect = 0; optionselection = 0; initialize = 1; } // Place optional Title Variables function placetitle() { this.attachMovie("title", "title", 101); title._x = 0; title._y = 0; title.title = _level0.TitleName; title.begin = _level0.Begin; title.credits = _level0.Credits; } // Place question and answer options on stage function placequestion() { this.attachMovie("q_shadow", "q_shadow", 100); q_shadow._x=90; q_shadow._y=150; questionsound = new Sound(); questionsound.loadSound("./audio/" add NewQuestionAudio, true); this.attachMovie("question", "question", 50); if (pictures[questionnumber].length > 0) { loadMovie("./pictures/" add pictures[questionnumber], "question"); question._x = 40; question._y = 40; this.attachMovie("instruction", "instruction", 49); instruction.instruction = qprefix[questionnumber]; instruction._x = 150; instruction._y = 60; } else if (audio[questionnumber].length > 0) { question.question = questions[questionnumber]; question._x = 170; question._y = 40; // questionaudio = new Sound(); // questionaudio.loadSound("./audio/" add audio[questionnumber], true); this.attachMovie("playsound", "playsound", 48); playsound._x = 150; playsound._y = 80; playsound.soundtitle = _level0.SoundTitle; this.attachMovie("instruction", "instruction", 49); instruction.instruction = qprefix[questionnumber]; instruction._x = 55; instruction._y = 130; } else { question.question = questions[questionnumber]; question._x = 55; question._y = 40; this.attachMovie("instruction", "instruction", 49); instruction.instruction = qprefix[questionnumber]; instruction._x = 55; instruction._y = 100; } placedanswers = new Array(); for (i=0; i0) { while (!numberisclear) { rnum = random(eval("redherrings" add questionnumber).length); testisclear = 1; for (p=0; p"; } else { this.attachMovie("wrong", "wrong", 100); wrong._x = 76; wrong._y = 115; if (audio[questionnumber].length > 0 || pictures[questionnumber].length > 0) { wrong.content = "
" add YourAnswer add " " add optionselection add ".
" add CorrectAnswer add " " add answers[questionnumber] add ".
"; } else if (answertypes[questionnumber] == "Picture" || answertypes[questionnumber] == "Audio") { wrong.content = IncorrectPicture; // wrong.content = "
" add RepeatQuestionWrong add " " add questions[questionnumber] add ".
"; } else { wrong.content = "
" add RepeatQuestionWrong add " " add questions[questionnumber] add ".
" add YourAnswer add " " add optionselection add ".
" add CorrectAnswer add " " add answers[questionnumber] add ".
"; } } } else { numbercorrect++; answersound = new Sound(); answersound.loadSound("./audio/" add CorrectAudio, true); this.attachMovie("correct", "correct", 100); correct._x = 76; correct._y = 115; if (audio[questionnumber].length > 0 || pictures[questionnumber].length > 0) { correct.content = "
" add RepeatQuestionNonText add " " add YourAnswerCorrect add " " add optionselection add ".
" add "
"; } else if (answertypes[questionnumber] == "Picture" || answertypes[questionnumber] == "Audio") { correct.content = CorrectPicture; // correct.content = "
" add RepeatQuestionRight add " " add questions[questionnumber] add " " add YourAnswerCorrect add ".
"; } else { correct.content = "
" add RepeatQuestionRight add " " add questions[questionnumber] add " " add YourAnswerCorrect add " " add optionselection add ".
" add "
"; } } optionselection = 0; optioninput = 0; } // Reset stage and variables for next question or cycle if (nextcycle) { if (questionnumber+1>questions.length-1) { answersound = new Sound(); answersound.loadSound("./audio/" add EndAudio, true); this.attachMovie("final", "final", 100); final._x = 65; final._y = 135; final.content = TheEndAswered add " " add numbercorrect add " " add TheEndOutof add " " add questions.length add " " add TheEndText add "
" add RetryText; nextcycle = 0; questionnumber = -1; numbercorrect = 0; } else { nextcycle = 0; question.removeMovieClip(); playsound.removeMovieClip(); for (i=0; iquestions.length-1) { questionnumber = 0; } stageset = 0; } } // If XML content and config is parsed set the stage if (contentparsed && configparsed && !stageset) { placequestion(); stageset = 1; } // If XML content is loaded but not parsed, parse the data if (quizcontent.loaded && !contentparsed) { contentparsed = 1; for (y=0; y<=quizcontent.FirstChild.childNodes.length; y++) { this["redherrings" add y] = new Array(); this["redherringtext" add y] = new Array(); for (x=0; x<=quizcontent.FirstChild.childNodes[y].childNodes.length; x++) { if (quizcontent.FirstChild.childNodes[y].childNodes[x].nodeName == "Word") { temp = new String(quizcontent.FirstChild.childNodes[y].childNodes[x].childNodes[0].nodeValue); questions.push(temp); } else if (quizcontent.FirstChild.childNodes[y].childNodes[x].nodeName == "Picture") { temp = new String(quizcontent.FirstChild.childNodes[y].childNodes[x].childNodes[0].nodeValue); pictures.push(temp); } else if (quizcontent.FirstChild.childNodes[y].childNodes[x].nodeName == "Audio") { temp = new String(quizcontent.FirstChild.childNodes[y].childNodes[x].childNodes[0].nodeValue); audio.push(temp); } else if (quizcontent.FirstChild.childNodes[y].childNodes[x].nodeName == "AnswerType") { temp = new String(quizcontent.FirstChild.childNodes[y].childNodes[x].childNodes[0].nodeValue); answertypes.push(temp); } else if (quizcontent.FirstChild.childNodes[y].childNodes[x].nodeName == "Answer") { temp = new String(quizcontent.FirstChild.childNodes[y].childNodes[x].childNodes[0].nodeValue); answers.push(temp); this["redherrings" add y].push(temp); temp = new String(quizcontent.FirstChild.childNodes[y].childNodes[x].attributes.Text); this["redherringtext" add y].push(temp); } else if (quizcontent.FirstChild.childNodes[y].childNodes[x].nodeName == "QuestionPrefix") { temp = new String(quizcontent.FirstChild.childNodes[y].childNodes[x].childNodes[0].nodeValue); qprefix.push(temp); } else if (quizcontent.FirstChild.childNodes[y].childNodes[x].nodeName == "RedHerring") { temp = new String(quizcontent.FirstChild.childNodes[y].childNodes[x].childNodes[0].nodeValue); this["redherrings" add y].push(temp); temp = new String(quizcontent.FirstChild.childNodes[y].childNodes[x].attributes.Text); this["redherringtext" add y].push(temp); } } } } // If XML config is loaded but not parsed config it if (quizconfig.loaded && !configparsed) { configparsed = 1; for (y=0; y<=quizconfig.FirstChild.childNodes.length; y++) { for (x=0; x<=quizconfig.FirstChild.childNodes[y].childNodes.length; x++) { temp = new String(quizconfig.FirstChild.childNodes[y].childNodes[x].childNodes[0]); tname = new String(quizconfig.FirstChild.childNodes[y].childNodes[x].nodeName); this[tname] = temp; } } placetitle(); titlesound = new Sound(); titlesound.loadSound("./audio/" add TitleAudio, true); if (Background) { loadMovie("./pictures/" add Background, "backgroundimage"); } if (TitleImage) { loadMovie("./pictures/" add TitleImage, "_level0.title.graphicspace"); } }