Millisecond Forums

hungry donkey getting more hungry: feedback problem

https://forums.millisecond.com/Topic1974.aspx

By HTibboel - 9/23/2008

Hi all,


We are currently programming an experiment using inquisit 2.0 in which participants are required to choose one out of 4 doors. Depending on the chosen door, a number of points is won or lost. This number differs over doors AND trials (cfr. Iowa gambling task). On each trial, feedback should be given concerning the points won and lost on the current trial, AND the total amount of points. Does anyone have an idea on how to keep track of the points scored on each trial, on how to calculate the total score, and on how to present these scores to the participant?


Thanking you in advance,


Kasia, Helen & Bram

By Dave - 9/23/2008

If I'm not totally off, there is absolutely no way to do this with Inquisit 2.0. You'll most definitely have to consider upgrading to version 3.0 to get advanced features such as keeping track of scores, being able to use mathematical expressions in scripts etc.

Best,
~Dave
By seandr - 9/24/2008

I've heard of some customers using trialcount on dummy trials to track points. Basically, you branch to a certain type of dummy trial and then repeat that trial for as many points as you want to reward. This approach is cumbersome, and it's quite limited in what you can do.


Inquisit 3, on the other hand, has a whole bunch of new features designed to support exactly this kind of task. Check out our Iowa Gambling Task sample, for example:


http://www.millisecond.com/download/samples/v3/IowaGamblingTask/default.aspx


If you can swing it, you should upgrade to Inquisit 3.


-Sean

By Dave - 9/24/2008

Dear Kasia, Helen & Bram,

I've heard of some customers using trialcount on dummy trials to track points. Basically, you branch to a certain type of dummy trial and then repeat that trial for as many points as you want to reward. This approach is cumbersome, and it's quite limited in what you can do.


... the most relevant limitation being that you can only *add* points with no way to *subtract* points as would be required by your paradigm. Sorry for me being such a smart-***, Sean! I love the trialcount approach for its obvious creativity, though.

Best,
~Dave
By HTibboel - 9/24/2008


Thank you for your tips! In the meantime I managed to upgrade it to Inquisit 3. However, branching does not seem to work. I am comparing my script with the IGT, however, I can't find my mistake. Can anyone help me on that please (cfr. infra)?


Regards,


Kasia


**************



<trial trial_ID1>


/ ontrialbegin = [picture.door_1.item.1 = "door_1.jpg"; picture.door_2.item.1 = "door_2.jpg"; picture.door_3.item.1 = "door_3.jpg"; picture.door_4.item.1 = "door_4.jpg";]


/ stimulustimes = [1=door_1,door_2, door_3, door_4, donkey; 6000 = CUE]


/ responsetime = 6000


/ response = timeout(1000)


/ validresponse = ("q","s", "k", "l")


/ branch = [if (true) trial.HD_ID1_feedback]


</trial>


<trial HD_ID1_feedback>


/ ontrialbegin = [ if (trial.trial_ID1.response == "q") {picture.door_1.item.1 = "8r_4g.jpg"; text.gain.hposition=picture.door_1.hposition; text.loss.hposition=picture.door_1.hposition; values.gain=4; values.loss= 8; values.currenttotal = values.currenttotal+values.gain-values.loss}]


/ ontrialbegin = [ if (trial.trial_ID1.response == "s") {picture.door_2.item.1 = "50r_4g.jpg"; text.gain.hposition=picture.door_2.hposition; text.loss.hposition=picture.door_2.hposition; values.gain=4; values.loss=50; values.currenttotal = values.currenttotal+values.gain-values.loss}]


/ ontrialbegin = [ if (trial.trial_ID1.response == "k") {picture.door_3.item.1 = "1r_2g.jpg"; text.gain.hposition=picture.door_3.hposition; text.loss.hposition=picture.door_3.hposition; values.gain=2; values.loss=1; values.currenttotal = values.currenttotal+values.gain-values.loss}]


