Changing the input device on trial begin/ recoding correct key to work for mouse input


Changing the input device on trial begin/ recoding correct key to work...
Author
Message
Christin41
Christin41
Associate Member (62 reputation)Associate Member (62 reputation)Associate Member (62 reputation)Associate Member (62 reputation)Associate Member (62 reputation)Associate Member (62 reputation)Associate Member (62 reputation)Associate Member (62 reputation)Associate Member (62 reputation)
Group: Forum Members
Posts: 12, Visits: 67
I have coded my experiment with correct/valid responses being keyboard inputs but would now like to change it to mouse input (left and right mouse click) instead. 

So what I had was (among other code of course):

<values>
/ reference_odor_item = 0
/ comparison_odor_item = 0
/ odor_1_item = 0
/ odor_2_item = 0
/ is_reference = ""
/ correctkey = 0
</values>

<trial discrimination>
/ ontrialbegin = [
  values.reference_odor_item = list.reference_odors.nextvalue;
  values.comparison_odor_item = list.comparison_odors.nextvalue;
  values.is_reference = list.is_reference_list.nextvalue;
]
/ ontrialbegin = [
  if (values.is_reference == "odor_1") {
   values.odor_1_item = values.reference_odor_item;
   values.odor_2_item = values.comparison_odor_item;
   values.correctkey = lbuttondown;
  } else if (values.is_reference == "odor_2") {
   values.odor_1_item = values.comparison_odor_item;
   values.odor_2_item = values.reference_odor_item;
   values.correctkey = 38;
  };
]
/ stimulustimes = [0=3; 1000=2; 2000=1; 2850=reference_odor; 3000=inhale; 3000=reference_label; 5000=empty;
                7000=3; 8000=2; 9000=1; 9850=odor_1; 10000=inhale; 10000=odor1_label; 12000=empty;
                14000=3; 15000=2; 16000=1; 16850=odor_2; 17000=inhale; 17000=odor2_label; 19000=empty;
                21000=odor1_response; 21000=odor2_response; 21000=discrim_quest]
/ validresponse = (30, 38)
/ beginresponsetime = 21000
/ pretrialpause = 1000
/ iscorrectresponse = [
  trial.discrimination.response == values.correctmouseevent
]
</trial>


I now did the following changes (see what is printed bold): 

<values>
/ reference_odor_item = 0
/ comparison_odor_item = 0
/ odor_1_item = 0
/ odor_2_item = 0
/ is_reference = ""
/ correctmouseevent = rbuttondown
</values>

<trial discrimination>
/ ontrialbegin = [
values.reference_odor_item = list.reference_odors.nextvalue;
values.comparison_odor_item = list.comparison_odors.nextvalue;
values.is_reference = list.is_reference_list.nextvalue;
]
/ ontrialbegin = [
if (values.is_reference == "odor_1") {
 values.odor_1_item = values.reference_odor_item;
 values.odor_2_item = values.comparison_odor_item;
 values.correctmouseevent = lbuttondown;
} else if (values.is_reference == "odor_2") {
 values.odor_1_item = values.comparison_odor_item;
 values.odor_2_item = values.reference_odor_item;
 values.correctmouseevent = rbuttondown;
};
]
/ stimulustimes = [0=3; 1000=2; 2000=1; 2850=reference_odor; 3000=inhale; 3000=reference_label; 5000=empty;
      7000=3; 8000=2; 9000=1; 9850=odor_1; 10000=inhale; 10000=odor1_label; 12000=empty;
      14000=3; 15000=2; 16000=1; 16850=odor_2; 17000=inhale; 17000=odor2_label; 19000=empty;
      21000=odor1_response; 21000=odor2_response; 21000=discrim_quest]
/ validresponse = (lbuttondown, rbuttondown)
/ inputdevice = mousekey
/ beginresponsetime = 21000
/ pretrialpause = 1000
/ iscorrectresponse = [
trial.discrimination.response == values.correctmouseevent
]
</trial>

The only error that I now still get is that the 'lbuttondown' expression within the if - else if expression in /ontrialbegin (the one I colored red) "contains an unknown element or property name." I suppose this is the case because Inquisit does not know, on trial begin, that the input device has changed from its default. I was, thus, wondering how this can be communicated to Inquisit or whether I am wrong and something else needs to be changed about my code.

Thousand thanks in advance!
Christin41
Christin41
Associate Member (62 reputation)Associate Member (62 reputation)Associate Member (62 reputation)Associate Member (62 reputation)Associate Member (62 reputation)Associate Member (62 reputation)Associate Member (62 reputation)Associate Member (62 reputation)Associate Member (62 reputation)
Group: Forum Members
Posts: 12, Visits: 67
I of course meant  values.correctkey = 30 within the code that I first had and not values.correctkey = lbuttondown, as it says now. 

Sorry about that!
Dave
Dave
Supreme Being (893K reputation)Supreme Being (893K reputation)Supreme Being (893K reputation)Supreme Being (893K reputation)Supreme Being (893K reputation)Supreme Being (893K reputation)Supreme Being (893K reputation)Supreme Being (893K reputation)Supreme Being (893K reputation)
Group: Administrators
Posts: 10K, Visits: 63K
Christin41 - 12/15/2020
I of course meant  values.correctkey = 30 within the code that I first had and not values.correctkey = lbuttondown, as it says now. 

Sorry about that!

You need double quotes:

<values>
/ reference_odor_item = 0
/ comparison_odor_item = 0
/ odor_1_item = 0
/ odor_2_item = 0
/ is_reference = ""
/ correctmouseevent = "rbuttondown"
</values>

<trial discrimination>
/ ontrialbegin = [
values.reference_odor_item = list.reference_odors.nextvalue;
values.comparison_odor_item = list.comparison_odors.nextvalue;
values.is_reference = list.is_reference_list.nextvalue;
]
/ ontrialbegin = [
if (values.is_reference == "odor_1") {
values.odor_1_item = values.reference_odor_item;
values.odor_2_item = values.comparison_odor_item;
values.correctmouseevent = "lbuttondown";
} else if (values.is_reference == "odor_2") {
values.odor_1_item = values.comparison_odor_item;
values.odor_2_item = values.reference_odor_item;
values.correctmouseevent = "rbuttondown";
};
]
/ stimulustimes = [0=3; 1000=2; 2000=1; 2850=reference_odor; 3000=inhale; 3000=reference_label; 5000=empty;
  7000=3; 8000=2; 9000=1; 9850=odor_1; 10000=inhale; 10000=odor1_label; 12000=empty;
  14000=3; 15000=2; 16000=1; 16850=odor_2; 17000=inhale; 17000=odor2_label; 19000=empty;
  21000=odor1_response; 21000=odor2_response; 21000=discrim_quest]
/ validresponse = (lbuttondown, rbuttondown)
/ inputdevice = mousekey
/ beginresponsetime = 21000
/ pretrialpause = 1000
/ iscorrectresponse = [
trial.discrimination.response == values.correctmouseevent
]
</trial>



GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search