Unable to use Experiment Settings to set ori conditions at run-time

Help menu says to set conditions at run-time create new Field in Expeirment Settings e.g. ori. then builder components can access expInfo[‘ori’] to retrieve orientation set here. However, when I try to set ori for Text component by putting $expInfo[‘ori’] into orientation tab of text window and enter 90 for ori at the dialogue box, ExpSet, I get an error message: “can’t multiply sequence by non-int of type ‘float’”. If I put $int(expInfo[‘ori’]) into orientation tab of text window to convert to an integer, I get the error message; “could not convert string to float”. I am not a python programmer.

Hey,

Try adding a code component and in the “begin experiment” tab type

thisOri=int(expInfo['ori'])

then enter “thisOri” in your orientation field in the text component

Becca

Rebecca; Thank you for responding. When I do that I get an error message:

“could not convert string to float”

Lee

Hi Lee,

Please could you confirm which version of PsychoPy you are running and that the components/parameters you have entered there are identical to this:
for the code component
Screen Shot 2020-07-04 at 18.34.56

and this for the text parameter:

Thanks :slight_smile:

Hi Lee, also sorry to clarify by “add a code component” I mean by selecting this icon here Screen Shot 2020-07-04 at 18.40.54 [adding incase I wasn’t clear to do this rather than enter the code into the parameter field]

Hi Rebecca: I could not open your first image. But the code component at “Begin experiment” is
<img width=“407” height=“182” style=“width:4.2395in;height:1.8958in” id=“Picture_x0020_9” src="//cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex002/uploads/psychopy/original/2X/b/b51334853c708f4fcf86b5c8786c204239ae583c.png" alt="A screenshot of a cell phone

Description automatically generated">

The Text window is:

<img width=“531” height=“383” style=“width:5.5312in;height:3.9895in” id=“Picture_x0020_10” src="//cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex002/uploads/psychopy/original/2X/f/ff86a531032e88a1f486d9cbd5ba8619ff71926b.png" alt="A screenshot of a cell phone

Description automatically generated">

Experimental settings Units = norm

The PsychoPy version is 3.1.5

Lee

Hi lee,

OK so it looks like you have everything right there to me! I am running version 2020.1.2 so one thing you might try is updating your PsychoPy and seeing if it works then :slight_smile:

Good luck,
Becca

Thank you!

Did it work?!

I did not have to change the Pp version. What you suggested actually does work now. I’m not sure what was wrong before.

Many thanks,

Lee

1 Like

Ah excellent - I am pleased it worked - if you could mark the appropriate response as the “solution” that would be useful for future users :slight_smile:

Thanks,
Becca