Stop keyboard component clock resetting on new trials

Hi everyone.

I’ve got a dual task paradigm, with a visual search task in builder, and an auditory task in code

I want to track my reaction times throughout all auditory task trials in relation to the start of my clock, so I can match RT to sound onsets. However every time a new visual search trial occurs, the keyboard component I am using to respond to my auditory task is getting reset, and no longer matches the clock.

I’ve tried having a second keyboard component, but that doesn’t work. I also tried creating the keyboard component in code instead, but it wouldn’t save RT or key names.

Is there a way to manually stop the clock resetting in builder components?

Kind regards,

Rob

You could save the clock time at the beginning and end of each routine using

Begin Routine

thisExp.addData('StartRoutine',myClock.getTime())

End Routine

thisExp.addData('EndRoutine',myClock.getTime())

assuming your global clock is called myClock

Hi Wakefield,

Sadly that only gives me two values, rather than a list. I managed to save all my onset values by saving the time when the sound was played and appending it, thus giving me a complete list. I managed to save the time continuously, the clockreset was set to my current clock of my oddball paradigm, thus giving me continuous values without it being reset, albeit them being negative, but that is a minor issue than can be resolved with some pre-processing in the analysis stage.

Kind regards,

Rob

Hi Rob,

I believe you need a clock that starts just before you enter your trial sequence (so in whatever routine you have before your trial loop in the end routine tab).

You can then get the time at the start of each trial relative to that clock using the code Wakefield suggests and then this value is simply added to all store keyboard rts to get the cummulative response times across trials relative to the start of the trials.

Hope this helps,
Becca

1 Like

Hi Becca,

Thank you so much! I’ll double check what I’ve got an alter my code accordingly.

Kind regards,

Rob