Hey everyone,
I've been messing around with AMS, and I decided I'd like to make a game based on the rules of "Who Wants to be a Millionaire". So far it's been a success except for one little (major) problem, and that is loading the questions. (The lifelines are going to be a major headache in themselves, but I'll figure that out later when the time comes.)
My ideal goal is to have one page for the quiz and one question database; that way I can create a "Custom Question Creator" sort of thing and have users load in their own questions. Long story short, I'm modifying the quiz template and the included XML file. Instead of having only two question types ("MC" and "MS" I think), I want to have 15, each type corresponding to a certain level of difficulty. For instance, a type of "1" would be the $100 question, and a type of 15 would be the $1,000,000 question.
Where my problem lies is sorting the questions. It randomly generates a table of questions but I want to have it check the type, and if the type does not match, then I want it to find another question. I'm still really new to this (this is only the trial version) so I'm not sure what's going on and which code actually looks at, but if I use a loop then the game freezes. I put the code in the On Preload... section.
Here's what I have so far in this section:
I added the strPath and "result" variables as a test (the remnants of many tests to check for type), but they don't seem to be working. Any pushes in the right direction would be greatly appreciated, and if more information on this project is needed I can post some more tidbits! 
Thanks!
-BT7
I've been messing around with AMS, and I decided I'd like to make a game based on the rules of "Who Wants to be a Millionaire". So far it's been a success except for one little (major) problem, and that is loading the questions. (The lifelines are going to be a major headache in themselves, but I'll figure that out later when the time comes.)
My ideal goal is to have one page for the quiz and one question database; that way I can create a "Custom Question Creator" sort of thing and have users load in their own questions. Long story short, I'm modifying the quiz template and the included XML file. Instead of having only two question types ("MC" and "MS" I think), I want to have 15, each type corresponding to a certain level of difficulty. For instance, a type of "1" would be the $100 question, and a type of 15 would be the $1,000,000 question.
Where my problem lies is sorting the questions. It randomly generates a table of questions but I want to have it check the type, and if the type does not match, then I want it to find another question. I'm still really new to this (this is only the trial version) so I'm not sure what's going on and which code actually looks at, but if I use a loop then the game freezes. I put the code in the On Preload... section.
Here's what I have so far in this section:
Code:
local type = 1 while Table.Count(tbRnd) < nQtA do --strPath = "quiz/items/item:".. nRnd; --sQ2Type = XML.GetAttribute(strPath .."/question", "type"); nRnd = Math.Random(1,Table.Count(tbQtA)); --strPath = "quiz/items/item:".. nRnd; --result = XML.GetAttribute("quiz/items/item:" .. nRnd .."/question", "type"); local nQ = Table.Remove(tbQtA, nRnd); Table.Insert(tbRnd, Table.Count(tbRnd)+1, nQ); end

Thanks!
-BT7
Comment