How can I present total money won after each trial?

261 views
Skip to first unread message

Hyunok Kim

unread,
Jul 27, 2015, 4:08:16 AM7/27/15
to E-Prime


Hello
I've  been designing a experiment provides feedback after each trial using Eriksen Flanker task.
In monetary feedback condition, participants win money if they respond correctly and they lose money if they don't.


I want to present feedback slide after each of the trial and I also want to show them the total amount of money they won.
I've searched for the way I can do this, but I can't find the answer because the task procedure I made has list in it.Like this

 
What I understand from searching is that I should use the Inline object. But I can't figure out How and Where shold I put it???I would be so grateful if someone can help me with this. 

ahme...@gmail.com

unread,
Jul 29, 2015, 1:03:10 PM7/29/15
to E-Prime, hyuno...@gmail.com
You need to use something called a global variable to keep track of a value that changes throughout your experiment. This would go in the "User" tab of the Script.

Put something like this into this User tab:
Dim totalreward As Long

In the very beginning of your experiment, put an inline code that sets totalreward to 0:
totalreward = 0

Next, put another inline code after your target slide and write:
If yourslidenamehere.ACC = 1 Then
totalreward = totalreward + 1
End If

You're now going to need to log these totalreward values. Just add an inline code after your list and write:
c.SetAttrib "totalreward", totalreward

To show your participants their total score, simply put a TextDisplay object at the end of your experiment (after the above inline code that logs it all) and write something along the lines of:
You earned [totalreward] rewards!

I think there is a sample experiment that comes with e-prime that does a better job of demonstrating this, so you can also take a look at that.

Good luck,
Ahmet

Hyunok Kim

unread,
Jul 29, 2015, 10:44:51 PM7/29/15
to E-Prime, ahme...@gmail.com
Thank you so much!
I was about to give up and find some other way.
I tried to follow the way you told me, like this

 
in the first inline code(inline 9 in the picture) = totalreward = 0
and the second inline code(inline 2 in the picture) =If StimSlide.ACC = 1 Thentotalreward = totalreward + 125 End If (the amount of money they can get is 125. So I wrote like this. Is this right ?)
and the last inline code(inline 8 in the picture) = c.SetAttrib "totalreward", totalreward

And I added a text in the feedback display slide, and wrote You earned [totalreward] rewards!


And It worked out..partly.. 

 When I run the file..feedback slide shows that "You earned 0 rewards!" at every trial.
What is wrong?

I want to show the participants how much money they won at every trial.

And also, I want to substract the same amount of money every time participant lost a trial.

I added like this: If StimSlide.ACC = 0 Thentotalreward = totalreward - 125  in the inlinecode 2. But when I did this, error message popped up.

I would be very, very grateful if you give me some advice. Thank you so much!


ahme...@gmail.com

unread,
Jul 30, 2015, 11:21:47 AM7/30/15
to E-Prime, hyuno...@gmail.com
I think the problem is you're setting totalreward to 0 within ListRed. This means every time TestProc is executed (which I assume is every trial), you're telling eprime to make totalreward = 0. What you want to do is put totalreward = 0 before your list starts. You can put it before your instruction slides, for instance. Just move inline9 before the list.

If you'd like to also subtract money for incorrect responses, just add an else statement (or an else if statement if you don't want the subject to hit negatives). This would go inside inline2. For example:

If StimSlide.ACC = 1 Then
totalreward = totalreward + 125
    Else If StimSlide.ACC = 0 Then
        If totalreward <= 125 Then
        totalreward = 0
        Else
        totalreward = totalreward - 125
        End If
    End If
End If


Above code simply tells eprime to add 125 for correct, and subtract 125 for incorrect if they have enough earnings (0 is the poorest they can be). If you don't mind the numbers hitting negative, you can replace all of the above with a short
If StimSlide.ACC = 1 Then
totalreward = totalreward + 125
Else totalreward = totalreward - 125
End If"

at inline 2 and you should be OK.

Subtracting the amount leading to an error is hard to troubleshoot without knowing the exact error message.

As for feedback, from what I understand you would like to let people know how much they earned/lost after each trial. You can just write "You earned $125" and "You lost $125" in the text boxes inside the feedback display slides. There are Correct/Incorrect/No Response slide state tabs at the bottom of the feedback display slides.
 
Additionally, if you would like to also display a running total of their earnings after each trial, you would use c.SetAttrib("totalreward") within each trial. So Inline2 would look like this:

If StimSlide.ACC = 1 Then
totalreward = totalreward + 125
c.SetAttrib "totalreward", totalreward
    Else If StimSlide.ACC = 0 Then
        If totalreward <= 125 Then
        totalreward = 0
        c.SetAttrib "totalreward", totalreward
        Else
        totalreward = totalreward - 125
        c.SetAttrib "totalreward", totalreward
        End If
    End If
End If

If you would like to give them the total amount of their earnings at the end of the experiment, that would go outside of the list (in EndOfTest, for example), where you say "total earned = [totalreward]. Don't forget to add an inline right before EndOfTest to add
c.SetAttrib "totalreward", totalreward
totalreward = totalreward

I tested this stuff on my machine really quickly and it seems to work like a charm. Best of luck.
Reply all
Reply to author
Forward
0 new messages