Some rookie questions: random sketchpad duration + re-running a loop
Hi,
I'm a newbie using OpenSesame and it's very likely both the questions I'm asking here are answered somewhere, but I haven't been able to find the answers, so here I am.
I'm trying to program a simple Flanker task (with some modifications), with the following structure (perhaps it is not the best way to do it, so comments on this are welcome too):
New experiment
Flanker sequence {seq}
Instructions
Practice loop
Practice_seq
Pr_loop {variables, correct responses, stimuli... set here}
Pr_trial_seq
Target (sketchpad; with the stimuli)
(keyboard_response)
ITI (sketchpad; actually a black screen)
Practice_end (sketchpad)
Experiment loop
... {as in the Practice loop}
Bye
Logger
Now, the questions:
- How can I set a random ITI (sketchpad) duration between, for example, 650 and 750 msec, without having to set a variable in a loop?
- I'd like to give the participants the option to repeat the Practice by a key press, for example "R". How can I do this?
Thank you very much in advance!
V
Comments
Hi Vic,
Include an
inline_script
in yourPr_trial_seq
somewhere beforeITI
and paste this code into itsprepare
phase:Next, you set the
duration
of yourITI
sketchpad to[ITI]
, and you should be done.Again, an
inline_script
does the trick. Put it in between Practice loop and Experiment Loop, e.g. after thepractice_end
sketchpad (in therun
phase).Hope this helps,
Eduard
Hi Eduard,
First of all, thank you for answering. I've tried both your solutions.
The first one (random sketchpad duration) was brilliant. However, when I tried the second Inline_script (re-running a loop), the task stopped showing the following message:
I've tried some naive-guy-trying-to-code things, but I haven't been able to correct the error. So, once again, I'm asking for your help with this problem.
Anyway, when I first tried to re-run the loop I did so with the 'repeat_cycle' item, because in the Practice_end sketchpad item, the image included some text giving the chance to repeat the practice pressing some key. Wouldn't it be easier doing it this way, instead of using the Inline_script?
Thanks again.
Vic
Hi Vic,
They line should have been
key,time = kb.get_key(keylist = ['y','n'])
. Sorry, for the confusion.Maybe, but honestly, I have never worked with
repeat_cycles
and I don't really know what it does. From its description however, I have the impression that it rather repeats single repetitions from aloop
rather than the entireloop
.Eduard
Hi again Eduard,
This time, it does work, although I have to press the key twice for the experiment to respond (however, it gets correctly to wherever I want to go in the sequence).
To be noted, I've changed the instructions in the Inline a little bit. Instead the 'y' and 'n' keys you proposed, I've set 'r' and 'space', which are more consistent with the whole experiment (due to the rest of instructions the participant would read). Everything else, remains as you wrote it in your previous comment (except for the Text instructions, in which I've added the new keys), as follows:
I must also say that, when I used your original keys ('y' and 'n'), it ran prefectly with just one key press. Is there any way I can maintain the 'r' and 'space' keys without having to press any of them twice?
Thanks!!!
Vic
Hi Vic,
Did you remove the
keyboard_response
item from your trial sequence? As you are sampling for keypresses in theinline_script
you don't need it any more. Once it is gone, it should proceed right away after eitherr
orspace
has been pressed.Eduard
Hi Eduard,
I've tried both, with and without the keyboard_response item, before writing the comment, and the result is the same...
Can you quickly upload your experiment?
Hi Eduard,
I tried permanently deleting the keyboard_response item, and now it runs perfectly.
Will the experiment still log (using a logger item as the last item of the experiment) the keyboard presses? If not, where would be appropiate to include the keyboard_response item to prevent the short circuit with the inline_script?
I attach the experiment in case you want to take a look what to whatever was wrong.
Thank you!