Navigation stuff goes here


Command groups: wait

This set of commands is used to garner participant reaction. It tells PsyScript to stop executing the script until something occurs, then carry on where it left off. It comes in a number of variations.

PsyScript can tell when a user has pressed a key on the keyboard or clicked on a cell on the display. The two simplest wait commands are …

wait for a key wait for a click

The first command tells the script to wait for a keyboard key to be pressed. The second command tells PsyScript to wait for the user to click on one of the cells visible on the display. You can add a qualifier to each of these instructions:

wait for a key in yn wait for a click in LR

The first command tells the script to pay attention only to the keys 'y' and 'n'. The second command tells the script to pay attention only to clicks in cells L and R. You can add another qualifier to the command:

wait for a key in yn or for 22 seconds wait for a click in LR or for 22 seconds

Both of those commands will stop waiting after 22 seconds. There's also a command that ignores all input and just does the waiting:

wait for 22 seconds

And finally there's a command that combines all the above:

wait for a click in LR or a key in yn or for 22 seconds

That command will wait for an appropriate click or an appropriate key, or for the timeout, whichever comes first.

How to tell what the user did

All wait commands set various variables depending on how they were ended (whatever event it was that told the script it was okay to carry on).

if the command was ended by a key:  $lastEventEnder = 'key'
$lastEventTime = how long the command waited
$lastKey = the key the participant pressed
if the command was ended by a click:  $lastEventEnder = 'click'
$lastEventTime = how long the command waited
$lastClick = the name of the cell the participant clicked
$lastClickXCoord = the X coordinate of the point within the cell that was clicked
$lastClickYCoord = the Y coordinate of the point within the cell that was clicked
if the time limit was reached:  $lastEventEnder = 'time'
$lastEventTime = how long the command waited

Like other variables, these can be used in log commands, as values for other commands, and in if and while conditions.

Commands

wait for a click

wait for a key

wait for value seconds

wait for a click in value

wait for a key in value

wait for a click in value or for value seconds

wait for a key in value or for value seconds

wait for a click in value or for a key in value or for value seconds

Pauses the script until one of the listed events have occurred.

wait for a key in 1234567890 or for 10 seconds
wait for a click in $varAcceptableCells
wait for a key in ynd or for $varTimelimit seconds


Technical notes

See also