[solved] Keypress carrying over to subsequent trials?
Hi all, I'm having a bit of an issue with a program I've written (with some previous help here a good while ago). Here's a screenshot of the section in question:
What the loops are doing is recording two things concurrently. While in the Task_loop, it records a simple visual monitoring task (press a key to respond to a stimulus when it appears). At the same time, they'll be doing another task outside of the program (on a vehicle they'll be seated in). When the physical task is complete, the researcher presses "q", breaking the Task_loop and resetting "FMPower_loop" (in this case) with another set of physical instructions. Then it re-enters Task_loop to restart the visual monitoring task. Then it repeats until FMPower_loop is exhausted.
The problem I'm having is that after pressing q the first time, it never clears that keypress. So each time it goes back into Task_loop, it's immediately broken and just resets itself until the big loop is done. I have "Flush pending key presses" checked in every Sequence, and the keyboard response items are also checked to flush key presses. Is there something else I need to do to get this key to clear? Thanks in advance.

Comments
Hi!
Assuming your break if statement is
[response] = q, you could add a single line of code to your inline_script called inline_script in the sequence called Monitoring_Task:That should do it!
The reason why flushing the keyboard does not work, is because the variable
responseis set after a keypress, and is not changed until it is actively redefined (e.g. by another keyboard_response item). So actively changingresponseas we do with the line of code above should fix the problem.Good luck!
Ah, that worked perfectly! Thanks a bunch.