PennController for IBEX › Forums › Support › Controller or Timer conditional
Tagged: condition, controller, timer
- This topic has 2 replies, 2 voices, and was last updated 2 years, 4 months ago by emauffray.
-
AuthorPosts
-
April 28, 2022 at 2:14 am #8120emauffrayParticipant
Hi Jeremy,
Thank you for the support! I have another question. I am trying to have trials that move to the next one when the participant either responds to the Controller (Acceptability Judgment) or the timer runs out. I have been searching forums but was unable to find documentation about stopping the timer if the Controller has a response. Here’s a sample trial where I tried to use callback function:
newTrial("trial-1", defaultText .center() .print() , newAudio("llego-profesora", "La_profesora_llegó_a_la_clase_en_la.mp3") .play() , newText("llego-profesora-t", "La profesora llegó a la clase en la momento preciso.") .center() .unfold(3650) , getAudio("llego-profesora") .wait("first") , newTimer("hurry", 3000) , newController("AcceptabilityJudgment", {q: "¿Es esta oración aceptable?", s: "", as : ["SÍ", "NO"], instructions : "Haz clic, SÍ o NO", presentAsScale : true, leftComment : "es aceptable", rightComment : "no es aceptable"}) .center() .print() .log() .callback(getTimer("hurry").stop()) , getTimer("hurry") .wait() ) ;
Here’s a link to my experiment.
Any advice is greatly appreciated! Thank you for your continued support!
Sincerely,
ErinApril 28, 2022 at 11:36 am #8121JeremyKeymasterHi Erin,
There are two issues with the code above: 1) the Timer element is not
start
ed, so it will bewait
ed for forever, and 2) there seems to be a bug in thecallback
command of the Controller element!So you’ll need to work around the Controller element’s
callback
command. Here’s a suggestion, which consists in placing await
command inside anothercallback
command (this time, a bug-free one, called on a Timer element) so thatwait
does not block the main thread of execution:newTrial("trial-1", defaultText .center() .print() , newAudio("llego-profesora", "La_profesora_llegó_a_la_clase_en_la.mp3") .play() , newText("llego-profesora-t", "La profesora llegó a la clase en la momento preciso.") .center() .unfold(3650) , getAudio("llego-profesora") .wait("first") , newTimer("hurry", 3000).start() , newTimer("dummy", 1) .callback( newController("AcceptabilityJudgment", { q: "¿Es esta oración aceptable?", s: "", as : ["SÍ", "NO"], instructions : "Haz clic, SÍ o NO", presentAsScale : true, leftComment : "es aceptable", rightComment : "no es aceptable" }) .center() .print() .log() .wait() , getTimer("hurry").stop() ) .start() , getTimer("hurry").wait() )
Jeremy
April 28, 2022 at 4:34 pm #8124emauffrayParticipantThis worked perfectly! Thank you so much!
-
AuthorPosts
- You must be logged in to reply to this topic.