Coding Image Location Output #1179
-
|
Hello, I have an image set to appear in one of two locations (e.g. top of the screen / bottom of the screen.) What I am attempting to do now is code each of those locations so that in the output provided I can tell which location the image appeared in for the participant. However, I'm not sure how to go about doing that. Plugin Details.txt I've attached two notepad documents below which include the main body of my experiment and a plugin that I've been using to code in the X & Y coordinates for said images, just in case it was needed. Thank you for your time, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
Hi @BobRoss048, sorry for the delay. It looks like in the plugin file you're using the // function to end trial when it is time
function end_trial() {
// kill any remaining setTimeout handlers
jsPsych.pluginAPI.clearAllTimeouts();
// create a variable that will store the image position - either "top" or "bottom"
var image_position = null;
if (randvert[0].vertical == "flex-start") {
image_position = "top";
} else if (randvert[0].vertical == "flex-end") {
image_position = "bottom";
}
// gather the data to store for the trial
var trial_data = {
rt: response.rt,
stimulus: trial.stimulus,
click_x: response.click_pos_x,
click_y: response.click_pos_y,
click_half: response.click_half,
image_position: image_position // add the image_position information to the trial data
};
// clear the display
display_element.innerHTML = "";
// move on to the next trial
jsPsych.finishTrial(trial_data);
} |
Beta Was this translation helpful? Give feedback.
Hi @BobRoss048, sorry for the delay.
It looks like in the plugin file you're using the
randvertvariable to set the image position to the top or bottom of the page. This means you could also use that variable to categorize the image position as "top"/"bottom", and store that information in the trial data. Here's one way to do it inside of theend_trialfunction: