Howdy, Stranger!

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

Supported by

Calculating Acc with text_input widget


I've programmed a mathimatical task in OpenSesame and participants need to answer with a multi-character response.
I'm using the text input widget for this because participants need to see what they are typing. Between trials participants receive feedback (correct / incorrect / late). Because of the text_input widget I had to define this within an inline script. This was quite easy. See script below:

import numpy
import string

CR_answer = var.number1 + var.number2 + var.number3 #random numbers for creating addition problem
exp.set("CR_answer", CR_answer)

if var.CR_response == CR_answer:
var.set("CR_correct", 1)
var.set("CR_late", 0)
var.set("CR_correct", 0)
var.set("CR_incorrect", 1)
var.set("CR_late", 0)

if var.CR_response == "":
var.set("CR_late", 1)
var.set("CR_correct", 0)
var.set("CR_incorrect", 0)

However...Partcipants also need to see their total score at the end of the round (amount of trials in each round is 5). If you use keyboard response, the acc can be easily used.

Does anyone know how I can calculate a final accuracy score when the text input widget is used? Another inline script for calculating the total amount of correct answerd within a round is also fine!

Thanks in advance!


  • Hi,

    Use an inline_script (run phase!) and create your own accuracy. All you need is a variable for the total amount of trials, and the amount of trials with a correct response. Et voila.


Sign In or Register to comment.