I'm making a project, and I have a list with questions and a list with answers.
I want to pick a random question till the I run out of questions in the questionlist, and I don't want to repeat the questions.
CAn anyone help please?
Offline
Try this:
when gf clicked set [counter v] to [1] delete [all v] of [asked v] repeat (length of [questions v]) if <[asked v] contains (counter)> repeat until <not <[asked v] contains (counter)>> set [counter v] to (pick random [1] to (length of [questions v])) end end ask (item (counter) of [questions v]) and wait if <(answer) = (item (counter) of [answers v])> change [score v] by [1] else change [score v] by [-1] end add (counter) to [asked v] end stop allMake sure that the answer to question #4 from the list "questions" is in the 4th position in the "answers" list.
Last edited by Prestige (2012-11-25 10:17:50)
Offline
repeat until <(length of [questions v]) = (0)> set (question_to_ask) to (pick random (1) to (length of [questions v])) ask (item (question_to_ask) of [questions v]) and wait add (answer) to [answers v] delete (question_to_ask) of [questions v] endThe variables/lists above are needed.
Offline
mathfreak231's script works but isn't ideal, as it deletes the question. My script doesn't delete the question but just the used numbers, so you don't have to add all the questions back in at the start of the project.
Offline
Prestige wrote:
mathfreak231's script works but isn't ideal, as it deletes the question. My script doesn't delete the question but just the used numbers, so you don't have to add all the questions back in at the start of the project.
Then make a third table, and put this in a sprite:
when gf clicked set [iter v] to [1] //Need this variable repeat (length of [questions_to_add v]) add (item (iter) of [questions_to_add v]) to [questions v] change [iter v] by (1) end
Offline