Howdy, Stranger!

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

Supported by

code for simple counter

I am trying to write open sesame code to implement a simple counter for total correct responses for three differnt types of word stmuli. Its a simple yes-no experiment with keypress response.

I have used a varable in the loop to specify the word type.

I am having difficulty with the code. Ive used "run if" part of the loop for the conditions,

What I want to do is when the keypress response is correct AND it belongs to type x I want the counter to increase. At the end of the experiment i want the screen to show the count for correct responses for each of the 3 stimulus types

To start with I tried to assign a variable for each type and form a basic counter to count the yes responses, but i have havent got the syntax correct. Can anyone help me?


Comments

  • Hi Jarrold,

    The problem is that for now you just made the showing of the sketchpads named count1/2/3 conditional on the type (and a correct response), but you are not updating any of the variables after assigning them the initial 0 values. I would write a small inline python script.

    In your Assignvar script you could make variables

    var.reg = 0

    var.irr = 0

    var.non = 0

    Then instead of the count1/2/3 sketchpads you could use an inline script with something like this:

    if var.type == 1 and var.correct == 1:

    var.reg += 1

    elif var.type == 2 and var.correct == 1:

    var.irr += 1

    elif var.type == 3 and var.correct == 1:

    var.non += 1


    Think that should work.

    Cheers,

    Louisa

  • Yes thats so much that works perfectly!

Sign In or Register to comment.