home *** CD-ROM | disk | FTP | other *** search
- global osdir, TotalPoints, QuestionsAsked, HalfWayThere, lastscore, QuestionsList, TheDB, TheTable, gIsPaused_flag, gMiaw_flag, gxronos, gMaxTime, gKrataTime
-
- on KrataTime
- if gIsPaused_flag or gMiaw_flag then
- gKrataTime = gMaxTime - gxronos
- else
- startTimer()
- end if
- end
-
- on prepareMovie
- the windowList = []
- gKrataTime = 0
- gMaxTime = 15
- gxronos = 0
- gMiaw_flag = 0
- HalfWayThere = 0
- funcs = baRegister("Gaide Sofia", 2831852)
- osdir = getOSDirectory()
- DBExists = baFileExists(osdir & "\Quiz.4db")
- if not DBExists then
- Ok = baCopyFile(the moviePath & "Quiz.4db", osdir & "\quiz.4db", "always")
- end if
- if Ok <> 0 then
- alert("DATABASE ERROR ", Ok)
- end if
- SetInitialValues()
- MakeRandomListOfQuestions()
- end
-
- on stopMovie
- member("Highscoreuser").text = EMPTY
- closeDB()
- end
-
- on SetInitialValues
- HalfWayThere = 0
- TotalPoints = 0
- QuestionsAsked = 0
- setlastscore()
- end
-
- on MakeRandomListOfQuestions
- QuestionsList = []
- EmptyList = []
- repeat with i = 1 to 35
- QuestionsList[i] = 0
- end repeat
- repeat with i = 1 to 181
- EmptyList[i] = i
- end repeat
- repeat with i = 1 to 35
- ValuePassed = 0
- repeat while not ValuePassed
- TransferVar = EmptyList[random(181)]
- if getPos(QuestionsList, TransferVar) = 0 then
- QuestionsList[i] = TransferVar
- ValuePassed = 1
- end if
- end repeat
- end repeat
- end
-
- on setlastscore
- OpenDB()
- LoadScores()
- closeDB()
- end
-
- on OpenDB
- if TheDB <> 0 then
- closeDB()
- end if
- TheDB = new(xtra("V12DBE"), osdir & "\Quiz.4db", "ReadOnly", "t3223ra")
- TheTable = new(xtra("V12Table"), mGetRef(TheDB), "credits")
- end
-
- on LoadScores
- mOrderBy(TheTable, "Score", "descending")
- mSelect(TheTable)
- mGo(TheTable, 6)
- lastscore = mGetField(TheTable, "Score")
- end
-
- on closeDB
- TheTable = 0
- TheDB = 0
- end
-
- on CheckSound
- if not soundBusy(1) then
- sound playFile 1, "../sound/ark.mp3"
- end if
- end
-