I am creating a modified version of the BART (balloon/risk task) demo where there are two different colored balloons that earn credit towards two different gift cards (coffee and food/control).
The task begins with a preference assessment so they can choose which gift cards they want. The first routine has two sliders, for Starbucks and Dunkin, and the second is the same but for Subway and Domino’s. This is how I pulled the ratings in “end routine”:
starbucksRating = starbucksSlider.getRating()
dunkinRating = dunkinSlider.getRating()
dominosRating = dominosSlider.getRating()
subwayRating = subwaySlider.getRating()
During the main BART trial, the logo for the restaurants they chose will appear on either side of the screen based on their slider ratings and the current balloon. This works perfectly fine when running locally. Here’s the python code in “begin routine”:
#which caf reward did they choose?
if starbucksRating > dunkinRating:
cafChoice = 'resources/starbucks.png'
else:
cafChoice = 'resources/dunkin.png'
#show caf logo for blue balloon only
if is_caff == True:
cafLogo = cafChoice
else:
cafLogo = 'resources/blank.png'
#which cont reward did they choose?
if dominosRating > subwayRating:
contChoice = 'resources/dominos.png'
else:
contChoice = 'resources/subway.png'
#show cont logo for orange balloon only
if is_caff == False:
contLogo = contChoice
else:
contLogo = 'resources/blank.png'
There are two image components named “cafLogoImage” and “contLogoImage” set to “$cafLogo” and “$contLogo” displayed on either side of the screen. “blank.png” is an empty transparent image to essentially make the logo disappear when it isn’t relevant.
…and here is the JS code that was automatically translated:
if ((starbucksRating > dunkinRating)) {
cafChoice = "resources/starbucks.png";
} else {
cafChoice = "resources/dunkin.png";
}
if ((is_caff === true)) {
cafLogo = cafChoice;
} else {
cafLogo = "resources/blank.png";
}
if ((dominosRating > subwayRating)) {
contChoice = "resources/dominos.png";
} else {
contChoice = "resources/subway.png";
}
if ((is_caff === false)) {
contLogo = contChoice;
} else {
contLogo = "resources/blank.png";
}
When I try to run this on Pavlovia, the experiment runs fine until it gets to the main trial, giving this error message:
Unfortunately we encountered the following error:
- when setting the image of ImageStim: cafLogoImage
- when getting the value of resource: resources/blank.png
- unknown resource
The project’s git page: Sign in · GitLab
And a snapshot of my builder view:
TIA for any help (: this project is my very first attempt at Python or JS & I’m honestly astonished I’ve gotten this far writing this part up from scratch by myself.