[solved] setting and getting variables set into Loop items
In eprime it's possible to manage variables ("attributes") inside a loop ("List") in the meaning that at runtime I'm able to retrieve and set those variables even if I am outside the loop.
Could the same be possible using the opensesame's Loop item only and not bulding other arrays?
thanks (again)
Comments
Yep, that's possible. Every variable that is created in an inline_script item, is available in all the other inline_script items, regardless of whether they are placed in a loop or not. If you're creating a variable that you want to be available to items other than inline_scripts, you have to insert exp.set('variablename', variablevalue).
Cheers,
Josh
Sorry,
it seems I was not clear enough with my problem.
Let's say I have this:
inside inLineScript I can write/get vars defined inside the Loop. And this is true each time my InlineScript is run inside the loop for the "current trial"
I was wondering if outside the Loop I can still get/set those vars defined in that Loop, if they are saved somewhere. Soemthing like
thanks!
Hi,
If this only concerns the current value of a variable in a
loop, it is quite straightforward. You can get and set the value just the way as you do from inside aloop.Accessing previous values is a bit trickier, but not impossible. The strategy, that I personally think is most sensible, is creating a
listor some other container in theloopthat mimics the variables you're interested in. Thislistis then editable for sure. Besides, this has also the adventage that you're still able to see the original values in the log file, which comes in quite handy if you want to check the correctness of your procedure.Yes?
Good luck,
Eduard
Yes, using an external list is what I am doing now but..
this seems to me a waste of resources, duplicating and keeping updated all the vars I need.
Thanks for your help