| Reference | Downloads | Github

Scoring responses and showing total points at the end

Hi everyone,

I´m using Psychopy3 builder (Standalone Psychopy3, 3.0.3 win32, Python 3.7 (32-bit), Windows 10 pro) to build an experiment in which participants have to learn which stimulus goes with the correct answer. Correct answers can be left or right, and depending of particular stimuli, can be scored with 10 or 100 points. I already have a feedback message to let them know the score every trial, but, what I need now is showing in the screen the total points earned after each block. I got a column in my condition files called “Value” where I inserted the corresponding points for each correct answer. I also have a rest period after each type of trial (2 of them per block) where ideally I would like to show them the accumulated points. I read a lot of entries of this forum and I tried different pieces of code, but it fails every time, I attach some screenshots, actually, reading one entry I started to think that maybe I shouldn´t have a column in my condition files specifying scores, but I don´t know how to tell Python when a correct response is scored with 10 or 100 points, and “please sum all points in the last block and show the result”. The scores should be added to the total sum every time, so at the end can be shown the total points earned during the task. Since I specified previously the values, I can see the values in the final data excel, but I don´t know how to make the sum.

More details about the design:

I have 2 types of trials regarding if stimuli are at fixed positions or changing randomly to left or right position at the screen from one trial to another. Within each trial, I have 8 different groups to counterbalance important features for my experiment. I also have 2 blocks, so half of participants will start with fixed trials or random trials instead. I select the block to start with and the rows for the counterbalancing group through expInfo.

Any comment would be more than appreciated. Thanks in advance!

Here is some screenshots about what I´ve been doing:
One of my condition files:

My last try:

Then I tried to insert the code on top of trial components (instead of feedback, or rest routine), but also didn´t work:

It is much easier for us to suggest changes to code if you post the actual code in to your message as text, rather than as screen shots (we can’t cut and paste from that), as follows:

In this case, be aware that languages like Python use different operators for testing equality (i.e. a == b) vs assignment (i.e. a = b).

Thanks Michael to answer back in such a short time. I already fixed it by using this piece of code (in trial routine):
Begin experiment: score=0
End routine:

if resp.corr:
    score += Value