Howdy, Stranger!

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

Supported by

[open] problem of the neverending loop

edited November 2014 in OpenSesame

hello :)
i have a repatative question, concerning how to end a cycle to be able to move onto an experimental loop after a practice run.
the experiment im presently trying to recreate is change blindness, where one is present with an image followed by a blank image and then the first image with a missing object in it.
the loop works fine; as in it repeats the images as desired,but the problem arises when i hit the space key (which has been identitifed as the key reponse) and the cycle refuses to stop.

i have checked older discussions and tried implementing their solutions, but they have failed to work for me.

anyone got any ideas?

warning: im new to open sesame and have never used python before this.

Comments

  • edited 10:13AM

    Hi,

    Let's say that you have the following structure:

    image

    Here, the flicker_sequence presents one image, followed by a blank, followed by another image, followed by another blank. Each sketchpad is followed by keyboard_response that has a timeout of 500 ms. The result of this is that flicker_sequence presents images at a rate of 1 Hz.

    Now let's say that in the flicker_sequence has the following run-if statements:

    image

    This means that once you press space, all subsequent items in the sequence will be skipped. So this allows you to stop flicker_sequence by pressing space.

    Of course, you want to repeat flicker_sequence until the participant actually presses space. You can do this by setting the repeat value in flicker_loop really high. And to make sure that flicker_loop also stops when space is pressed, you can set its break-if statement (under 'Show advanced options') to [response] = space.

    You see the logic here?

    One final thing to do is make sure that the variable response exists and doesn't have the value 'space' when flicker_loop starts. Because that will either give an error (if it doesn't exist) or cause the loop to not run at all (when response already has the value 'space'). To do so, simply add a simple inline_script before flicker_loop to reset the variable response, like so:

    exp.set('response', None)
    

    See? Easy peasy. You can download a simple example script here:

    Cheers,
    Sebastiaan

    There's much bigger issues in the world, I know. But I first have to take care of the world I know.
    cogsci.nl/smathot

Sign In or Register to comment.