I am a new convert to Builder (for the purpose of running on Pavlovia). I have always used Coder to program my experiments full from scratch, so I am in a weird space of not knowing how to do anything in a program with which I am generally familiar.
I am using standalone PsychoPy 3 v. 2020.1.3 on a Windows 10.
So my question is rather simple, but I was not able to find the right query to find an answer:
How do I reference variables in my conditions file in a code component?
Here is a description of the task and what I’ve done:
The task is a gambling task in which people choose their preference for one of two gambles. So, on the left might be a gamble like “100% chance of winning $69 (0% chance of winning nothing)” and on the right might be a gamble like “75% chance of winning $1374 (25% chance of winning nothing)”
Participants hit either the left or right arrow key to make their choice. The values for the percent chance of winning (e.g., 100 and 75), the amount to win (e.g., 69 and 1374), and the win nothing percentage (e.g., 0 and 25) are all referenced in a conditions file with the variable names ProbLeft, ProbRight, ValueLeft, ValueRight, Alt_ProbLeft, and Alt_ProbRight.
I inherited the program I am trying to get to work from a colleague in another lab and it works. However, it was written such that there are separate text components for the different aspects of each gamble. Consider again the left gamble: 75% chance of winning 1374 (25% chance of winning nothing). This sentence is shown as 4 separate text components that are all drawn concurrently. One that draws ProbLeft, one that draws, Alt_ProbLeft, one that draws ValueRight, and one that draws " % chance of winning ( % chance of winning nothing)" My colleagues worked the spacing out such that the text component that draw variables are drawn in the appropriate positions to make the sentence readable.
I do not like this solution because I expect that running this experiment on Pavlovia, as is, would result in wonky formatting issues dependent on my participants’ screen size. So, instead, I would like to construct a sentence to be shown on the left and a sentence to be shown on the right.
I created a code component on my trial in which I could create a variable to concatenate all the individual pieces of the gamble. So, in Begin Routine I wrote:
leftText = $ProbLeft+"% chance of winning"+$ValueLeft
This resulted in a syntax error. So, what is the proper way to use the values from those variables in my conditions file to achieve my goal?
Thank you so much for your time