Navigation stuff goes here


Command groups: timers

When assessing reaction times in PsyScript it is usual to use the timer built into the wait command. This is entirely self-contained and as a scripter you don't have to worry about setting it up. However, because it's self-contained it can't be used if you want to time something more complicated than a single button-press. For instance you may want to time an operation which involves answering several questions or clicking a number of things in a particular order. Tasks like those can be performed using the two timers described in this page: the count-up timer and the count-down timer.

The count-up timer

The count-up timer is always counting up. You can reset it to zero using this command:

start timer

Once reset it will count up from zero. Its current value can be found in the $timerTime variable. PsyScript cannot compare numbers. For example, you cannot check to see if the timer has reached 15 seconds yet. That's what the count-down timer is for.

The count-down timer

The count-down timer is always counting down. You can reset it to a particular time using a command like this:

count down from 15 seconds

At that point it will start counting down from the time given. Its current value can be found in the $countdownTime variable. If it has not reached zero yet, the time will be reported as a number of seconds, from the start time you supplied down to just above "0". If the time has reached or passed zero, the variable will return the string 'expired'. You can test for this value in your script and do different things depending on whether the countdown has expired or not:

-- provide a distraction task for 5 minutes proc doDistractionTask -- set up distraction task here … count down from 300 seconds while $countdownTime is not expired … -- do something distracting here … end while -- clear up distraction task here … end proc

Commands

start timer

Resets the count-up timer to zero.

start timer


count down from value seconds

Resets the count-down timer to the number of seconds given.

count down from 10.62 seconds
count down from $varTimeForThisPhase seconds

Technical notes

See also