Description
This sample demonstrates the methods used to access the state of a keyboard key or a mouse/SRBox button in real time.
Abstract
The InputDevice.History property holds information about all of the responses received by the corresponding input device (i.e. Keyboard, Mouse, SRBox, Port) since the start of the experiment. Using the input device History, the current state of a key or button can be assessed via InLine script.
This sample assesses the state of the Q key and the spacebar via the Keyboard.History property. During each trial, a message (i.e. “Checking the state of the keys now…”) is presented. Immediately following this message, InLine script is used to check the current state of the keys. Feedback about each key is then presented.
This sample can be modified to assess the state of other keyboard keys or the buttons from other devices (i.e. mouse, SRBox, etc) as well. In the CheckState InLine, simply change the parameters sent to the GetLastState and/or GetLastResponseData functions. For example, to get the state of SRBox button 3, you would use:
nLastState = GetLastState(“3”, SRBox)
Note that the SRBox device must first be added to the experiment via the Experiment object’s Properties pages.
Comments
(none)
Comments
0 comments
Please sign in to leave a comment.