PennController for IBEX › Forums › Support › repeating commmands › Reply To: repeating commmands
January 18, 2021 at 1:34 pm
#6523
Jeremy
Keymaster
If you only need to print one question per slide, and want to randomly order your slides, you could do something like this:
Sequence( randomize("mcq") ) newTrial( "mcq" , newText("Are you male or female?").print() , newScale("gender", "male", "female") .labelsPosition("right") .print() .wait() ) newTrial( "mcq" , newText("What is your favorite color?").print() , newScale("color", "blue", "purple") .labelsPosition("right") .print() .wait() ) newTrial( "mcq" , newText("Are you 20 or 25?").print() , newScale("age", "20", "25") .labelsPosition("right") .print() .wait() )
Now if your trial sequence is more complex and you want to randomly insert one of those trials inside at different points in your sequence, you’ll need something more sophisticated. For example, you could use the function pick from this thread, like this:
mcqs = randomize("mcq") Sequence( "intro" , pick(mcqs,1) , randomize("block1") , pick(mcqs,1) , randomize("block2") , pick(mcqs,1) , "end" )
Let me know if you have questions
Jeremy