[open] problem of the neverending loop
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
Hi,
Let's say that you have the following structure:
Here, the flicker_sequence presents one image, followed by a blank, followed by another image, followed by another blank. Each
sketchpadis followed bykeyboard_responsethat 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:
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
responseexists 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 (whenresponsealready has the value 'space'). To do so, simply add a simpleinline_scriptbefore flicker_loop to reset the variableresponse, like so:See? Easy peasy. You can download a simple example script here:
Cheers,
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!