A response handler element that records subject response by key press. Also works with other keyboard-like devices. At default waits for one press of any key, then records response and ends on its own. Response values generated are numbers corresponding to keys you list in property listenKeyNames, or operating system-depending key numbers if you don't set it.
You can also use keyPress elements to listen for trigger signals from an external device like a scanner that arrive as keyboard inputs. To do this set registerTrigger = <cd>true<cd> to register inputs as triggers instead of responses from subject. You can set elements in the same trial to start/end from either responses or triggers (element properties start/end). However, for triggers you can also set later trials to start at fixed times from trigger with zero drift (trial object property start).
See also textInput elements.
By default yes, when it records one response. You can change number of responses to wait for in property maxNumResponses. If you set maxNumResponses = <cd>inf<cd>, records responses indefinitely until a condition you set in property end.
If an element can end on its own, you don't need to set end conditions for it in property end (unless you want it to maybe end earlier).
No—runs until a condition you set in property end.
You can vary or allow the subject to adjust the following input properties of an object of this type in real time when it's running. If you need to make other properties adjustable, you can edit the element type code—see Element Type Programming Manual.
position
nn_eyes
rotation
colorMask
alpha
intensity
contrastMult
drawCodeVars
(None)
(None)
Default: default device, generally the keyboard
Optionally you can listen for input from some other keyboard-like device. n_device is HID device number to listen to. You can use Psychtoolbox functions GetKeyboardIndices or PsychHID('Devices') to see available device numbers. A keyPress element uses Psychtoolbox KbQueueCreate if useQueue below = <cd>true<cd>, or KbCheck if useQueue = <cd>false<cd>. n_device goes to the input of one of those functions. See help for these functions if you need more information on device numbers.
Default: listen to all keys; response values are key numbers on your operating system
Alternatively you can set this property to a vector of numbers that are key numbers. These are the same as used by Psychtoolbox functions like KbCheck. Note key numbers are different across operating systems. showKey also shows key numbers.
Either way, response values generated by the keyPress element are numbers corresponding to the order of the keys you list in this property. e.g. listenKeyNames = <cd>[<cd><cds>"left" "right"<cds><cd>]<cd> → response value 1 = left arrow key, 2 = right arrow key. Or if you leave listenKeyNames = <cd>[]<cd> to listen to all keys then response values are just the operating system-dependent key numbers.
Like listenKeyNames above except keys to ignore. If you leave listenKeyNames = <cd>[]<cd>, you can listen to all keys except the ones you list here. This doesn't affect response values. <cd>[]<cd> = ignore no keys.
Default: use keyboard checking for responses, queueing for triggers
<cd>[]<cd> (default) = use checking for responses, queueing for triggers.
PsychBench uses record properties to record information during experiments. You can't set record properties but you can see them in experiment results by listing them input property report.
PsychBench © 2017–2023 Giles Holland
Website © 2023 Giles Holland
End user license agreement