I am creating a multiple choice quiz within krpano, which has a pool of about 50 questions in xml with names q1,q1,q3 etc. I want to load 8 random questions from that list but check that the question hasnt been loaded before.
So I created an array storing the question names:
Code
createarray(questionArray);
<!-- store questions in array -->
for(set(i,0), i LT numOfQuestions, inc(i),
set(questionArray[get(i)].value, get(questions[get(quizName)].question[get(i)].name));
);
Then pick a random question and remove it from the array:
Code
mul(ranQuestionNum, random, questionArray.count);
add(ranQuestionNum, 1);
roundval(ranQuestionNum);
txtadd(currQuestionName, questionArray[get(ranQuestionNum)].value);
questionArray.removearrayitem(get(ranQuestionNum));
So far that works but I cant get the text to populate from the currQuestionName:
Code
set(layer[question_text].html, get(questions[get(quizName)].question[get(currQuestionName)].text));
Any ideas?