The amount of time since the script or experimental event began or a clock was started.
<clock> <dataStream> <block> <expt> <likert> <openended> <sliderTrial> <survey> <surveyPage> <trial> <script>
object.name.elapsedTime
Read Only
integer
The time is reported in milliseconds. This property is useful in recording time stamps of various events throughout runtime.
The following displays the value of elapsedTime in a text stimulus:
<text myText>
/ items= ("elapsedTime = <% script.elapsedTime %>")
</text>
The following displays the value of elapsedTime in an instruction page:
<page myPage>
elapsedTime = <% script.elapsedTime %>
</page>
The following code shows how to a) capture the trial onset time with 'script.elaspedTime' and b) use it to calculate response times of key presses that should be recorded but not considered valid. In this example, each press of key 'A' will results in the calculation of 'values.rtA' but only pressing 'B' will end the trial as it's the only 'valid' response.
<trial example>
/ onTrialBegin = {
values.startTime = script.elapsedTime;
}
/ validResponse = ("A", "B")
/ isValidResponse = {
if (this.responseText == "A"){
values.rtA = script.elapsedTime - values.startTime; //calculates last responseTime of pressing 'A'
}
return (this.responseText == "B"); //only pressing 'B' is actually considered valid and will end the trial
}
</trial>