Millisecond Forums

count mouse clicking

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

By luhe - 10/24/2018

Dear Inquisit community,

Is there a way to obtain the amount of mouse clicks that the subject has made per trial?
I'm using a reaction time task and want to give a warning in case participants click the mouse permanently to be as quick as possible once the target stimulus is presented.

Thanks in advance!
Best regards,
Lu
By Dave - 10/24/2018

luhe - Wednesday, October 24, 2018
Dear Inquisit community,

Is there a way to obtain the amount of mouse clicks that the subject has made per trial?
I'm using a reaction time task and want to give a warning in case participants click the mouse permanently to be as quick as possible once the target stimulus is presented.

Thanks in advance!
Best regards,
Lu

You can theoretically count the clicks per a bit of /isvalidresponse logic. Basically something like this:

<values>
/ pretargetclicks = 0
</values>

<block myblock>
/ trials = [1-4 = mytrial]
</block>

<trial mytrial>
/ ontrialbegin = [values.pretargetclicks=0]
/ stimulustimes = [0=fixation; 3000=target]
/ inputdevice = mouse
/ validresponse = (lbuttondown)
/ isvalidresponse = [if(trial.mytrial.response == "lbuttondown" && trial.mytrial.latency <= 3000) {values.pretargetclicks+=1; false} else true]
/ beginresponsetime = 0
/ branch = [if (values.pretargetclicks > 0) trial.warning]
</trial>

<trial warning>
/ stimulusframes = [1=warningmsg]
/ validresponse = (0)
/ trialduration = 2000
</trial>

<text fixation>
/ items = ("+")
</text>

<text target>
/ items = ("A", "B", "C", "D")
</text>

<text warningmsg>
/ items = ("You clicked <%values.pretargetclicks%> times before the target appeared. Please don't do this.")
/ txcolor = red
</text>


By luhe - 10/29/2018

Dave - Wednesday, October 24, 2018
luhe - Wednesday, October 24, 2018
Dear Inquisit community,

Is there a way to obtain the amount of mouse clicks that the subject has made per trial?
I'm using a reaction time task and want to give a warning in case participants click the mouse permanently to be as quick as possible once the target stimulus is presented.

Thanks in advance!
Best regards,
Lu

You can theoretically count the clicks per a bit of /isvalidresponse logic. Basically something like this:

<values>
/ pretargetclicks = 0
</values>

<block myblock>
/ trials = [1-4 = mytrial]
</block>

<trial mytrial>
/ ontrialbegin = [values.pretargetclicks=0]
/ stimulustimes = [0=fixation; 3000=target]
/ inputdevice = mouse
/ validresponse = (lbuttondown)
/ isvalidresponse = [if(trial.mytrial.response == "lbuttondown" && trial.mytrial.latency <= 3000) {values.pretargetclicks+=1; false} else true]
/ beginresponsetime = 0
/ branch = [if (values.pretargetclicks > 0) trial.warning]
</trial>

<trial warning>
/ stimulusframes = [1=warningmsg]
/ validresponse = (0)
/ trialduration = 2000
</trial>

<text fixation>
/ items = ("+")
</text>

<text target>
/ items = ("A", "B", "C", "D")
</text>

<text warningmsg>
/ items = ("You clicked <%values.pretargetclicks%> times before the target appeared. Please don't do this.")
/ txcolor = red
</text>



Hi Dave,

Thank you very much for your quick response!

Cheers,
Lutz