item.set removed in Opensesame 4
Hi all,
I have an experiment that runs perfectly in Opensesame 3 but not in 4. The reason is this code that I use in an inline to define the duration of a fixation display:
fix_durations = range(400,1700,100)
fix1duration = random.choice(fix_durations)
exp.set('fix1dur', fix1duration)
The error message that I get is that "item.set has been removed from OS4". I can't find anywhere in the documentation anything about this. Anyone knows how to set an OS variable now in Python and Javascript (I eventually want to run this in OSWeb)?
Cheers,
marios
Comments
Hi Marios,
This deprecation happened a long time ago: https://osdoc.cogsci.nl/3.0/miscellaneous/important-changes-3/#the-var-object-easy-getting-and-setting-of-experimental-variables
It was still possible until recently, but not necessary.
To set a variable, you simple do
var.fix1dur = random.choice(fix_durations)
For osweb, you might also want to check the latest changes:
https://osdoc.cogsci.nl/4.0/notes/400/ (see Experimental variables are globals). I am not sure it is directly relevant to your situation, but just in case.
Hope his helps,
Eduard
Thanks Edouard! Makes sense. I went back to an old task I developed after updating to OS4 and thought that was the problem
Cheers,
Marios