I have created a pretty simple math game for my class. all i need is a script that will help me shuffle the answers so the answer isnt always in the same place. PLEASE HELP!!!!!
Offline
EDITING
I think you need:
[scratchblocks]
repeat (question)
Offline
Let's say you have the questions stored as elements in a list. If you want to shuffle them, do something like this.
when I receive [shuffle v] delete (all v) of [QuestionCopies v] // Stores a copy of the questions delete (all v) of [QuestionRandom v] // Stores a randomly-ordered set of questions set [i v] to [0] repeat (length of [Questions v]) // Copies the questions to a new list change [i v] by (1) add (item (i) of [Questions v]) to [QuestionCopies v] end repeat until <(length of [QuestionCopies v]) = [0]> set [InsertIndex v] to (pick random (1) to (length of [QuestionCopies v])) add (item (InsertIndex) of [QuestionCopies v]) to [QuestionRandom v] delete (InsertIndex) of [QuestionCopies v] end
Offline
If it's in a variable, do:
when gf clicked set [Varrandom v] to (pick random (1) to (# of questions)) if <(Varrandom v)=(number)> ask [question] and wait endAnd repeat for all of your questions.
Last edited by poemon1 (2012-05-21 06:27:45)
Offline