[solved] Inline code variables not working in sketchpad
A small example of my problem.
*I have 61 jpegs in a folder
I've created a loop (w/sequence) with 61 items (named 1.1.jpg, 1.2.jpg...etc) under a variable named picture1. In this loop, I have the following inline script:
self.experiment.picturesBear=[] #I create a picture list
self.experiment.picturesBear.append("picture1") #I populate this list with picture 1 items
[The loop repeats 61 times, sequentially going through each item and adding it to the list]
I then have a sketchpad where I add all 61 items to the file pool. I change the sketchpad script to the look like this:
draw image 0 0 "[self.experiment.picturesBear]" scale=1 center=1 show_if="always"
I get the following error:
[self.experiment.picturesBear] could not be found in sketchpad. Make sure that the file is present in the file pool (or specify the full location of the image in the script editor).
What should I do? Thanks in advance for the help
Comments
Hi,
The variable you are referring to in the skecthpad is a Python variable that cannot be referred to within the OpenSesame syntax. What you could do, is add a variable to your loop called
picnr. The value should be a numbers from 0 to 60.Next, add an inline_script to the sequence that contains your skecthpad, containing the following code in the Prepare phase:
In the sketchpad, use the following:
Good luck!