Millisecond Forums

input device

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

By nashby - 11/22/2015

I am having a problem using a mouse as an input device. In my task I have buttons that participants must move the mouse cursor to and then click so I use inputdevice = mouse. Most the time this works, however sometimes things go crazy and the mouse starts taking mouse movements as input alone. If I use inputdevice = mouseclick then there is no ability for them to move the cursor it seems so that is a not a fix. Any suggestions on how to deal with this?


By Dave - 11/22/2015

> the mouse starts taking mouse movements as input alone

You probably have some mistake in your script. Note that mouse movement *can* be a valid response and -- for example -- will be accepted as input when you define

<trial sometrial>
/ inputdevice = mouse
/ validresponse = (anyresponse)
...
</trial>
By nashby - 11/24/2015

They need to be able to move the mouse freely to an object  on the screen but its only a valid response if they then click it.

Is there a specific command for that?
By Dave - 11/24/2015

You define /inputdevice = mouse and the *name* of the object as /validresponse. Suppose the object they need to click on is called "button", you define

<trial sometrial>
/ stimulusframes = [1= ..., button, ...]
/ inputdevice = mouse
/ validresponse = (button)
...
</trial>

If you have multiple objects that are supposed to be clickable / count as a response, you do

<trial sometrial>
/ stimulusframes = [1= ..., button1, button2, button3, ...]
/ inputdevice = mouse
/ validresponse = (button1, button2, button3)
...
</trial>

and so forth.
By nashby - 11/24/2015

But thats exactly what I do and yet it still sometimes decides to take mousemovements.

For example this trial will most the time only work if someone clicks on the left or right option, but sometimes a mouse movement will be accepted:

<trial choicegain>
/ stimulusframes = [1 = Leftoption, Rightoption;]
/ validresponse = (Leftoption, Rightoption)
/ recorddata = true
/ ontrialbegin = [values.prob = round(rand(1,100)); values.choice += 1;]
/ ontrialend = [if(trial.choicegain.response == "LeftOption" && values.side > 50 && values.prob <= 10) {values.outcome = 1; values.leftoutcome = 1; text.leftoutcome.item.1 = "1 ₪"; values.rightoutcome = 10; text.rightoutcome.item.1 = "10 ₪"; trial.outcome.trialduration = 5000; values.picked = 0; values.spicked = 0} ]
/ ontrialend = [if(trial.choicegain.response == "RightOption" && values.side <= 50 && values.prob <= 10) {values.outcome = 1; values.rightoutcome = 1; text.rightoutcome.item.1 = "1 ₪"; values.leftoutcome = 10; text.leftoutcome.item.1 = "10 ₪"; trial.outcome.trialduration = 5000; values.picked = 0; values.spicked = 1} ]
/ ontrialend = [if(trial.choicegain.response == "LeftOption" && values.side > 50 && values.prob > 10) {values.outcome = 1; values.leftoutcome = 1; text.leftoutcome.item.1 = "1 ₪"; values.rightoutcome = 0; text.rightoutcome.item.1 = "0 ₪"; trial.outcome.trialduration = 1000; values.picked = 0; values.spicked = 0} ]
/ ontrialend = [if(trial.choicegain.response == "RightOption" && values.side <= 50 && values.prob > 10) {values.outcome = 1; values.rightoutcome = 1; text.rightoutcome.item.1 = "1 ₪"; values.leftoutcome = 0; text.leftoutcome.item.1 = "0 ₪"; trial.outcome.trialduration = 1000; values.picked = 0; values.spicked = 1} ]

/ ontrialend = [if(trial.choicegain.response == "LeftOption" && values.side <= 50 && values.prob <= 10) {values.outcome = 10; values.leftoutcome = 10; text.leftoutcome.item.1 = "10 ₪"; values.rightoutcome = 1; text.rightoutcome.item.1 = "1 ₪"; trial.outcome.trialduration = 5000; values.picked = 1; values.spicked = 0} ]
/ ontrialend = [if(trial.choicegain.response == "RightOption" && values.side > 50 && values.prob <= 10) {values.outcome = 10; values.rightoutcome = 10; text.rightoutcome.item.1 = "10 ₪"; values.leftoutcome = 1; text.leftoutcome.item.1 = "1 ₪"; trial.outcome.trialduration = 5000; values.picked = 1; values.spicked = 1} ]
/ ontrialend = [if(trial.choicegain.response == "LeftOption" && values.side <= 50 && values.prob > 10) {values.outcome = 0; values.leftoutcome = 0; text.leftoutcome.item.1 = "0 ₪"; values.rightoutcome = 1; text.rightoutcome.item.1 = "1 ₪"; trial.outcome.trialduration = 1000; values.picked = 1; values.spicked = 0} ]
/ ontrialend = [if(trial.choicegain.response == "RightOption" && values.side > 50 && values.prob > 10) {values.outcome = 0; values.rightoutcome = 0; text.rightoutcome.item.1 = "0 ₪"; values.leftoutcome = 1; text.leftoutcome.item.1 = "1 ₪"; trial.outcome.trialduration = 1000; values.picked = 1; values.spicked = 1} ]
</trial>

