PennController for IBEX › Forums › Support › Cannot get the template function to loop over my experiment › Reply To: Cannot get the template function to loop over my experiment
Hi Jeremy,
I have some other questions regarding to the logging participants’ correct response. In my experiment, say I included an additional column “CorrectResp” coding all correct response as “F” or “J”, and I would like to compare this column with participants’ key response. Can I use Javascript to do this? Here is my draft for checking the accuracy of keypress:
newKey("keypress", "FJ") .log() .wait(function() { // Get the participant's response var response = this.keys; // Get the correct response from the CSV file var correctResponse = variable.CorrectResponse; // Check whether the participant's response matches the correct response if (response === correctResponse) { // Log a correct response log("CorrectResponse", 1); } else { // Log an incorrect response log("CorrectResponse", 0); } })
I searched the forum and documentation, and find test.pressed() seems to be okay, but I have no idea how to make the function automatically compare the response from participants with the pre-logged correct response in “sentences.csv” file.
Thanks a lot for your kind help!