put this in the Begin Routine tab. Place the code-element above your text-element, displaying the feedback message, set the text of your feedback text-element to $msg, and set the text to set every repeat.
Hi I encountered the error of ‘TypeError: ‘Keyboard’ object does not support indexing’ when implementing similar codes if respKey[-1].rt <= 1.5: msg="too slow"
in the Begin Routine. Any suggestion? Thanks!
My attempts have been revised here (sorry not yet successful but found some consistent errors): I tried moving this section of code from Begin Routine to Each Frame, but I still get the error ‘TypeError: ‘Keyboard’ object does not support indexing’ when I use respKey[-1].rt (also try , same error output). Index rt using respKey.rt[-1] (also tried ) returned “IndexError: list index out of range.”
the keyboard component is ‘respKey’.
Perhaps the issue is that the code (tooSlow, see image below) is located in the current response (resp) routine? I store the last key in the respKey properties and allow three letters that correspond to the $correctAns. The text component used to display the ‘Response too slow’ message on each repeat. The preceding routine is displayed in the image below (showing on the screen 0.15s, no other components in this routine, as well as for fixation)