PennController for IBEX › Forums › Support › Restart trial › Reply To: Restart trial
June 21, 2021 at 10:14 pm
#7073
Jeremy
Keymaster
You cannot use getVar
that way, as explained in this guide I mentioned earlier
Your first attempt was on the right track, but maybe you forgot to include the trial number in addition to the selection index?
const whichOne = (numbers, selectorName, ex) => numbers.map( number => getSelector(selectorName).test.selected(getImage("o" + number)) .success( newAudio("o" + number + "selected", "ex" + ex + "o" + number + ".m4a") .play() .wait() , getVar("selected").set(number) ) )
and then use it like this:
...whichOne([1,2,3,4,5,6], "response", exNum)
Jeremy