If this template helps then use it. If not then just delete and start from scratch.
OS (e.g. Win10): Win10
PsychoPy version (e.g. 1.84.x): PsychoPy 2021.1.2
Standard Standalone? (y/n) If not then what?: y
What are you trying to achieve?:
I want to select items from a shuffled list of words, using the conditions file to indicate which position in
the list to take an item from. I am doing this as a way of having a random selection of items go into
fixed roles in a discrimination learning task.
I started from the fact that I can put words in a conditions file, with headers of “stim1” and “stim2”
and have words in the columns, like this:
|stim1|stim21|
|cat|strawberry|
|cypress|elk|
Then if I use code of “display = $stim1 + $stim2”, I will get a display that shows, for example, “cat strawberry”
I have used code to read a file and create a list of words, and I can select an item in the list using code
like the following: item=lista[1]
What I want is to be able to insert a number for “1” in this example. What I have done is to put the numbers I want to use in the condition file, with headers of stim1, stim2, like this:
|stim1|stim2|
|1|11|
|11|1|
so that $stim1 can be not a number but word #1 in lista or word #11 in lista.
I tried the following
itmloc1=$stim1
itm1=stmlista[itmloc1]
but get a syntax error.
SyntaxError: invalid syntax
What did you try to make it work?:
What specifically went wrong when you tried that?:
Include pasted full error message if possible. “That didn’t work” is not enough information.