[solved] Custom Feedback
Hi all!
I am very new to both OpenSesame and Phyton, so sorry in advance if the question is either silly or already solved.
I've successfully created the variable X via in-line script. The variable X does everything I need, and the experiment works fine - all the variables are well logged and so on... Variable X changes at every trial accordingly to the performance of the subject. X is an integer, not a float or string type.
But you know, sometimes you may want to add 'classy' details.
Once in a while I let the participants take a break. During breaks I would like to show them a lot of text, just to keep in mind the instructions, but also the value of the variable X. I use a text_display object.
Putting [X] in the text does not work.
Despite X is continuosly setted and changed during the procedure ( exp.set('X', X) ), the only value [X] gives is 0, namely the initial value of X. I tried Phyton language into the text but it is read as a string.
Variable X, in the log file, is fine instead.
What am I missing?
Thanks a lot for your work and attention!
Comments
Hi Elvio,
It seems that you're doing things correctly. If you have Python variable
x, which lives in yourinline_scriptitems, you need to useexp.set('x', x)to create an experimental variable that has the same name and value. Once you've done that you can refer to this variable throughout OpenSesame, using the square-bracket notation ([x]). See also:One thing that comes to mind is that you may be
exp.setting the variable too late. For example, if you set the variable during the run phase, it won't be available insketchpads, because these are prepared in advance, during the prepare phase. For more information, see:Also, it won't hurt to print a little information to the debug window, to make sure that
xreally has the correct value. Like so:Cheers!
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
I see... Thanks for your hint, I will try with a feedback object instead of a sketchpad one.
It works!
Indeed, now that i look at the script I see that sketchpads, also the ones outside a sequence, are prepared in advance; at the beginning the value of X was 0, so it all makes sense.
The feedback object works fine and reads the last value of X.
Thanks a lot!