By Dave - 11/24/2015

Please be so kind and attach a runnable / self-contained excerpt that displays this behavior. It is not possible to diagnose the issue based on an isolated code snippet. Thanks.
By nashby - 11/25/2015

Attached it so as to not flood the window. Thanks for your help as always Dave :)
By nashby - 11/25/2015

Forgot it will ask for three image files you can just delete those parts of code out, I get the error either way.
By Dave - 11/25/2015

Thanks for attaching the file. I see no obvious issue with it and am so far unable to reproduce the behavior you observed, i.e., <trial choicegain> or <trial choiceloss> taking mere mouse movement as input.

In the script you attached, however, there are some apparent mistakes in <trial choiceloss> which will prevent the task from working properly.

<trial choiceloss>
/ stimulusframes = [1 = Leftoption, Rightoption;]
/ validresponse = (Leftoption, Rightoption)
/ recorddata = true
/ ontrialbegin = [values.prob = round(rand(1,100)); values.choice += 1;]

/ ontrialend = [if(trial.choicegain.response == "LeftOption" && values.side > 50 && values.prob <= 10) {values.outcome = -1; values.leftoutcome = -1; text.leftoutcome.item.1 = "-1 ₪"; values.rightoutcome = -10; text.rightoutcome.item.1 = "-10 ₪"; trial.outcome.trialduration = 5000} ]
/ ontrialend = [if(trial.choicegain.response == "RightOption" && values.side <= 50 && values.prob <= 10) {values.outcome = -1; values.rightoutcome = -1; text.rightoutcome.item.1 = "-1 ₪"; values.leftoutcome = -10; text.leftoutcome.item.1 = "-10 ₪"; trial.outcome.trialduration = 5000} ]
/ ontrialend = [if(trial.choicegain.response == "LeftOption" && values.side > 50 && values.prob > 10) {values.outcome = -1; values.leftoutcome = -1; text.leftoutcome.item.1 = "-1 ₪"; values.rightoutcome = 0; text.rightoutcome.item.1 = "0 ₪"; trial.outcome.trialduration = 1000} ]
/ ontrialend = [if(trial.choicegain.response == "RightOption" && values.side <= 50 && values.prob > 10) {values.outcome = -1; values.rightoutcome = -1; text.rightoutcome.item.1 = "-1 ₪"; values.leftoutcome = 0; text.leftoutcome.item.1 = "0 ₪"; trial.outcome.trialduration = 1000} ]

/ ontrialend = [if(trial.choicegain.response == "LeftOption" && values.side <= 50 && values.prob <= 10) {values.outcome = -10; values.leftoutcome = -10; text.leftoutcome.item.1 = "-10 ₪"; values.rightoutcome = -1; text.rightoutcome.item.1 = "-1 ₪"; trial.outcome.trialduration = 5000} ]
/ ontrialend = [if(trial.choicegain.response == "RightOption" && values.side > 50 && values.prob <= 10) {values.outcome = -10; values.rightoutcome = -10; text.rightoutcome.item.1 = "-10 ₪"; values.leftoutcome = -1; text.leftoutcome.item.1 = "-1 ₪"; trial.outcome.trialduration = 5000} ]
/ ontrialend = [if(trial.choicegain.response == "LeftOption" && values.side <= 50 && values.prob > 10) {values.outcome = 0; values.leftoutcome = 0; text.leftoutcome.item.1 = "0 ₪"; values.rightoutcome = -1; text.rightoutcome.item.1 = "-1 ₪"; trial.outcome.trialduration = 1000} ]
/ ontrialend = [if(trial.choicegain.response == "RightOption" && values.side > 50 && values.prob > 10) {values.outcome = 0; values.rightoutcome = 0; text.rightoutcome.item.1 = "0 ₪"; values.leftoutcome = -1; text.leftoutcome.item.1 = "-1 ₪"; trial.outcome.trialduration = 1000} ]

/ ontrialend = [if((trial.choiceloss.response == "LeftOption" && values.side <= 50)||(trial.choiceloss.response == "RightOption" && values.side > 50)){values.picked = 1} else {values.picked = 0}]
/ ontrialend = [if(values.leftoutcome == 10||values.leftoutcome==-10||values.rightoutcome == 10||values.rightoutcome ==- 10) {trial.outcome.trialduration = 5000} else {trial.outcome.trialduration = 1000}]
</trial>

As you can see, almost the entire /ontrialend logic in that <trial> erroneously refers to <trial choicegain>'s response property. This doesn't look right to me and almost certainly will prevent the script from working as you intend it to.

If -- after correcting the above -- you still observe (seemingly) erroneous behavior (trials advancing on mere mouse movement), it would be great if you could do the following:

#1: To make sure we're on the same page testing-wise: Is your Inquisit installation up to date? If not, please update it to the latest release and check if the issue persists.
#2: If the issue persists, what's the OS (type and version) of the affected system? Have you observed the issue on other systems as well?
#3: For trials that advance on mouse movement, what is recorded in the data file's response column for the respective trial *and* the one preceding it?

Thanks.