Displaying feedback after each block in E-Prime

If you don’t use E-Prime for psychological experiments, skip this post.
It’s written for the benefit of psychologists who have the misfortune of using E-Prime without a programmer husband to help them out.

E-Prime only allows you to display feedback after each stimulus:
Feedback after stimulus
What if you want to show feedback after each block? This won’t work:
Feedback after TrialList
Because in this case, only the last response in each block will be added to the statistics. Worse, the feedback screen will show “Correct” or “Incorrect”, according to that last response.

I succeeded to solve the problem by taking some of the Basic code generated by E-Studio and customizing it. This is the updated experiment:
With code
As you see, Feedback now resides under Unreferenced objects, i.e., it doesn’t reside inside a procedure. To achieve this, either delete Feedback from the procedure it already resides in, or, if you haven’t created it yet, drag the FeedbackDisplay button to the background of the E-Prime window. In both cases Feedback will be unreferenced.

There are also two InLines. An InLine is a piece of code (program) that you can write yourself. When you double-click on an InLine, you get an empty page where you can write code. Here is the code you need in AddStats (note the small “copy to clipboard” link at the top):

'Add an observation to the accuracy stats
Feedback.AccStats.AddObservation Stimulus.Acc

'Add an observation to the response time stats
' unless the user did not respond 
If Len(Stimulus.RESP) > 0 Then
	Feedback.RTStats.AddObservation Stimulus.RT
	Feedback.CorrectRTStats.AddObservation Stimulus.RT
End If

Here is the code for ShowFeedback:

'Generate statistics text to be shown
'Note that if you add more text and then see that statistics appear in the wrong places, 
'try changing the numbers in Objects(1) and Objects(2)
Set Feedback_SlideText = CSlideText(Feedback.States.Item("Correct").Objects(1))
Feedback_SlideText.Text = "" & _
	Format$((Feedback.ACCStats.Mean / Feedback.ACCDivisor),Feedback.ACCFormat) & " Correct"
Set Feedback_SlideText = Nothing

Set Feedback_SlideText = CSlideText(Feedback.States.Item("Correct").Objects(2))
Feedback_SlideText.Text = "" & _
	Format$((Feedback.RTStats.Mean / Feedback.RTDivisor), Feedback.RTFormat) & _
	" Seconds Average Response Time"
Set Feedback_SlideText = Nothing

'You only need this part if you want to let the user close Feedback by pressing a key
If Keyboard.GetState() = ebStateOpen Then
	Feedback.InputMasks.Add Keyboard.CreateInputMask("{ANY}", "", CLng(Feedback.Duration), CLng("1"), ebEndResponseActionTerminate, CLogical("Yes"), "", "", "ResponseMode:All ProcessBackspace:Yes")
End If

' Show the window

If you name your feedback and stimulus objects some other names than Feedback and Stimulus, you’ll have to search for Feedback and Stimulus in the code and replace by the respective names you use. You can also customize your ShowFeedback code to modify the feedback text or to disable dismissing the feedback with the keyboard.



