Millisecond Forums

What is scancode for mouse response?

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

By ymin1123 - 9/10/2014

Original script from inquisit used keyboard as an input device, and I'm trying to change input device to mouse. Scancode for space key was 57, but I can't find any scancode for mouse left button.
I tried 84 and 85, but it didn't worked. 
Following is part of the original script (Go-nogo task), and it's coding correct response using scan code (0=noresponse, 57=space bar).
How can I code 'left mouse down' with a number?


<list correctresp>
/ items = (
57,57,57,57,0,
57,57,57,57,0,
57,57,57,57,0,
57,57,57,57,0,
57,57,57,57,0,
57,57,57,57,0,
57,57,57,57,0,
57,57,57,57,0,
57,57,57,57,0,
57,57,57,57,0,
57,57,57,57,0,
57,57,57,57,0,
57,57,57,57,0,
57,57,57,57,0,
57,57,57,57,0,
57,57,57,57,0,
57,57,57,57,0,
57,57,57,57,0,
57,57,57,57,0,
57,57,57,57,0,
57,57,57,57,0,
57,57,57,57,0,
57,57,57,57,0,
57,57,57,57,0,
57,57,57,57,0,

0,0,0,0,57,
0,0,0,0,57,
0,0,0,0,57,
0,0,0,0,57,
0,0,0,0,57,
0,0,0,0,57,
0,0,0,0,57,
0,0,0,0,57,
0,0,0,0,57,
0,0,0,0,57,
0,0,0,0,57,
0,0,0,0,57,
0,0,0,0,57,
0,0,0,0,57,
0,0,0,0,57,
0,0,0,0,57,
0,0,0,0,57,
0,0,0,0,57,
0,0,0,0,57,
0,0,0,0,57,
0,0,0,0,57,
0,0,0,0,57,
0,0,0,0,57,
0,0,0,0,57,
0,0,0,0,57)
/ selectionmode = list.soa.currentindex
</list>
By Dave - 9/10/2014

There are no numerical scancodes for mouse events. What you are looking for is lbuttondown, as detailed in the documentation for the valdiresponse attribute.
By ymin1123 - 9/11/2014

Thanks for your reply!
I tried to add some text to code 'lbuttondown' for response.
Original script defines correct response with '0(no response)' and '57 (space bar)'.
If input and predefined correct response are identical , the input is marked as a correct answer.
I added underlined text to shift 'noresponse' into 0 (same as original script) , and 'lbuttondown response' into '57' and assigned them using a new value (respreal)
.
I ran the script, but values.respreal from data file is '0' all the time (in every trial)!
How can I fix this?
I want to assign 'lbuttondown' as '57' in values.respreal, and 'noresponse' as '0' in values.respreal.
I attached inquisit script file that I modified.

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
Correct Responses (57=spacebar on go trials, 0=no response on no-go trials)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<list correctresp>
/ items = (
57,57,57,57,0,
57,57,57,57,0,
57,57,57,57,0,
57,57,57,57,0,
57,57,57,57,0,
57,57,57,57,0)

<trial target>
/ ontrialbegin = [if (values.correctresp != 0) values.count_go += 1 else values.count_nogo += 1]
/ stimulustimes = [0=target]
/ inputdevice = mousekey
/ validresponse = (lbuttondown, noresponse)
/ ontrialend = [if(trial.target.response=="lbuttondown") {values.respreal=57}]
/ ontrialend = [if(trial.target.response== 0) {values.respreal= 0}]

/ iscorrectresponse = [values.respreal==values.correctresp]


By Dave - 9/11/2014

/ontrialend attributes are executed *after* response evaluation.

You need to fold the logic into the /iscorrectresponse attribute.
By ymin1123 - 9/12/2014

Thanks for reply.
I modified script as you suggested (underlined text), and I fount one problem.
I want to mark response as correct answer if
1) response is 'lbuttondown' &&  values.correctresp == 57
or
2) response is '0 (no response)' &&  values.correctresp == 0

but...inquisit marked response 'correct' when response==0 && values.correctresp ==57 (which should be marked 'wrong').
Is there anything wrong with my logic on script?

**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
Correct Responses (57=spacebar on go trials, 0=no response on no-go trials)
**************************************************************************************************************************************************************************
**************************************************************************************************************************************************************************
<list correctresp>
/ items = (
57,57,57,57,0,
57,57,57,57,0,
57,57,57,57,0,
57,57,57,57,0,
57,57,57,57,0,
57,57,57,57,0)
<trial target>
/ ontrialbegin = [if (values.correctresp != 0) values.count_go += 1 else values.count_nogo += 1]
/ stimulustimes = [0=target]
/ inputdevice = mousekey
/ validresponse = (lbuttondown, noresponse)
/ iscorrectresponse = [(trial.target.response=="lbuttondown" && values.correctresp==57) || (trial.target.response== 0 && values.correctresp== 0)]



By Dave - 9/12/2014

When / where do you set values.correctresp?
By Dave - 9/12/2014

FWIW, there's a minor syntax issue in your /iscorrectresponse attribute. It ought to read

/ iscorrectresponse = [(trial.target.response=="lbuttondown" && values.correctresp==57) || (trial.target.response=="0"&& values.correctresp== 0)]
By ymin1123 - 9/13/2014

Thanks a lot!
Problem solved!