Amount not updating on each trial

20 views
Skip to first unread message

Garima Shivnani - Field Investigator (CDAC-NFSU)

unread,
Jun 3, 2025, 5:37:37 AMJun 3
to E-Prime
Hello everyone,

I am Garima. I am currently working on an experiment called the IOWA Gambling task. I wanted to make an Indian version of the same. 

I am facing a recurring issue. On every trial, based on the card selected by the participant, the balance will update. Let's say you initially had 4000, and on the first trial you won 200. Now your total balance would be 4200. The experiment runs fine until here but the main balance resets to 4000 each trial, now I want it to take 4200 as the new balance and add or subtract from this, that ain't happening. 

I tried everything from my side, but couldn't solve the issue. I would really appreciate some help with this. 

Thank you
Regards,
Garima Shivnani

Michiel Spape

unread,
Jun 3, 2025, 5:41:34 AMJun 3
to e-p...@googlegroups.com

Hi Garima,

My guess is that you have a ‘total balance’ somewhere defined as an attribute. At the end of the trial, you might update it to 4200 or whatever, but with the next trial, the total balance is filled in once again. The easiest solution is to simply define “Dim currentTotal as long” in the user script of the experiment, and then after each trial to add or subtract from this amount. Then, instead of using the attribute “totalBalance” to show some number, add a little script before it shows, writing “setattrib “totalBalance”, currentTotal” Voila.

I was just busy with looking at an old experiment I based on the iowa gambling task, actually; what a coincidence!

Best,

Michiel

 

 

// Michiel Spapé, PhD

// Associate professor in cognitive neuroscience

// Institute of Collaborative Innovation

// Centre for Cognitive and Brain Sciences

// University of Macau

// N21 Office 1015c

// Avenida da Universidade

// Taipa, Macau SAR

 

--
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To unsubscribe from this group and stop receiving emails from it, send an email to e-prime+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/e-prime/CAEeA3vUh57LC%2Bjf9LCmdU3v%2BuPC8R89hrEJtt6rxcAdL93zu1w%40mail.gmail.com.

Yang-Ming Huang

unread,
Jun 3, 2025, 5:41:38 AMJun 3
to e-p...@googlegroups.com
do you want to modify from the examples?

 I've used this one 

Yang-Ming

--
Reply all
Reply to author
Forward
0 new messages