PennController for IBEX › Forums › Support › Repeat sample trial with audio recording › Reply To: Repeat sample trial with audio recording
March 9, 2021 at 11:16 pm
#6708
Jeremy
Keymaster
Hi,
This is a problem that has to do with how I coded the Controller element. Add this to your script, and replace .print().wait().remove()
with simply .run()
on your Controller element:
PennController._AddStandardCommands( function(PennEngine) { this.actions = { run: async function(resolve){ if (this.type != "Controller" || this.controller != "DashedSentence") return resolve(); this.done = false; await new Promise(r=>PennEngine.elements.standardCommands.actions.print.call(this,r)); const oldCallback = this.finishedCallback; await new Promise(r=>this.finishedCallback=function(){ oldCallback.call(this); this.jQueryContainer.detach(); r(); }); resolve(); } } })
You also want to change your trial’s code slightly:
newTrial("practice-trial", newButton("launch-practice-trial", "Redo") .callback( ...PracticeTrial() , getButton("proceed").print() , getButton("launch-practice-trial").print() ) .center() .click() , newButton("proceed", "Proceed") .center() .wait() )
Here’s a demo link: https://farm.pcibex.net/r/AjyfGD/
Let me know if you have any questions
Jeremy