Randomization of sketchpad duration
Hi, I'm new to OpenSesame and python.
I want a sketchpad to have a randomized duration (eg between 400 and 1000 ms).
I found this discussion which seems to be exactly what I want: https://forum.cogsci.nl/discussion/1975/solved-randomized-duration-of-sketchpad-presentation
So, I have added an inline script with:
import random var.stim_duration = random.randint(400,1000)
Then I have my sketchpad with duration listed as [stim_duration], including the square brackets.
When I run the task, it terminates, and indicates that "The variable 'stim_duration' does not exist"
When I look at my variable inspector, stim_duration is listed (though it is not bolded).
What am I doing wrong?
Robin
Comments
Hi @rlaycock ,
Welcome to the forum and good to hear that you got so far in finding the solution! :)
It sounds like you are trying to use the variable "stim_duration" before it defined in the
inline_scriptitem. Did you make sure that:inline_scriptitem before thesketchpadthat uses[stim_duration]?Prepare tab(and not in theRun tab) of theinline_scriptitem?For more information about OpenSesame's prepare-run strategy, see here:
If this doesn't solve the issue, feel free to upload your experiment here so that we can have a closer look.
Cheers,
Lotje
Did you like my answer? Feel free to

@lvanderlinden
Hi Lotje,
many thanks for your reply. And thanks also for fixing this issue!
I did have the inline script before my sketchpad, but I was not aware of the difference between Prepare and Run. Once I put in in Prepare that fixed it.
Thanks again.
Robin
Great Robin, thanks for getting back to us with the solution! :)
Did you like my answer? Feel free to
