PennController for IBEX › Forums › Support › Randomizing trials, with 1/5 of trials followed by a comprehension question › Reply To: Randomizing trials, with 1/5 of trials followed by a comprehension question
Hi! I have a related-ish question. I am partially randomizing the color and order of 4 images on a canvas. After initial randomization, I’d like for the participant to see the same color and order repeatedly, for each practice trial and experimental trial. Is there a way to, after randomization, make a canvas somewhat of a “global variable” that can be called in a later trial?
I am randomizing 4 pics into one of 6 groups with this:
function createColorGroup(int) { var bugba = ["blue", "green", "black", "bugba"]; var gbuba = ["green", "blue", "black", "gbuba"]; var bagbu = ["black", "green", "blue", "bagbu"]; var gbabu = ["green", "black", "blue", "gbabu"]; var babug = ["black", "blue", "green", "babug"]; var bubag = ["blue", "black", "green", "bubag"]; var groups = [bugba, gbuba, bagbu, gbabu, babug, bubag]; return groups[int]; } // color order var generation newTrial("color_order", newVar("colorOrder") .global() .set(color_order_label) ).log("id", getVar("subjID")) .log("color_group", color_order_label)
Then, I am getting images onto the canvas like this:
newImage(getImageEmotion(row.leftImage)+"", leftColor + row.leftImage +"") .cssContainer("border", "solid 2px black") .cssContainer("background-color", "white") //.print() , newImage("calmImage", centerColor + "calmnolabel.jpg") .cssContainer("border", "solid 2px black") .cssContainer("background-color", "white") //.print() , newImage(getImageEmotion(row.rightImage)+"", rightColor + row.rightImage +"") .cssContainer("border", "solid 2px black") .cssContainer("background-color", "white") //.print() , newCanvas("labels", 600, 200) .add("center at 18%", "middle at 50%", getImage(getImageEmotion(row.leftImage)+"")) .add("center at 50%", "middle at 50%", getImage("calmImage")) .add("center at 82%", "middle at 50%", getImage(getImageEmotion(row.rightImage)+"")) .color("yellow") .cssContainer("border", "solid 2px black") .settings.center() .print()
Then, I’d like to do something like this:
Template( GetTable("emoMusicGroupedPracticeV2.csv") , row => newTrial("PracticeEmoMusic", newAudio(row.audiofile) .center() .print() .wait() , newText("Q", "<p>Whose face matches the music?</p>") .center() .css("font-size", "1.5em") .print() , newSelector("eugenies") .once() .frame("dashed 0px white") , getCanvas("labels")
but am running into trouble. Thanks for your help!!