PennController for IBEX › Forums › Support › Cannot get the template function to loop over my experiment › Reply To: Cannot get the template function to loop over my experiment
April 12, 2023 at 7:07 am
#10442
![](https://www.pcibex.net/wp-content/uploads/2018/10/IMG_8365-e1540835663655-150x150.jpg)
Keymaster
This question was answered via email, but posting the suggested code here for the sake of future readers:
Template("sentences.csv",variable => newTrial("block"+variable.BlockNum, newTimer("break", 1000).start().wait() , newImage("im",variable.PictureFile).size(400, 400).print() , newTimer("image-item", 600).start().wait() , newText("ts", variable.TargetSentence).center().print() , newTimer("item", 2100).start().wait() , newText("response", variable.ResponseSentence1 + " or " + variable.ResponseSentence2).center().print() , newKey("keypress", "FJ").log().wait() ) ) // ... blocks = [randomize('block1'),randomize('block2'),randomize('block3'),randomize('block4')] fisherYates(blocks) // Ibex-internal function that shuffles an array Sequence("consent","welcome", "instructions", ...blocks, SendResults(), "goodbye")
Jeremy