Millisecond Forums

Multiple monkeyresponses

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

By Kolfers - 11/2/2014

Hi,

I was wondering if it is possible to get multiple monkey responses on a trial. 

As it is, I have a trial of a fixed duration, the first two responses that are made in this interval are stored as resp1 and resp2. 
At the end of the trial I have some code that evaluates these two responses.. 

Is it somehow possible to have the monkey give two responses to mimick the above?

Thanks! 

Kerwin
By Dave - 11/2/2014

Since a <trial> element registers a single response only

> As it is, I have a trial of a fixed duration, the first two responses that are made in this interval are stored as resp1 and resp2

this is actually impossible. Surely you must be running multiple instances of a given <trial> or two separate, consecutive <trial> elements.

With that said, /monkeyresponse works just like /validresponse and /correctresponse. You can define as many different responses as you want.
By Kolfers - 11/2/2014

Hi Dave, 

I think I should clarify a bit more. I adapted some code from one of the Dual Task scripts in the Library. In a very stripped down manner, this is what I'm using: 

<trial trial1>
/ stimulustimes = [0 = stim_fixation, stim_square, stim_letter,stim_trialpause, stim_debug]
/ timeout = 2000
/ isvalidresponse = [values.trial_resp = trial.trial1.response; expressions.check_valid_response;]
/ iscorrectresponse = [if(values.trial_resp_1 == 1 && values.trail_resp_2 == 2){values.trial_correct = 1}; values.trial_correct]
/ monkeyresponse = ( "1", "2") 
</trial>

<expressions>
/ check_valid_response =   if( (values.trial_resp == 1 || values.trial_resp == 2) && values.trial_resp_1 == 0) 
{values.trial_resp_1 = values.trial_resp;
if( (values.trial_resp == 1 || values.trial_resp == 2) && values.trial_resp_1 != 0 && values.trial_resp_1 != values.trial_resp)
{values.trial_resp_2 = values.trial_resp;
;(values.trial_resp == 99)
</expressions>

Basically it just stores two responses (unless an escape character is pressed, but that is not part of the task). And since the monkeyresponse only gives 1 response, these trials will never evaluate as correct. 
I hope that makes sense a bit, even if it probably doesn't change the problem.

Thanks,

Kerwin 


By Dave - 11/2/2014

Thanks for the clarification. Although I think there's something amiss with that <expression> as posted (unmatched parentheses, etc.), but that shouldn't matter for the question at hand.

What you'll want to do is something along the lines of

<trial trial1>
...
/ timeout = 2000
/ isvalidresponse = [values.trial_resp = trial.trial1.response; expressions.check_valid_response;]
/ iscorrectresponse = [if(values.trial_resp_1 == 1 && values.trial_resp_2 == 2){values.trial_correct = true}; values.trial_correct]
/ monkeyresponse = (expressions.monkey_response)
</trial>

with

<expressions>
...
/ monkey_response = {values.trial_resp_1=1; values.trial_resp_2=2;}
</expressions>
By Kolfers - 11/2/2014

Hi Dave,

Thanks! Yes I noticed afterwards that some parenthesis had fallen away after the copy-paste. Your suggestion makes a lot of sense, thanks again for the help!

cheers,

Kerwin