| Reference | Downloads | Github

Trigger associated to feedback error

If this template helps then use it. If not then just delete and start from scratch.

OS (e.g. Win10):
PsychoPy version 3.03
**Standard Standalone? yes
What are you trying to achieve?:
I have different triggers associated to type of feedback, all triggers are defined in my condition files and seem to be sent accordingly, but there is an exception, when participants make errors, the number of the trigger associated to feedback should be different.

What did you try to make it work?:
I´ve used this piece of code when I set the feedback message:

if resp.corr:
    msg= "Mmm...qué bueno!\npuntos:" + str (Value)
    msg= "Puagh...esa no me gustó!"
    trigger_feedback= 100

What specifically went wrong when you tried that?:
In the spreedsheet data, those trials in which resp.corr = 0, in the column trigger_feedback still appears the value associated to correct response, instead of a value of 100. I am not sure if I did a mistake and I should change the value of trigger associated to feedback error in a different way. Thanks so much in advance!

How and when are you saving that variable to the data file?

Thanks Michael for your short answer, honestly I didn´t know I have to do something to save the information about triggers in the data file, I just realized that they are not updated properly in the data file which appears by default when running the program. That means I have to fix that in the coder??

Yes, PsychoPy can’t know which of all the variables that you might create yourself in code actually need to be stored in the data, so you need to explicitly save them (e.g. in your custom code, you can end up creating all sorts of temporary variables that don’t actually need to be saved).

You would tell PsychoPy to save your variable like this:

thisExp.addData('data_column_name_you_want', trigger_feedback)

The only variables that get saved automatically are ones in your conditions file, ones entered in the information dialog at the start of experiment, and ones created by Builder components. I’m guessing that you have a column in your conditions file called trigger_feedback, which probably isn’t needed if you are creating it in code in response to what the subject does (i.e. it doesn’t make sense to define it in advance). So you could delete that column and use that name in the code component, or just use a different name in case I’ve misunderstood what you are doing (don’t use the same names: they will conflict with each other).

Now you will need to be careful how you control that variable. e.g. maybe you reset it to some default value at the start of a routine, or you give it a different value when the response is correct vs when it is incorrect, and so on.

No, just use a code component (which is what I presume you are using for the code snippet above).

Hi Michael, thank you so much for your help! That worked beautifully : )