+x+x+x
Hi Dave, it looks like this works! However, it's brought up another question.
At current, I am creating a loop on the same trial until the user makes a mouse click within a certain region of the screen. So when I loop back, it re-centers the mouse and essentially makes finishing the trial impossible.
Any recommendations on a workaround? I've tried setting the mouse.x & y at the end of the previous trial, but this appears to break my branching...
<trial first_recall3>
/ stimulustimes = [0 = color_wheel, FixationCross, resp_probe, probe2_holder, probe3_holder]
/ inputdevice = mouse
/ validresponse = ("lbuttondown")
/ timeout = 50
/ recorddata = true
/ ontrialend = [
values.temp_resp = trial.first_recall3.response;
values.final_RT = trial.first_recall3.latency;
values.recall_x = mouse.x-parameters.center_x;
values.recall_y = mouse.y-parameters.center_y;
values.recall_radius = sqrt(pow(values.recall_x, 2)+pow(values.recall_y, 2));
if (abs(parameters.wheel_r_px-values.recall_radius)<parameters.wheel_inrange_px){
values.recall_inrange = 1
} else {
values.recall_inrange = 0
}
values.recall_angle = atan2(values.recall_y, values.recall_x)*180/M_PI;
if (values.recall_angle<=0){
values.recall_angle=values.recall_angle+360;
};
values.recall_angle_index = round(values.recall_angle)+(values.current_wheel*30);
if (values.recall_angle_index>360){
values.recall_angle_index = values.recall_angle_index-360;
};
]
/ branch = [
if (values.recall_inrange == 1 && values.recall_angle_index>0){
values.resp_index = values.recall_angle_index;
if (trial.first_recall3.response == "lbuttondown"){
trial.last_recall3
} else {
trial.first_recall3
};
} else {
trial.first_recall3
};
]
</trial>
Sorry, that code snippet is not helpful. Could you please comment your code? It's also unclear what "previous trial" refers to, I only see code for a single trial element. I also cannot find any spot in the code snippet you posted where you recenter the mouse.
<trial first_recall3> # Participant is going to report a cued color from a color wheel
/ stimulustimes = [0 = color_wheel, FixationCross, resp_probe, probe2_holder, probe3_holder] # At start, a color wheel, fixation cross, and 3 empty circles are shown at the location of 3 original memoranda
/ inputdevice = mouse
/ validresponse = ("lbuttondown") # The participant is going to report the remembered color by clicking on the color wheel where that color falls
/ timeout = 50 # We loop the trial every 50 ms
/ recorddata = true
/ ontrialend = [
values.temp_resp = trial.first_recall3.response; # Save the response, RT, and location of the mouse click
values.final_RT = trial.first_recall3.latency;
values.recall_x = mouse.x-parameters.center_x;
values.recall_y = mouse.y-parameters.center_y;
values.recall_radius = sqrt(pow(values.recall_x, 2)+pow(values.recall_y, 2)); # We use the mouse coordinates to determine if the click happened on the wheel or not. Only care about on wheel clicks
if (abs(parameters.wheel_r_px-values.recall_radius)<parameters.wheel_inrange_px){
values.recall_inrange = 1
} else {
values.recall_inrange = 0
}
values.recall_angle = atan2(values.recall_y, values.recall_x)*180/M_PI; # I convert mouse click coordinate to degrees to figure out of their mouse trajectory relative to the screencenter
if (values.recall_angle<=0){
values.recall_angle=values.recall_angle+360;
};
# Because the wheel is randomly rotating every trial in increments of 30 degrees, I account for this when I determine the angle
values.recall_angle_index = round(values.recall_angle)+(values.current_wheel*30);
if (values.recall_angle_index>360){
values.recall_angle_index = values.recall_angle_index-360;
};
]
/ branch = [
if (values.recall_inrange == 1 && values.recall_angle_index>0){ # Only collect responses that were (1) on the wheel and (2) greater than zero although (2) is a redundancy of the correction I do above
values.resp_index = values.recall_angle_index;
if (trial.first_recall3.response == "lbuttondown"){
trial.last_recall3
} else {
trial.first_recall3
};
} else {
trial.first_recall3
};
]
</trial>