Millisecond Forums

How can I count trials with correct response?

https://forums.millisecond.com/Topic16561.aspx

By pawelstrojny - 6/21/2015

Hi, my question is above. My script doesn't count success trials properly. I used command listed below, it was my own invention since I couldn't find one in the instruction.

F7 doesn't report an error, but it has to be some mistake there. Could you help me?

***
<trial maintrialhard>
/ ontrialbegin = [values.currentdigit=counter.randomdigit.selectedvalue]
/ ontrialbegin = [values.counttrialsbeforemanip += 1]
/ ontrialend = [values.lastresponse=trial.maintrialhard.response]
/ ontrialend = [if (trial.maintrialhard == correct) values.correctbefore += 1]
/ stimulusframes = [1=mask; 30=mydigit; 32=mask; 62=instructionrepeat]
/ validresponse = (2,3,4,5,6,7,8)
/ iscorrectresponse = [trial.maintrialhard.response==values.currentdigit+1]
/ branch = [if (contains(values.allowablekeys, values.lastresponse)==false) trial.repeattrialhard]
</trial>

***
By Dave - 6/21/2015

/ ontrialend = [if (trial.maintrialhard == correct) values.correctbefore += 1]

is invalid syntax and ought to read

/ ontrialend = [if (trial.maintrialhard.correct == true) values.correctbefore += 1]

or, even shorter

/ ontrialend = [if (trial.maintrialhard.correct) values.correctbefore += 1]

See the documentation for the <trial> element's 'correct' property for details.