Search code examples
feedbackpsychopy

Psychopy: how to reference value in conditions file for feedback


I'm sure this is deadly simple, but I'm new to Psychopy and Python, so here goes:

I have a conditions file similar to the following (in builder):

text correctAns trialType

text1 Ans1 TrialA

text2 Ans2 TrialB

When giving feeback to users after each trial, I'd like to give different feedback on A trialTypes as compared with B trialTypes. I can't find how to reference the trialType however.

What I'd like to know is what do I need rather than "trialType" in the code below:

if trialType == 'TrialA' msg="This was an A Trial!" else: msg="This was a B Trial!"

Thanks for your help! D (edited to correct code formatting on 23 Feb 2015)


Solution

  • Make sure that the syntax is correct (indentation is relevant). Something like the following should do with your variable definitions:

    if trialType == 'TrialA':
        msg = "This was an A Trial!"
    else:
        msg = "This was a B Trial!"
    

    Another option is to just add another column with your trial-type-specific message, which you can use for text display.

    Cheers,

    Axel