PennController for IBEX › Forums › Support › Response time limit
- This topic has 6 replies, 3 voices, and was last updated 2 years, 2 months ago by Jeremy.
-
AuthorPosts
-
November 29, 2020 at 4:11 am #6399rosa303Participant
Hi Jeremy,
I am writing a script for a speeded acceptability judgment task (using DashedSentence – in place), and I’m facing a problem with the timer function.
I want the participants to respond within 2 seconds; if there is no response within 2 seconds, a warning message appears and then they move on to the next trial by pressing spacebar. They also get a different warning message if the answer is incorrect.
The relevant part of my script looks like:newText("respond", "Yes or No") .print() , //response newTimer("time limit", 2000) .log() .start() , newKey("response", "FJ") .log("first") .callback( getTimer("time limit").stop() ) , getTimer("time limit") .wait() , getKey("response") .test.pressed(row.answer) .failure(newText("negative feedback", "Wrong answer!") .log() .print() .settings.center() .cssContainer({"font-size": "160%", "color": "red"}) ) , getKey("response") .test.pressed() .failure(newText("slow", "Too slow...") .log() .print() .settings.center() .cssContainer({"font-size": "160%", "color": "red"}) ) , newText("continue" , "<p>Press <strong>SPACEBAR</strong></p>") .print() .settings.center() .cssContainer({"font-size": "120%"}) , newKey("spacebar" , " ") .wait()
The problem is that when there is no response within 2sec., the warning signs appear and then when I press spacebar to continue, the screen goes blank and will not continue to the next trial. It only continues if I press one of the response keys first, and then press spacebar.
Could you help me fix my script so that in this timeout case, the warning message appears and then it continues to the next trial when I press spacebar? And is it possible to make only the timeout warning message appear (without the incorrect response warning message) in this case? Right now, they both appear if there is no response within 2 sec.Thanks,
Rosa.November 30, 2020 at 12:17 pm #6404JeremyKeymasterHi Rosa,
I am not able to reproduce your keypress problem: the experiment does proceed to the next trial as soon as I press the spacebar when I see the “Press SPACEBAR” message, regardless of whether or which key I pressed during the 2000ms. Do you have another Key element named “spacebar” in your trial by any chance, or any other conflicting Key element in a Header or a Footer? You could also try disabling Key elements after you’re done with them, e.g. add getKey("response").disable() before your “spacebar” Key element (but again, I can’t identify your problem so it’s just a wild guess)
Regarding the conditional feedback messages, you can do something like this:
getKey("response") .test.pressed() .success( getKey("response").test.pressed(row.answer) .failure(newText("negative feedback", "Wrong answer!") .log() .print() .center() .cssContainer({"font-size": "160%", "color": "red"}) ) ) .failure(newText("slow", "Too slow...") .log() .print() .center() .cssContainer({"font-size": "160%", "color": "red"}) )
Let me know if you have questions
Jeremy
November 30, 2020 at 11:57 pm #6414rosa303ParticipantHi Jeremy,
Thank you for the help on the conditional feedback message. It works!
Regarding the timeout keypress problem, I tried disabling the response keys as you suggested (with a simpler version of my script, below) but I still get the same problem. If I wait and not press anything before the warning message and then press spacebar after the warning message, the next screen is just a white screen. It works fine (moves on to the next trial) if I press a response key before the warning message, within the 2000ms. I only use the spacebar key at the end of each trial.Template( "AA2_items_target_practice.csv", row => newTrial( "target" , //fixation newText("dot", ".") .print() .cssContainer({"font-size": "200%", "color": "white"}) , newText("fixation", "+") .print() .settings.center() .cssContainer({"font-size": "220%"}) , newTimer("wait", 1000) .start() .wait() , getText("dot") .remove() , getText("fixation") .remove() , //RSVP preamble newController("DashedSentence", {s: row.preamble, mode: "speeded acceptability", display: "in place"}) .print() .cssContainer({"font-size": "180%", }) .log() .wait() .remove() , getText("dot") .print() , newText("targetword", row.word) .print() .settings.center() .cssContainer({"font-size": "180%", "color": "green"}) , newText("choice", "<p><strong>F</strong> ...................... <strong>J</strong></p>") .print() .settings.center() .cssContainer("font-size" , "140%") , newText("choice2", "Good ................................ Bad") .print() .settings.center() .cssContainer("font-size" , "120%") , //response newTimer("time limit", 2000) .log() .start() , newKey("response", "FJ") .log("first") .callback( getTimer("time limit").stop() ) , getTimer("time limit") .wait() , getKey("response") .test.pressed() .success( getKey("response").test.pressed(row.answer) .failure(newText("negative feedback", "Wrong answer!") .log() .print() .center() .cssContainer({"font-size": "160%", "color": "red"}) ) ) .failure(newText("slow", "Too slow...") .log() .print() .center() .cssContainer({"font-size": "160%", "color": "red"}) ) , newText("press spacebar" , "<p>Press <strong>SPACEBAR</strong></p>") .print() .settings.center() .cssContainer({"font-size": "120%"}) , getKey("response") .disable() , newKey("spacebar" , " ") .wait() ) .log( "Condition" , row.condition ) .log( "Item" , row.item ) .log( "Targetword" , row.word ) .log( "CorrAns" , row.answer ) ) SendResults()
Best,
Rosa.December 1, 2020 at 12:20 pm #6417JeremyKeymasterHi Rosa,
I was testing your code with a new version of PennController that I hope to release soon, in which I fixed a bug with the Key element, that’s why I didn’t encounter the problem you described. However, as of the latest official release (1.8) that bug still hasn’t been fixed, so you’ll need to replace .log("first") with .log("all") and the problem should go away
Let me know if you still experience problems
Jeremy
December 1, 2020 at 1:26 pm #6419rosa303ParticipantHi Jeremy,
Thank you for your quick response! I changed it to .log(“all”) and it works now, thanks!
Rosa.
September 30, 2022 at 2:59 pm #8655mwf2120ParticipantHi! How would I adapt the code if I want participants to have up to three seconds to select the spacebar (and log when they do so) but if they hit the spacebar before those three seconds, they move on to the next trial and nothing is logged. Any tips for adapting my code?
newTrial("SorF", newText("Stranger","<p><strong>Stranger</strong></p>") .css("font-size", "2.5em") .css("text-align", "center") .settings.center() .print("center at 50%", "bottom at 50%") , newTimer("Timer0",1000).start() .wait() .settings.center() .print() , getText("Stranger") .remove() , newImage("Focus", "Focus_Point.jpg") .center() .settings.center() .print("middle at 50%", "bottom at 50%") , newTimer("Timer1",5000).start() .wait() , getImage("Focus") .remove() , newVideo("three", "CID_3.mp4") .size("70vw", "auto") .settings.center() .print("middle at 50%", "middle at 50%") .play() .disable(0.01) , newKey("space") .wait() )
September 30, 2022 at 5:51 pm #8656JeremyKeymasterHi,
I’m not sure if you want to move on to the next trial without logging any keypress if the participant does press the spacebar before the three seconds have elapsed (and otherwise still wait for a keypress on the spacebar after those three seconds have elapsed, but make sure the keypress is logged), or if you want to automatically move to the next trial after three seconds without logging any keypress if the participant fails to press the spacebar within that time window
The former would look like this:
newKey("space", " ") , newTimer("3s", 3000).callback( getKey("space").log() ).start() , getKey("space").wait()
the latter would look like this:
newTimer("3s",3000).start() , newKey(" ").log("last").callback( getTimer("3s").stop() ) , getTimer("3s").wait()
(Note that with the latter, you’ll still have a line in the results file that says “Never” if the spacebar is pressed after 3s)
Jeremy
-
AuthorPosts
- You must be logged in to reply to this topic.