Counterbalancing more than 3 conditions - "item.get() has been removed in OpenSesame 4"
I followed the counter-balancing tutorial, and the error code is in response to "MainSequence" where you put =self.get('b1') == self.get('count_mainsequence')
How should I substitute this?
Thanks!
Nate
Comments
Hi @ns111021 ,
Using
self.get()to access experimental variables was already deprecated for a long time, and has now been completely removed in OpenSesame 4.0. Experimental variables are simply global variables, which means that you should be able to use the following run-if expression:b1 == count_mainsequence.See also:
Hope this helps!
— Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
Hi sebastiaan,
Thank you for the quick response. Ultimately I want to counterbalance 4 blocks: It won't let me attach photos here so here is my code pasted below. It says there is an issue with the " :" in subject_nr % 4 == 1:
Code for in-line script placed in same spot as video:
subject_nr % 4 == 1:
b1 = 0
b2 = 1
b3 = 2
b4 = 3
elif subject_nr % 4 == 2:
(same notation as above but b1=1, b2=2, b3=3, b4=0)
elif subject_nr % 4 == 3:
(same notation as above but b1=2, b2=3, b3=0, b4=1)
else:
b1 = 3
b2 = 0
b3 = 1
b4 = 2
b1 = 'b1'
b2 = 'b2'
b3 = 'b3'
b4 = 'b4'
Then under MainSequence I followed your recommendation:
Block1 (run if column-->) b1 == 'count_MainSequence'
Block 2 (run if column-->) b2 == 'count_MainSequence'
Block 3 (run if column-->) b3 == 'count_MainSequence'
Block 4 (run if column-->) b4 == 'count_MainSequence'
Thank you so much!
Nate
Hi @ns111021 ,
The example that I gave is for a run-if expression, which is the short one-line Python expression that you can use in
sequenceitems to indicate whether or not an item should be run. Your example seems to refer to aninline_script, which is a full Python script. My recommendation would be to take a step back and walk through he intermediate Python tutorial. All of the concepts that you are running into now are explained there.See also:
Once you have familiarized yourself with the basics of
inline_scriptand run-if expressions, don't hesitate to post further questions here!— Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!