[solved] OpenSesame: Use lists made in an inline script as 'variabeles'
Hello all,
I've a new question. I've made a inline script that generates equations combined with an answer and a type and saves it as dictionaries in a list (because in this way each equation has been connected to the right answer and type). In a block loop, you are able to make variables and give each variable different values. I would like to use my script to generate three variables (equation, answer and type). So that, each round, one equation will be used out of the list. How do I do this? How do I connect the list of equations I generate with the inline script to the block-loop? Or is it not necessary to add variables to the block-loop and do I have to connect it to an sketchpad to directly show an aquation to the participant? And how do I keep the answer and type connected to the equation?
I hope my question is understandable. If my description is to faque, please let me know!
Comments
Hi Merel,
One solution that comes to mind is to change your dictionary into a list of smaller lists.
In the smaller lists, the first element is the question, the second one is the correct response, and the third one is the type.
For example:
Define the entire list at the beginning of your experiment:
Append an
inline_scriptitem to the beginning of the trial sequence, and place something like the following in the Prepare tab:Now you can use the variables question, correct_response and equation as if they were defined in the
block_loop. For example:The three variables are also logged, so you can keep track of all three of them.
I hope this helps!
Cheers,
Lotje
Did you like my answer? Feel free to

Hi Lotje,
Thanks for your response! I still have a question:
In the inline script you made, one equation will be shown to the participant, but how do you loop through the list of equations to show them all, one by one, to the participant?
Or is that solved by using 'pop'?
Hi Merel,
I thought the idea was to show the participant one equation per trial:
etc.
If this is indeed what you want, I think the above method should work. I just forgot to mention that you have to set the number of cycles in the
block_loopto the total number of equations.I uploaded an example here:
http://pastebin.com/9Jumk5Cj
(download and save with the extension .osexp)
If this is not what you meant, please let me know!
Cheers,
Lotje
Did you like my answer? Feel free to

Also, I get an error that lEq is not defined ..
Thanks! I will look at your example first!
Hi Lotje,
Thanks a lot for your help! My experiment is working now! I changed your example a little by using the list of dictionaries directly instead of making it a list of lists.
you're example was very useful, thanks!
Cheers,
Merel
Perfect! I'm glad to hear!
Did you like my answer? Feel free to
