April 1, 2021 at 3:30 pm #6803gzlkjParticipant
I have two audio files in each trial and a selector element. I want to make sure the participants have clicked on the play button of the two files before selecting one of the options from the selector. My first idea was to use the .test.hasPlayed command in a wait condition for a button then move on to the selector element, but that resulted in having me click on the button twice. I might have other trials where there’s only one audio, but I thought there should be a better simpler solution for this that I’m not seeing in the documentation. Although I found this other post about clicking on buttons, I wasn’t sure how I could implement it similarly for this trial I have (code below):
newTrial ("practice" , newCanvas("audio", 800, 80) .add( 20, 18, newAudio("soundl", row.PL_Audio) ) .add( 500, 18, newAudio("soundr", row.PR_Audio) ) .print() .center() , newCanvas("pairs", 800, 200) .add( 80, 60, newText("left", row.PL) ) .add( 560, 60, newText("right", row.PR) ) .print() .center() , newSelector("comparison") .add( getText("left") , getText("right") ) .print() .wait() .log() .once() )
and I also wanted to say thanks for the effort you put in for making the new farm available. It’s amazing!
-ZaraApril 1, 2021 at 3:43 pm #6804JeremyKeymaster
.test.hasPlayedsounds like a good idea, and there would be a way to make it work. But if you want to automatically move on to the Selector element immediately after the second audio has played back, there is a simpler way: just insert
newSelectorline. Because of the
"first"argument, even if soundl is played after soundr, the two
waits will be validated in a row because
"first"in the second
waitwill automatically detect that soundr was played back before
Let me know if that worked
JeremyApril 1, 2021 at 5:47 pm #6807gzlkjParticipant
Thank you! It looks like it’s working as it should.
I really appreciate the quick reply, that was helpful. I’ve seen the “first” argument somewhere in the documentation of the old farm before, but it didn’t occur to me that I can use it here.
- You must be logged in to reply to this topic.