URL of experiment: Pavlovia
Description of the problem: In my experiment, participants are asked to rate how morally wrong a vignette is. The text component I used to display the vignette draws the content of the text from an excel file. I used the code component to randomize the gender of the character in the vignette with this code (MalePerp, FemalePerp, and UnisexPerp are column names in the excel file)
RandomNum = Math.random();
function shuffle(PictureList){
};
if ((RandomNum <= 0.33)) {
TextShown = MalePerp;
PictureShown = "MalePicture.png";
} else {
if (((0.33 < RandomNum) && (RandomNum <= 0.66))) {
TextShown = FemalePerp;
PictureShown = "FemalePicture.png";
} else {
TextShown = UnisexPerp;
var PictureShown = PictureList[0];
}
}
However, this doesn’t work and instead of drawing from the excel file, it just says “Hello World” in every routine. This method works locally, and since I don’t really know anything about js I can’t seem to figure it out.