/ ontrialbegin = [ if (trial.trial_ID1.response == "l") {picture.door_4.item.1 = "10r_2g.jpg"; text.gain.hposition=picture.door_4.hposition; text.loss.hposition=picture.door_4.hposition; values.gain=2; values.loss=10; values.currenttotal = values.currenttotal+values.gain-values.loss}]


/ stimulustimes = [1=door_1, door_2, door_3, door_4, gain, loss, huidig_totaal]


</trial>

By Dave - 9/24/2008

Can you zip your script along with any external files needed (images, etc.) and upload it somewhere? I'd be happy to take a look - but the debugging will be much easier with the full script at hand. You can use free file hosters like rapidshare or megaupload to upload the file and then post the download link here.

Best,
~Dave
By seandr - 9/24/2008

I don't see any problem with your branch, but you might try removing the "if (true)" part, as in:


/ branch = [trial.HD_ID1_feedback]


This is logically equivalent to what you currently have.


-Sean

By HTibboel - 9/24/2008

Hi Dave,


That's really kind of you!!We are really panicking now..


On the next site you can find our stimuli and scripts: http://www.megaupload.com/?d=ULZ0BP4D


The design of the task is as follows:


If you run the block 'sukeltjes' (this is a block in which we tried to program one branching trial, don't mind the other trials, because the design will be the same for them), you should see four doors; the participant has to choose one door by pressing q,s,k, OR l on a standard azerty keyboard. Depending on the chosen door, a certain reward is given (apples):


for door 1 = 4 apples won and 8 apples lost


for door 2 = 4 apples won and 50 lost


for door 3 = 2 apples won and 1 lost


for door 4 = 2 apples won and 10 lost


Feedback should be: the chosen door should be replaced by an open door showing the amount of apples lost and won (e.g. see picture 8r_4g.jpg), the total amount of apples gathered over trials (instead of the donkey), in the lower right corner: a bar showing visually the gains and losses (e.g. Bar13_87.jpg) on that particular trial with underneath the gains and losses on that particular trial in numbers (e.g. +4 and -8). For instance, if the participant gained a total of 6-19 apples over all trials, the bar 13_87 should be presented next to the fourth door. All feedback should be given at the same time during 2500ms.


Do you see the problem in the script?


I hope you can help us out, since we are really getting short in time.


Regards,


Kasia & Bram


By Dave - 9/24/2008

I've had a look at your files and - as it seems - you've hit on a few Inquisit bugs. So, from what I can tell, it's not really your fault that things aren't working as they should. Here's a workaround for you, though. The general problem is that the /ontrialend and /ontrialbegin branches appear to have a hard time to work with keypress responses when they're given as "literal" values:

/ ontrialbegin = [if(trial.trial_ID1.response == "s") ...]

If you use the key's scancode (see here: http://www.millisecond.com/support/docs/v3/html/language/scancodes.htm) instead, the script will start working. The scancode for the S-key is 31:

/ ontrialbegin = [if(trial.trial_ID1.response == "31") ...]

Also, if you switch the script to accept mouse instead of keyboard responses, it starts working as expected. I've attached a small test script based on your original file to demonstrate what I described above. I additionally recommend emailing Sean about the issue.

Now that you can have the core functions of your script running, I hope you'll be able to figure out the further details without too much hassle.

Best,
~Dave
By seandr - 9/24/2008

I believe the issue is that the response property returns the scancode of the key that was pressed, not the character value. The following conditional would thus never evaluate to true:


/ ontrialbegin = [if(trial.trial_ID1.response == "s") ...]


However, the following would be true if the subject pressed the "s" key:


/ ontrialbegin = [if(trial.trial_ID1.response == 31...]


because the scancode for "s" is 31. You can figure out scan codes for other keys using the Scancode tool on the Tools menu.


Is this a bug? Well, not exactly although it's not ideal either. Intuitively, both of these conditionsal statements should evaluate to true, so it's a matter of having the response property return different values depending on whether it's being compared with a string or a number. As of yet, no other property works that way, and it would require some mucking around with the expression evaluator to do this properly. I'll certainly put it on my list of possible features for a future release.


-Sean

By Dave - 9/24/2008

Is this a bug? Well, not exactly although it's not ideal either. Intuitively, both of these conditionsal statements should evaluate to true, so it's a matter of having the response property return different values depending on whether it's being compared with a string or a number. As of yet, no other property works that way, and it would require some mucking around with the expression evaluator to do this properly. I'll certainly put it on my list of possible features for a future release.


Sorry for somewhat falsely labeling this as a bug, Sean. I would have expected the expressions to work because within a trial using keypress responses noted as "literal" values the following syntax will function properly:

<trial mytrial>
/ stimulusframes = [0=sometext]
/
validresponse = ("a", "b")
/ responsetrial = ("a", happytrial)
/
responsetrial = ("b", sadtrial)
</trial>


I understand that Inquisit records the scankeys in its datafile, but I wasn't aware that - after a keypress response trial has finished - only the scankey will be availble as response-property at runtime. Might it be possible - again - to tackle this problem by adding a new property to the trial element that returns the "literal" key value instead of the scankey value? However, I personally think that this is a minor issue at best.

Cheers,
~Dave
By HTibboel - 9/29/2008

Thank you all for your valuable comments and tips!! My hungry donkey task works now!


However, we still have one problem. We first have an habituation block where the participants have to practice. During this block the amount of losses and gains are already calculated. When the first real block begins (the actual experiment) we would like to start from 0. Is it possible to set the score back to zero somehow? I have tried to work with onblockend, but that didn't work...


Greetz


Kasia

By Dave - 9/29/2008

Glad to hear it's basically working now. For resetting the scores, using '/ onblockend' generally seems to be the right idea. So, I suppose there's just some minor error somewhere in the syntax. If you'd again like to upload your updated script, I'll take a look.

~Dave
By HTibboel - 10/2/2008

Dear Dave,


Thank you!!! Well, the file is uploaded on the following link: http://www.megaupload.com/?d=VAM5O4TI


The habituation/try out block is depicted as Hungry Donkey0. When I tried out the following, it didn't work:


<block hungry_donkey0>


/ trials = [1-5 = noreplacenorepeat (trial_ID1, trial_ID2, trial_ID3, trial_ID4, trial_ID5, trial_ID6, trial_ID7, trial_ID8, trial_ID9, trial_ID10)]


/ onblockend = [values == 00]


</block>


Furthermore, we downloaded at one computer the tryout version of Inquisit 3.00. We tried to run this experiment but then we got the notification that their is a port problem (we need that for measurement of the physiological data).


Parallel port operation failed.


Line Number: 200


File: .\DirLptPort.cpp


Status Code: 9996


Error Message: 'No device handle'


Do you know what this imply? Because on the other computer everything works ...


Thank you again!! Regards,


Kasia

By Dave - 10/2/2008

Okay. This is fairly easy. You have these <values> in your script in order to keep track of gains/losses:

<values>
/ currenttotal = 0
/ previoustotal = 0
/ gain = 0
/ loss = 0
</values>

Now, after subjects have finished the habituation block, you'll want to reset all these values to zero. The correct syntax will look like this:

<block hungry_donkey0>
[...]
/ onblockend = [values.currenttotal = 0; values.previoustotal = 0; values.gain = 0; values.loss = 0]
</block>

As you can see, you have to specifically tell Inquisit the "name" of each <values> entry to reset. One further note: Assigning a value is done by using a single "=" sign. On the other hand, the double "==" sign is a logical operator used for evaluating the "Truth" of comparisons. That's that.

The port problem is a different story. Here are some basic things to check on: First, make sure that the computer really has a physical parallel port (i.e. crawl behind it and see if it's there). Also check the Windows device manager and see if you can find a correctly installed parallel port. Then start Inquisit and run the Parallel Port Monitor from the Tools menu. Switch through the port numbers and look for an entry that displays a non-zero value under port address (e.g. "378" or "3BC" on some systems). Once you have this, change the <port> elements in your script to use the correct port number (right now, they're referencing LPT1).

Best,
~Dave