PennController for IBEX › Forums › Support › Mixing fillers and items › Reply To: Mixing fillers and items
May 5, 2020 at 3:40 pm
#5199
Jeremy
Keymaster
Hi Angelica,
You can always use regular javascript alongside PennController commands. So you can do this:
customTrial = label => variable => newTrial( label , defaultText .center() , // Display target word newText("listen_for", "Listen for:") .css({"width": "300px"}) .italic() , newText("target_word", variable.target) .css({"font-size": "200%", "width": "300px"}) , newText("next", "Press the spacebar to continue.") .css({"width": "300px"}) .italic() , newCanvas(300, 300) .add(0, 100, getText("listen_for")) .add(0, 150, getText("target_word")) .add(0, 250, getText("next")) .print() , newKey(" ") .wait() , clear() , // Play audio stimulus and record reaction time newImage("fixation_cross", "fixation_cross.png") .size(300, 300) , newCanvas(300, 300) .add(0, 0, getImage("fixation_cross")) .print() , newKey("reaction_time", " ") .log("all") , newAudio("stimulus", variable.stimulus) .play() .wait() , clear() , // Comprehension question (variable.question?[newText("question", variable.question) .cssContainer({"width": "600px", "font-size": "150%", "height": "50px"}) , newText("answer_1", variable.answer_1) .cssContainer({"width": "300px"}) , newText("answer_2", variable.answer_2) .cssContainer({"width": "300px"}) , newCanvas(600, 300) .add(0, 150, getText("question")) .add(0, 200, getText("answer_1")) .add(300, 200, getText("answer_2")) .print() , newKey("FJ") .wait() .log() ]:null) ) .log("group", variable.group) .log("item", variable.item) .log("condition", variable.cond2) .log("target", variable.target) .log("correct", variable.correct)
Then you can use it like this:
// experimental item trial Template("test_items", customTrial("items") ) // Filler item trial Template("test_fillers", customTrial("fillers") )
Jeremy