Howdy, Stranger!

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

Supported by

[solved] I would like a pause button

edited September 2014 in OpenSesame

Hello everyone !
I'm beginner with opensesame.
I'm currently running and experiment using EEG. I would like to setup a button or something, which would allow me to make a pause at any moment.

Sometimes, an electrodes detach itself and I would like to be able to pause my OpenSesame script to repair the electrode.

Any idea ?

I searched in the documentation but I didn't find anything about a pause.

Johan.

Comments

  • edited 8:17PM

    Hi Johan,

    OpenSesame doesn't have a pause button, but you could implement one quite easily. The most convenient way to do this depends on your experiment, but the following is one option.

    1. Disable 'Flush pending key presses (...)' in your trial_sequence.
    2. Add a new keyboard_response to the start of your trial_sequence. Disable 'Flush pending keypresses', set the timeout to 0, and set the allowed responses to p.
    3. Add a new sketchpad just after the keyboard_response. Add a text message like, 'The experiment is paused'. Set the run if statement for this sketchpad to [response] = p.

    Do you see the logic here? Basically, if you press 'p' somewhere just before a new trial starts, this will cause the pause sketchpad to be shown.

    Hopefully this will get you started!

    Cheers,
    Sebastiaan

  • edited 8:17PM

    Okay Sebastiaan,
    I think I see how it could work. I will test it when I have some time and come back here to make a feedback.

    Cheers,
    Johan

  • edited September 2014

    Hello,
    So I tried a lot of thing running with this idea but i must be doing something wrong. i never had the good result.

    Most of the time, either I obtain a black screen (at the beginning of my sequence, when I put the two element here) and the experiment continues only if I press p, or I have a problem with the variable name. [response] does not exist in the sketchpad element...

    I tried with the two item at the beginning at the sequence, at the end, nothing changes.Perhaps you will have other idea or correction.

    image

    or

    image

  • edited 8:17PM

    Hi Johan,

    I cannot really tell from your example what goes wrong, but the instructions in my previous post should work. Except for this, which I hadn't considered:

    I have a problem with the variable name. [response] does not exist in the sketchpad element...

    I forgot that the variable response does not exist at the beginning of the experiment, so the run-if statement [response] = p will cause an error. To fix this, you can simply add the following line to the top of your experiment's general script:

    set response None
    

    This will give response an initial value.

    To get you started, here's a working example of a pause button:

    Good luck!

    Sebastiaan

  • edited 8:17PM

    Yeah,
    I just tried your advice and it's working. The problem was due to the value of the [response] variable.

    Thanks !

  • edited 8:17PM

    Okay it worked 3 times and now it fails every time.
    I will work on it and come back if nothing work.

    Bye,
    Johan

  • edited 8:17PM

    Hello,
    I really think the idea is good but it fail to work with my script.

    Johan

Sign In or Register to comment.