Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Displaying % accuracy

Hi, I am new to OpenSesame and trying to get to grips with the script. My experiment is an emotion recognition task, so far I have used inline script to make the layout consisting of one image and four button choices, not sure if it is correct:

I would like to display feedback of the percentage of correct answers at the end of the sequence, I have added the feedback and have entered the following inline script before the feedback based on what I found on the forums, but not sure what to define where "???" is for my particular experiment.
var.totalNoTrials += 37
if ??? == var.correct_response
var.totalCorrect += 1
var.acc = float(var.totalCorrect)/var.totalNoTrials


  • edited March 1


    First you have to define the variables before you enter the form loop. So in an line_script, do this:

    # ideally in the prepare phase
    var.totalTrials = 0
    var.totalCorrect = 0

    After the form you can add this code.

    var.totalTrials  += 1
    if response== var.correct_response:
         var.totalCorrect +=1

    Then, after all forms (basically after the block), you have to compute accuracy (with the formula you have used above) and finally put it into a feedback item.

    Does that help?


Sign In or Register to comment.