PennController for IBEX › Forums › Support › Logging key press for each trial within template? › Reply To: Logging key press for each trial within template?
November 29, 2022 at 6:45 pm
#9748
![](https://www.pcibex.net/wp-content/uploads/2018/10/IMG_8365-e1540835663655-150x150.jpg)
Keymaster
Hi,
The identifier and video file are already logged as extra columns in the code that you posted. As far as I can tell, there is a single response time in that code, which corresponds to how much time elapsed since the beginning of the timer and when the participant presses space. So you could add a Var element to log the response time as an extra column like this:
Template( "eCIDEx.csv" , row => newTrial("Experiment1", newText(row.identifier) .css("font-size", "2.5em") .css("text-align", "center") .settings.center() .print() .log() , newVideo(row.videofile) .size("60vw", "auto") .settings.center() .print() .play() .disable(0.01) .log() , newVar("RT").global().set( () => Date.now() ) , newTimer("7.2s", 7200).start() , newKey(" ").log("last").callback( getTimer("7.2s").stop() ) , getTimer("7.2s").wait() , getVar("RT").set( v => Date.now() - v ) , getVideo(row.videofile).remove() , newImage("Fix", "Focus_Point.jpg") .center() .print("middle at 50%", "middle at 50%") , newTimer("Timer1", 1000).start().wait() ) .log("id", getVar("subjID")) .log("identifier", row.identifier) .log("videofile", row.videofile) .log("ResponseTime", getVar("RT")) .log("qualID", getVar("qualID")) )
Then you can systematically look at a single line in the results file (eg. the Text element’s log line) and get all the information you want in it
Jeremy