Howdy, Stranger!

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

Supported by

Quit after 5 mistakes + pause on tablet

I am running a simple picture-selection experiment on a windows tablet in which participants hear a sentence and have to choose one among four pictures.
I need some help on these issues:
1. I want the experiment to stop if the participant makes 5 consecutive mistakes. Is there an easy way to implement this?
2. since the experiment runs in tablet mode, I cannot pause the experiment by pressing ESC (and then q or spacebar). I couldn't find these instructions in the in-line script. How can I arrange these pause-settings for an experiment running on a tablet? (even a simple command like double-clicking at the center of the screen would be fine)



  • Hi Francesca,

    Welcome to the forum!

    • There is no direct way to do this but it can be implemented quite easily with the use of an 'inline_script' that would count the correct and incorrect trials and check whether five consectutive errors have been made. In that case, the experiment will abort or continue to the next section. It would look something like:

      var.errors = 0
      var.abort_exp = 0
      if trial incorrect:
              var.errors += 1
              if var.errors == 5:
                      var.abort_exp = 1
      if trial correct:
              var.errors = 0

    The first two statements would go at the top of your experiment while the second section would be added in a script after every trial. Lastly, you need to set a Run If statement in your sequence that checks whether the variable abort_exp remains false (e.g. 0). Let me know how familiar you are with OpenSesame and inline scripts so far; the code above will not work in it's present form but this is the general idea.

    • On my ASUS tablet pressing the Return button (which is a left-wards pointing arrow on my device) allows the user to pause or abort the experiment, similarly to the ESC resonse on regular devices. You could check whether your tablet does the same. Alternatively, you could add an additional touch_response item after an X amount of trials to ask the participant if a break is needed, but this depends completely on the specifics of your experiment.


  • Hello!

    Im trying to do the same thing but i really don't know anything about inline scripts. I tried doing the same code you showed but it says theres an error.

    I was wondering if you could help me with the inline script for this function.

    Its urgent.

    Thank you

  • Hi Camila,

    If you want help, you have to provide us with more information on the problem you are experiencing. Without error message it is impossible to say what is going wrong. Also, this code alone won't work. It needs to be embedded in the correct experimental structure. So information on that would also be appreciated.

    Im trying to do the same thing but i really don't know anything about inline scripts.

    Check out this:

    There are plenty resources to learn python coding. I can strongly recommend following some of them. This will make your life easier in many ways, potentially.

    Good luck,


Sign In or Register to comment.