Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Problem when trying to repeat specific trial until response is correct

For my experimental design participants self-initiate presentation of the stimuli using a self-paced key press, however when their response is incorrect the stimuli presentation becomes confusing, I will elaborate.

My experiment design is as follows

  • Instruction screen
  • Keyboard response to continue
  • If pressed too soon (incorrect response), error canvas and returns to instruction screen
  • Object presentation
  • Fixation Dot
  • Delay

To stop the participants from rhythmically choosing to present when the instruction screen is shown, I have put in a preventative measure.

1) There is a randomised delay of up to 4000ms when the instruction screen is shown, which if the participant makes a keyboard response (incorrect), it brings up an error canvas for 2000ms then resets the sequence

Sequence order

Code for error variable

My problem is:

If the participants cause an error (keypress within the delay), it returns them to the start of the sequence as expected. However, following on from the reset if they do not cause an error (correct response) and the sequence continues as expected, it shows the object and fixation dot twice, before restarting the sequence. For example:

  • Instructions
  • Press too soon
  • Displays error canvas, then returns to instructions
  • Respond correctly
  • Object display -> Fixation Dot -> Delay (x2 on all)

If they do not cause an error the sequence is as expected and everything works fine.

Here is my initial sequence and main inline script before I tried to use the in-built run if's

If anybody has a solution, suggestion, or a question, please let me know. Thank you! :)

also, thank you for the great software and a great platform to learn from!


  • Hi,

    I don't quite understand your code and sequence. But I think, it would be easier if you just have a sequence with instructions and response and participants can only exit the sequence of they respond after the delay. So, effectively, create an infinite loop, that is only left once a condition is met. The rest of the script can follow right after. Attached an example with an inline implementation.

    I hope this helps.


Sign In or Register to comment.