| Reference | Downloads | Github

Showing Sum of Routine Points Earned at the end of the Experiment

If this template helps then use it. If not then just delete and start from scratch.

OS: macOS Big Sur 11.4
PsychoPy version: 2020.2.10
What are you trying to achieve?:
I have a three-condition experiment where each condition is a separate routine. In each routine, the participant earns points. At the end of the experiment, I want to show them the total number of points they earned.

What did you try to make it work?:
I have tried solutions such as the links below, but the number of points keeps coming up as 0.

My main challenge is that I don’t know exactly where I am supposed to be inserting those code components in the builder. And, if there is a way to modify the .py file directly I would be very comfortable doing that if someone can point me to where it’s supposed to be located in the standard folder structure.

Place the code component inside the routine you want to score, at the very top of the component list. In one of thhese components set a variable in the begin experiment tab (e.g. myScore = 0). In each code component in the every frame tab set myScore to go up by one when the participant does something rignt. At the end of the experiment you can show the total number of points with a text component containing $myScore as text

Thank you for helping, @tandy! I must still be missing something. Below are screen shots of what I believed your recommendations to be. The final text was still showing 0. Perhaps I’m calling the variable incorrectly at the end?

Update on this thread in case anyone finds it. I still am unable to get the points to show when I run the .psyexp file locally. However, when I deploy it online the code is working. If anyone can solve that riddle, I would love to know! Otherwise, I think I am okay for now.

Hi David,

I am really puzzled about why the code is not working. I was suggesting another soution that for sure works online but should also localy, I you want you can give it a try anyway.

Basically you set your mouse to record the correct response (you also need to add a column with the correct response on your .xlsx files) and in the code component in the end routine tab, you add one to the score if the response was correct (e.g. if mouse.corr: → score =+1)

Hey Tandy,

I am puzzled as well - very odd. I am also running into another issue when I push the experiment online in that the order of the stimuli on the screen are reversed. For example, text in one component should be viewable on top of a square. However, when I push it online, the square is now on top of (and thus hiding) the text. Any thoughts on this one?