Thank you. I made this amendment (and a couple others which I have mentioned below) and unfortunately its not fully working, however both Hold Time and Response Time are both now showing in the data csv file but both with a instead of the data.
To clarify would it be
psychoJS.experiment.addData(“Hold Times”, duration);
OR
psychoJS.Practice_Trials_Loop.addData(“Hold Times”, duration);
Perhaps the JS code from the code component would help:
Begin Routine
duration = ;
rt = ;
trialClock = new util.Clock();
kb = new core.Keyboard({psychoJS: psychoJS, clock: new util.Clock(), waitForStart: true});
Each Frame
keys2 = kb.getKeys();
for (var key, _pj_c = 0, _pj_a = keys2, _pj_b = _pj_a.length; (_pj_c < _pj_b); _pj_c += 1) {
key = _pj_a[_pj_c];
if (key.duration) {
duration.push(key.duration);
}
if (key.rt) {
rt.push(key.rt);
}
}
End Routine
psychoJS.experiment.addData(“Hold Times”, duration);
psychoJS.experiment.addData(“Response Time”, rt)
Also posting the other changes I made - I hope this helps someone else!
I changed from trialClock = new core.Clock(); to trialClock = new util.Clock(); in Begin Routine in the JS code as pointed out on this post by wakecarter who says this needs to be manually changed as I got a core.Clock error when running in pavlovia - Thanks: Error: code1Clock = new util.Clock() - #2 by wakecarter
I also changed from kb = new keyboard.Keyboard({“clock”: trialClock}) to kb = new core.Keyboard({psychoJS: psychoJS, clock: new util.Clock(), waitForStart: true}); in the JS code to remove a keyboard undefined error in pavlovia as mentioned in this post here: Failing to use Keyboard in Pavlovia - #2 by dvbridges