Hello,
Thank you for the suggestion regarding modifying the msg
part. We also resolved the issue of displaying the accuracy by leveraging the answer from this post with ChatGPT. Here is the code if anyone is interested.
var nCorr = 0; // total number of correct trials
var countEachResp = 0; // total number of trials
for (let eachResp = 0; eachResp < psychoJS.experiment._trialsData.length; eachResp++) {
if ('TrialResp.corr' in psychoJS.experiment._trialsData[eachResp]) {
nCorr += psychoJS.experiment._trialsData[eachResp]['TrialResp.corr'];
countEachResp++; // Increment only if 'TrialResp.corr' exists
}
}
// calculate accuracy
ACCmean = ( nCorr / countEachResp)*100;