# Feedback not giving the right feedback

**URL:** <https://discourse.psychopy.org/t/feedback-not-giving-the-right-feedback/24440>\
**Category:** Builder\
**Created:** [August 6, 2021, 4:40pm UTC](https://discourse.psychopy.org/t/feedback-not-giving-the-right-feedback/24440 "2021-08-06T16:40:44Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![sandryne.guay](https://avatars.discourse-cdn.com/v4/letter/s/45deac/32.png) [@sandryne.guay](https://discourse.psychopy.org/u/sandryne.guay)\
**Post date:** [August 6, 2021, 4:40pm UTC](https://discourse.psychopy.org/t/feedback-not-giving-the-right-feedback/24440/1 "2021-08-06T16:40:44Z")

</div>

**OS** (e.g. Win10):  
**PsychoPy version** (e.g. 1.84.x): 2021.1.4  
**Standard Standalone? (y/n)** If not then what?:  
**What are you trying to achieve?:** I am building a lexical decision task. Participants have to decide if the word they see on the screen is an animal or not by pressing the left or right key in a limited time. In the practice trials, I need feedback only when the participants have the good answer (press the correct key), anything else (wrong answer or no answer) has to have no feedback.

**What did you try to make it work?:** I have tried this code and I tried writing it in different orders (i.e correct key first, then no key pressed …):

 ![Codes](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/0/a/0a935842efff03620c95ad59ab0d60e22b1d3335.png)  
I have `msg='' ` in the Begin Experiment section.

 ![Trials](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/9/8/982266e474ccce1f374c657ad3ada52242e0241a.png)

**What specifically went wrong when you tried that?:** When the participants don’t answer in the time given, the feedback is the same as the previous trial (i.e 1st trial the participant has the good answer and has a positive feedback, 2nd trial the participant doesn’t press any key and still has a positive feedback even if it is not the correct answer). When they don’t press the correct key, no feedback is given and the next trial starts.  
I do not have any error message.

Thank you for your help!!

---

<div class="post-metadata">

**Author:** ![jgeller112](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/jgeller112/32/9835_2.png) [@jgeller112](https://discourse.psychopy.org/u/jgeller112)\
**Post date:** [August 6, 2021, 6:22pm UTC](https://discourse.psychopy.org/t/feedback-not-giving-the-right-feedback/24440/2 "2021-08-06T18:22:49Z")

</div>

Hi!

Check this out, if you have not done so already: [Tutorial 3: Adding trial-by-trial feedback in PsychoPy - YouTube](https://youtu.be/bfbtqGCKf-A).

---

<div class="post-metadata">

**Author:** ![sandryne.guay](https://avatars.discourse-cdn.com/v4/letter/s/45deac/32.png) [@sandryne.guay](https://discourse.psychopy.org/u/sandryne.guay)\
**Post date:** [August 6, 2021, 8:37pm UTC](https://discourse.psychopy.org/t/feedback-not-giving-the-right-feedback/24440/3 "2021-08-06T20:37:35Z")

</div>

Hello,

Thank you for your response!  
However, I have seen this tutorial and it is not the type of feedback that I want to put in my task.

---

<div class="post-metadata">

**Author:** ![tandy](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/tandy/32/9246_2.png) [@tandy](https://discourse.psychopy.org/u/tandy)\
**Post date:** [August 6, 2021, 9:49pm UTC](https://discourse.psychopy.org/t/feedback-not-giving-the-right-feedback/24440/4 "2021-08-06T21:49:24Z")

</div>

Try setting the text component duration as a variable set to change every repeat (e.g $myDuration) and in the code set myDuration = 0 when you do not want anything to appear and myDuration = 1 when you want to display the feedback message.

---

<div class="post-metadata">

**Author:** ![sandryne.guay](https://avatars.discourse-cdn.com/v4/letter/s/45deac/32.png) [@sandryne.guay](https://discourse.psychopy.org/u/sandryne.guay)\
**Post date:** [August 8, 2021, 8:55pm UTC](https://discourse.psychopy.org/t/feedback-not-giving-the-right-feedback/24440/5 "2021-08-08T20:55:09Z")

</div>

Hi,  
Thank you for your suggestion! This is what I did:

 ![CodesmyDuration](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/c/6/c67f74019ccbb9a2faaccd0e63ce10a75127b2b3.png)  
 ![msgmyDuration](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/0/5/0525c493f0b80baffdfde0f58e34e7b2baa958bb.png)

But I got this error:

 ![myDurationerror](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/5/c/5c56b57d6218d0627882c430af62192edd59787d.png)

I don’t know how to fix this error code?

---

<div class="post-metadata">

**Author:** ![tandy](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/tandy/32/9246_2.png) [@tandy](https://discourse.psychopy.org/u/tandy)\
**Post date:** [August 9, 2021, 7:03am UTC](https://discourse.psychopy.org/t/feedback-not-giving-the-right-feedback/24440/6 "2021-08-09T07:03:34Z")

</div>

I am not shure, where in the code is this line located.  
In the code component you can delete the msg = “” part and change conitnueRoutine = False to myDuration = 0 to see if somehow it fixes the problem

---

<div class="post-metadata">

**Author:** ![sandryne.guay](https://avatars.discourse-cdn.com/v4/letter/s/45deac/32.png) [@sandryne.guay](https://discourse.psychopy.org/u/sandryne.guay)\
**Post date:** [August 11, 2021, 3:48pm UTC](https://discourse.psychopy.org/t/feedback-not-giving-the-right-feedback/24440/7 "2021-08-11T15:48:22Z")

</div>

I think I solved the problem! Actually, the syntax error was the ‘$’ before the ‘myDuration’ in the text component. I erased it and it works! This is what my text component properties look like:

 ![Capture d’écran (18)](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/8/2/825852012ad0fffcad4fe0accc807be5521fcb93.png)

Thank you very much for your help!
