Howdy, Stranger!

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

Supported by

[solved] Log question answer - keyboard response

edited February 2016 in OpenSesame

Hi, I am trying to log a keyboard response from my experiment.

The relevant prepare inline script:

kb = keyboard(exp,keylist= ['t'],timeout = 27000)
question_response = keyboard(exp,keylist= ['y','n'],timeout = 30000)
if answer == 1: 
    correct_answer = 'y'
else:
    correct_answer = 'n'

# the if statement basically reads from a csv file where the answers are defined as y or n  


# and the run script:
if question and not question.isspace():
    question = (question + yes_no)
    my_canvas_question = canvas(exp)
    my_canvas_question.text(question, center=True, x=None, y=None, max_width=None, color='black', bidi=True, html=True)
    my_canvas_question.show()
    question_response.get_key()
    my_canvas_question.clear()
    # 1 is correct response and 2 is wrong 
    if question_response.get_key() == correct_answer:
        ParticipantResponse == 1
    elif question_response.get_key() != correct_answer:
        ParticipantResponse == 2  

How do i log whether the participants answered correctly or not? or log the answer + the correct_answer?
Have tried various method, but nothing seem to work and OS simply complains that e.g. ParticipantResponse is not defined.

Comments

Sign In or Register to comment.