40 Responses to “Displaying feedback after each block in E-Prime”

  1. Tony Says:

    I just wanted to say a huge thanks for publishing this. I spent an hour doing this with my own maths, but something just wasn’t working. This is an elegant solution.

    As an addition you might point out that the Feedback abject still needs am Input Object specifying, and if you wish to use it in subsequent blocks it need resetting between blocks.

    Thanks again,


  2. Unhappy_Eprimer Says:

    Thanks for the script.
    But line 11 of ShowFeedback shouldn’t be
    Format$((Feedback.RTStats.Mean / Feedback.RTDivisor), Feedback.RTFormat) & _

  3. Lev Says:

    It should! Thanks.

  4. cy. Says:

    thank you – this script was very helpful !

    is there an easy solution how to show 2 different feedback slides (e.g., if block mean accuracy > 85% show another feedback than if block mean accuracy < 85%) ?

  5. SW Says:

    Thanks! You saved my day!

  6. Mike Says:

    Big thank you for making this.

    Some things that many may know, but I just figured out:

    1) You can add more text to your Feedback slide by adding textboxes within the slide in your unreferenced e-object folder (e.g. I added something like “You answered…” at the very top of the slide)

    2) You can alter the text that the ShowFeedback puts on the Feedback slide by changing the in-line (e.g. I switched ” Correct” in line 6 to “of the questions correctly”). However, it crashed if I tried to alter other places where it said “Correct” like on line 4.

  7. Lev Says:

    @cy. I haven’t worked with E-Prime for some time so I’m out of context 🙂

  8. J Dickinson Says:

    This is fantastic, I don’t suppose that you know how to get E-Prime to stop after a certain level of accuracy has been achieved?

  9. Becky Says:

    I’ve done something similar, where overall feedback is given after a practice block. There are different screens, depending on the performance during the practice block (above or below 80%). In the Session Procedure, after the Practice Block, I’ve inserted an InLine text called “CheckAccuracy”. The InLine code is as follows:

    If Feedback.ACCStats.Mean > .80 Then
    StartTask.Text = “Great! You’re ready to start the task!”
    StartTask.Text = “You did not achieve the required 80% accuracy.” &_
    “Now you’ll have another chance to practice before starting the task.”
    Goto StartPrac
    End If

    Note that Feedback.ACCStats is calculated automatically from other Feedback data, so in order for this to work there has to be feedback given on each trial. You might be able to change “Feedback.ACCStats” to “Stim.ACCStats” or some equivalent variable.

    Note also that the second condition (less than 80%) sends the program back to “StartPrac”, which is a label just before the PracticeBlockList, and the Feedback Stats must be reset in this condition so that the subject can get separate accuracy statistics the second time through the practice.

    Hope this is helpful!

  10. tedis.tafili@strath.ac.uk Says:

    Thanks for this, it was very helpful.
    I’m having a small problem though – what I want to do is to have a display, just at the end of the experiment, telling the participants how many they got correct.
    It is a memory experiment – Stage 1: faces are displayed and participant memorises them. Stage 2: faces are displayed again but this time participant indicates whether they have seen the face from Stage 1.

    I want to have a display at the end of the experiment to say: You remembered i.e. 50% of the faces..


  11. J Dickinson Says:

    I believe that if you just put in a feedback object at the end of the trial it has an option to show that. I have a program at work with it…I’ll double check it tomorrow.

  12. elchavodelocio Says:

    I have a trouble with this, in the line 274, column 21 of showfeedback, appears a trouble. It says that to the left of “.” (It means FeedbackEchoClients), must be an object, structure or dialog. I have no idea what have I done wrong.

  13. J Dickinson Says:

    Are you trying to use a counter as well? I had difficulty because I hadn’t set my counter attributes as an integer.

  14. elchavodelocio Says:

    I solved it, thx too much

  15. S.S. FLanagan Says:

    How did yo solve the part regarding the ‘left of “.” must be an object, structure or dialog”? elchavodelovio?

  16. S.S. FLanagan Says:


  17. Lauren Says:

    Lev, you are amazing! You saved my dissertation!

  18. doraemonbrave Says:

    Reblogged this on Doraemon's pocket and commented:
    This is helpful to me:) Really feel lucky to find this instruction here!!!

  19. Tabs Says:

    Hi, Can anyone please guide me as how to have break between blocks. I have total 8 blocks of words list and after each block there is an additional block consisting of distractor task. In this way, it made up total 16 blocks. but ditractor task block is same throughout experiment and other experimental blocks contain different word list.
    I want a selfpaced break after each block? how to do that.Please let me know if anyone know the solution.

  20. J Dickinson Says:

    Hi Tabs, I have a program in my lab that does exactly this, but I won’t be over there until the end of the week. I’m fairly certain that I did it in the script with a counter. In the meantime they have some example scripts here…this is where I got the information on how to do mine:


    Good luck

  21. aleena Says:

    Hi J Dickinson, Many thanks for the information. I am not in hurry, i will wait until you get back to your lab. It is good to see the example scripts In the interim. Thanks for sharing Link

  22. Anonymous Says:

    Hello! Can you please explain the input object that I need in the Feedback slide? Thank you!

  23. Lev Says:

    I’ve long since forgotten all about this…

  24. Anonymous Says:

    Not a problem, I think I figured it out! Thank you for this helpful post.

  25. AA Says:

    Thank you so much! It was so helpful!

  26. Student Says:

    Hi, thank you in advance for sharing this script. I’m trying to figure out what should be specified at “input object” of the Unreferenced Feedback.

  27. Steph Says:

    “input object” should be the object in which the participant is making the response. I.e. If you have a slide with a swatch of colours to choose from and they have to choose which colour is the one they’ve seen before: THAT is your input object.

    In the settings of that input object, you’ll find under the “duration input” tab that the “correct” response is the attribute you’ve defined in your trial list/block list. I hope that makes sense.

  28. gugs Says:

    Does anyone know how to solve the “left of .” problem that is appearing in the comments? I am getting it too…

  29. saleh Says:

    Hello I’m new in e-prime.
    How can I make the following criterion in e-prime?

    “if the subject perform a seven correct responses in any consecutive ten trials, the trial list will terminated otherwise the trials will be run repeatedly until the criterion is met”

    Thank you very much in advance

  30. Joris F Says:

    Thanks for sharing. This works, though you don’t really need a Feedback object.

    Instead you could use Summation objects, which you declare in the user tab of the script. After showing the stimulus you then use the AddObservation method to add e.g. reaction time.

    Here is an example from E-basic help, just search for “Summation”:

    ‘This example adds the reaction time for all correct trials to the
    ‘Summation Object, then prints the mean RT for correct trials to the
    ‘Debug tab in the Output window for viewing after the run concludes.

    ‘Enter the following script on the User’s tab of the Script Window.
    Dim CorrectTimes As Summation

    ‘Enter the following script in the Setup InLine Object.
    Set CorrectTimes = New Summation

    ‘Enter the following script in the After InLine Object.
    If StimDisplay.ACC = “1” Then
    CorrectTimes.AddObservation c.GetAttrib(“StimDisplay.RT”)
    End If

    Debug.Print CorrectTimes.Mean

    ‘Note: To run this example with E-BasicExample.es, copy the above script
    ‘to the appropriate objects as instructed.

  31. carole Says:

    HI, I am totally new with scripts on EP. I just encounter the following error message : variable not defined : the line referring to Set Feedback_SlideText…it seems that I must define what is the Feedback slide text but I do not know how and where ! If someone could help I would appreciate….

  32. Rodrigo Says:

    I don´t know if can help me, I´m using tags for my different stimulus but I can only use constants tags, I would like to know if it´s possible to use variable tags depending on the stimulus

  33. J Says:

    You’ll want to keep a constant tag for stim but use the cellist inorder to label them in sub-categories (I assume you are using an add-on package and you are sending information out? If not then just use attributes in the trial lists.

  34. Anonymous Says:

    How did you solve the part regarding the ‘left of “.” must be an object, structure or dialog”?

  35. Becky Says:

    I also had the same problem as mentioned above in the comment thread, with an error: left of “.” must be an object, structure or dialog. Solution was to enable responses in the “feedback” object. (To fix, double click “feedback”, open properties, navigate to duration tab, add keyboard as input device. The specific option that worked for me was: duration=infinite, allowable=any, time limit=until feedback, end action=terminate. This should solve that error problem and create a feedback window that waits until a keypress before closing.

  36. shivanjali Says:

    i want to write a inline script to add a manual pause after 20 trials. But i dont know how to do it. Anyone can please help me out

  37. Simon Says:

    I am trying to incorporate reward based on reaction time into an experiment. I would like to have E-Prime generate a score based on the response and have this displayed in feedback. Does anyone know how to do this?

  38. TamTam Says:


    Does anyone know how to reset this script between blocks?

    Many thanks

  39. mia Says:

    I am trying to figure out the correct response count rather than correct response percentage. Anybody has any idea about that?


  40. LisaZara Says:

    I am trying to use different different feedbacks in each trial. More in detail there are two conditions in which accuracy is one: a. Reaction time=0 and b. reaction time >0. I would like to give feedbacks to participants only in two cases: in the b condition and when accuracy is zero. In both cases I would like to use an image, because I will test children. Any suggestion would be very appreciate!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: