Millisecond Forums

adopted Columbia Card Task

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

By minin72704 - 7/30/2015

Hello, 
    I am totally new to Inquisit. I downloaded the CCT and made couple of modifications, such as reduced cards to 6. My questions are as following:
1. how to randomly choose cards from one of six cards by pressing "take card" button until subjects want to stop (by pressing the same button).
2.I can't control the trial duration (10 seconds) by setting /response=timeout(10000), /timeout or /trialduration in <trial pickcard>.

anyone can help me modify the syntax in the attachment, thanks. 


https://www.millisecond.com/forums/uploads/images/ca479b36-5d75-47a0-b7fc-24ed.jpg
By Dave - 7/30/2015

Re.#1: See attached.

Re. #2: You can of course set a 10000ms timeout. The question is what you want to happen if no response is given. Assuming you want to stop the round and turn over all cards, see attached.

Since you are new to Inquisit, I also strongly recommend you work through the tutorials in the documentation (if you haven't already done so).
By minin72704 - 7/30/2015

Hello, Dave
      I am greatly appreciate for your immediate reply. Thank you so much.
By minin72704 - 7/30/2015

Hello, dear Dave,
    I read "Inquist 4 Help". However, I did my best but can't figure out solution to my question. Before I my question presents, I concisely delineate my design. There are two tasks in my study: CCT_hot and CCT_cold. Within each task, there are two kinds of combination of stimulus (high risk, high return: 3 losscards and 20 points gain; low risk, low return:1 losscard and 12 points gain)  present 4 times each. As a result, it comes to a total of 8 trials (4 high risk conbined with high return and 4 low risk conbined with low return) within each task. I have already design both tasks respectively (see attachments with all files needed). How can I integrate both type of task with a total of 16 trials (each task with 8 trials) within one file, and let them present in random order? I will be appreciate for your suggestions. Thank you so much.   
By Dave - 7/31/2015

If you merely want to present the two *tasks* (hot and cold; 8 trials each) in random order, set up two <batch> elements in a separate script to run them:

<batch order1>
/ file = "CCT_Hot.iqx"
/ file = "CCT_Cold.iqx"
/ subjects = (1 of 2)
/ groupassignment = groupnumber
</batch>

<batch order2>
/ file = "CCT_Cold.iqx"
/ file = "CCT_Hot.iqx"
/ subjects = (2 of 2)
/ groupassignment = groupnumber
</batch>

Provide an odd group number to run the 1st order, provide an even groupnumber to run the 2nd.

If you want to randomly intersperse "hot" and "cold" trials, you need to merge everything into a single procedure. For that, you'll have to make sure that the respective elements for the "hot" and "cold" trials carry unique names. Work through the "How to Combine Multiple Scripts" topic in the documentation first to get the gist. Then apply that to your scripts, with which you should be sufficiently familiar at this point.
By minin72704 - 7/31/2015

Hello, Dave,
      I tried your suggestion, and it works but weird (see attachment:CCT_Cold and CCT_Hot are original files while the other two are modified and included in include element file) and it doesn't what i intended. First, I would like trials within both tasks can randomly intersperse by each single trial rather than blocked trails. In other words, trials in each of tasks are single events with random selected values (e.g. loss cards, gain amount) which resulted in a event related design (e.g. hot_trial1 - >cold_tial1->cold_trial2-> hot_trial2->.........................hot_trial8).  
By Dave - 7/31/2015

What your <include> element does is simply copy-paste the two scripts into a single file. Both scripts contain <expt> elements and Inquisit will just run those two <expt> in succession.

You need to do more than that.

(1) You need a single <expt> element in your "main" script (the one that contains the <include> element. Eliminate all other <expt> elements from the scripts.
(2) That <expt> element needs to run in essence a single <block> that runs *both* hot *and* cold trials. You need to implement the logic for that.

Essentially, your "main" script ought to contain something like this:

<expt>
/ onexptbegin = [if(script.subjectid=="debug")text.debuginfo.textcolor=white]
/ blocks = [1=CCT_Hot_And_Cold]
/onexptend = [values.completed = 1]
</expt>

<block CCT_Hot_And_Cold>
/ trials = [1-16=noreplace(getcondition, getcondition1)]
</block>

For this to work you'll also have to adjust the /branch logic in <trial turnover> and <trial confirm>. / branch = [trial.getcondition] and / branch = [trial.getcondition1] ought to be removed.
Second, it is not a good idea to have both "hot" and "cold" trials use the same <picture> elements etc. As you know, they treat cards etc. differently. So keep those separate as well, i.e., have

<picture CR1C1_hot>
/ items = ("covercard.jpg", "gaincard.jpg", "losscard.jpg")
/ select = values.CR1C1_hot
/ size = (28%, 28%)
/ position = (8%, 50%)
/ halign = center
/ valign = center
/ erase = false
</picture>

as well as

<picture CR1C1_cold>
/ items = ("covercard.jpg", "gaincard.jpg", "losscard.jpg")
/ select = values.CR1C1_cold
/ size = (28%, 28%)
/ position = (8%, 50%)
/ halign = center
/ valign = center
/ erase = false
</picture>

and so forth and use the correct stimulus elements in the respective trials.
By minin72704 - 7/31/2015

Hello Dave,
    Following your suggestion, I made some modification. I want the presence of scores feedback accompanied by each hot trial and this feedback must sustain 2 seconds. I tried many ways but I failed. The other question is that, I have no idea why cold trial always the first, after that both kinds of trials randomly intersperse. 
By minin72704 - 8/1/2015

For the first question, specifically, I added one trial (<trial evaluation>) and one text <text evaluationmsg> both followed by <trial pickcard>, and added /branch = [trial.evaluation] to the end of <trial pickcards>. I want to present the performance/score of the last trail after participant finishing one hot trial. But, it directly jumped to the performance (evaluation trial) when I press "button1" (take card) once.
By minin72704 - 8/1/2015

hi, Dave:
    The first problem was already solved. However, the second one (a cold trial always presented at first) was remianed unsolved.
By minin72704 - 8/1/2015

Hi, Dave,
     I have already resolved all the questions mentioned above by removing <blockCCT_cold>, <exptCCT_cold>, <blockCCT_hot>, and <exptCCT_hot> from separate files. Thanks for your helpful instructions.
By minin72704 - 8/1/2015

Hi, Dave,
    I have two more questions about my adopted CCT.
1. How can I only present mean score at the end of 8 cold trials since the hot and cold trials were randomly interspersed? I add following syntax in "CCT_cold-4.iqx", but I failed
<trial pickcard1>
/ ontrialend = [if (values.gameround1==8)trial.mean] 
</trial>

<trial mean>
/ stimulusframes = [1=BlankScreen, meanscore]
/ validresponse = (noresponse)
/ trialduration = 2000
/ showmousecursor = false
</trial>

<text meanscore>
/ items = ("mean score:<%values.totalscore1 / 8%>")
</text>

2. if participants finished a run/experiment at 310000ms befor my presetting time (e.g. 360000), how can I let them wait until the remaining time run out? I used /timeout=360000-black.CCT_Hot_And_Cold.elapsedtime in "<block CCT_Hot_And_Cold>" "include element-1.iqx", but it terminate at about 260000 while I didn't do anything (please see attatchment). 

 
By Dave - 8/2/2015

#1:

<trial pickcard1>
/ ontrialend = [if (values.gameround1==8)trial.mean] 
</trial>

The above does nothing and isn't supposed to. If you want to run a certain <trial> if a certain condition is met, you ought to use /branch, not /ontrialend.

#2: You need to give the script something to do for the remainder of the time. I.e., run a <trial> at the very end that does not accept any response and just sits there until the defined /timeout kicks in. A /timeout out defines the *maximum* allowed duration, it does not in itself impose a minimum or fixed duration (and isn't supposed to).
By minin72704 - 8/2/2015

Hi, Dave,
    I have already resolved all the problems, thank you.   

By minin72704 - 8/2/2015

Hi, Dave,
    I want to use Lumina response pad (with two buttons each hand) on data collection, I will only use one hand similar to mouse and only the left button is valided response. Does it mean that I can simply use this syntax <defaults>/inputdevice=xid</defaults> and unnecessarily add another syntax to my main script?  The other question is that  I can't find the driver for Lumina on Cedrus' web site, caould you give some instruction to download the driver.  Thank you. 

By Dave - 8/2/2015

No, simply changing the /inputdevice may not be enough. You also need to adapt any /validresponse, /isvalidresponse, /correctresponse, /iscorrectresponse attributes as well as any other logic (in /ontrialend etc.) that makes use of the response property. All those need to reflect whatever the Lumina pad (in the configuration you want to use) returns as responses. See the "Using Cedrus RB Series and Lumina Response Boxes with Inquisit" topic in the documentation for an overview.

As far as I am aware the Lumina pad does not require any special drivers. For confirmation / specifics on this, though, you would have to contact the pad's manufacturer, Cedrus.
By minin72704 - 8/2/2015

It sounds a little complex. I have another question, that is, why the data were not recoeded, could you help me check my syntax in scripts ?(please see attatchment for all files needed) Thank you.
By Dave - 8/3/2015

As far as I can tell the data is recorded exactly as specified in your <data> and <summarydata> elements. Please specify what exactly you mean by "data were not recorded". Note: If you are using an expired trial copy of Inquisit Lab, then yes, no data will be recorded when running through the scripts manually.
By minin72704 - 8/3/2015

Hi, Dave,
    I finnally design to use current design-8 Button Bimanual Straight Lines as response devices. Reading through the manual from page 116 to 122, it seems that I have to add / inputdevice = keyboard in <defaults> and modifies some values in scripts. Are these values of keyboard for curent design in Inquisit identical to that settings in E-prime (left hand:1234, right hand:6789)? If yes, then, does it suggest that i can preset valid responses in CCT_hot for "take card" to "6" and for "stop" to "7" to correspond to left button and right button of mouse, respectively? Likewise, can i preset valid reponses in CCT_cold for numbers 0~3 and 4~6 to corresponding to  "left hand:1234" and "right hand:678", respectively?
By Dave - 8/3/2015

I don't know which scancodes the Lumina box sends when used as a quasi-keyboard. I would assume they are identical to what's in the documentation. However, you should be able to confirm or disconfirm this easily (and figure out the respective scancodes) via Tools -> Keyboard Scancodes...
By minin72704 - 8/4/2015

I set following syntax and attempt to refer "0","1","2","3","4","5","6" respectively to numbers 0~6 (rating design) in CCT_cold. However, when I press 1 on keyboard, it record "2" in data. In addition, no response is recorded when i press 0 on keyboard.

/ validresponse = ("0","1","2","3","4","5","6")

/ correctresponse = ("")

/ inputdevice = keyboard
By minin72704 - 8/4/2015

Now, my main concerns are how to convert default setting of mouse in CCT task to correspond to keyboard, and then advanced to set response keys correctly for functioning devices of current design. Actually, I have no idea about these settings, could you give me more examples? Thank you.  
By Dave - 8/4/2015

> "However, when I press 1 on keyboard, it record "2" in data."

This is expected. The keyboard scancode for the key labeled "1" is 2. You can confirm this for yourself via Tools -> Keyboard Scancodes... The scancode is what Inquisit records in the response column in keys of keyboard responses.

Again, use the Keyboard Scancode tool to retrieve the specific scancodes the Lumina box returns for each of its various keys. Then, ideally, specify those scancodes in your /validresponse etc. attributes instead of "literal" key values. For example, the keyboard scancode for the "A" key on your keyboard is 30. So instead of defining

<trial sometrial>
/ inputdevice = keyboard
/ validresponse = ("A")
...
</trial>

define
<trial sometrial>
/ inputdevice = keyboard
/ validresponse = (30)
...
</trial>

The scancode is also what the response property returns. I.e. any logic in /ontrialbegin, /ontrialend, /branch, /isvalidresponse, etc. that makes use of the response property ought to use the scancode.

<trial sometrial>
/ inputdevice = keyboard
/ isvalidresponse = [trial.sometrial.response=="30"]
...
</trial>
By minin72704 - 8/4/2015

I followed your suggestion and set 0 to scancode 11 (/ validresponse = (11)), and 2 to 6 respectively to 1 to 5 as indicated in tools->keyboard scancodes. However, it doesn't work as well (please see attatchments). 
By Dave - 8/4/2015

<trial pickcard1>

/ stimulusframes = [1=roundinfo1, debuginfo,
    CR1C1_cold, CR1C2_cold, CR1C3_cold, CR1C4_cold, CR1C5_cold, CR1C6_cold,
    00,01,02,03,04,05,06]

/ validresponse = (11,2,3,4,5,6,7)

/ isvalidresponse = [trial.pickcard1.response=="11"]

/ isvalidresponse = [trial.pickcard1.response=="2"]

/ isvalidresponse = [trial.pickcard1.response=="3"]

/ isvalidresponse = [trial.pickcard1.response=="4"]

/ isvalidresponse = [trial.pickcard1.response=="5"]

/ isvalidresponse = [trial.pickcard1.response=="6"]

/ isvalidresponse = [trial.pickcard1.response=="7"]


/ inputdevice = keyboard

/ ontrialend = [if(startswith(trial.pickcard1.response,"0"))values.ncards1=substring(trial.pickcard1.response,1,1)
    else values.ncards1=trial.pickcard1.response]

/ branch = [if(values.gameround1=="8")trial.mean]
/ ontrialend = [values.totalscore1+=values.score1]

/ responsemessage = (00, number00, 1)
/ responsemessage = (01, number01, 1)
/ responsemessage = (02, number02, 1)
/ responsemessage = (03, number03, 1)
/ responsemessage = (04, number04, 1)
/ responsemessage = (05, number05, 1)
/ responsemessage = (06, number06, 1)

/ timeout = 10000
/ posttrialpause = trial.pickcard1.timeout-trial.pickcard1.elapsedtime
</trial>

All those /isvalidresponse attributes are unnecessary. All the /responsemessage attributes are wrong. It is no longer possible for a response to be 01, 02, etc. You need to adapt those. This is what the trial should look like:

<trial pickcard1>

/ stimulusframes = [1=roundinfo1, debuginfo,
    CR1C1_cold, CR1C2_cold, CR1C3_cold, CR1C4_cold, CR1C5_cold, CR1C6_cold,
    00,01,02,03,04,05,06]

/ validresponse = (11,2,3,4,5,6,7)

/ inputdevice = keyboard

/ ontrialend = [if(startswith(trial.pickcard1.response,"0"))values.ncards1=substring(trial.pickcard1.response,1,1)
    else values.ncards1=trial.pickcard1.response]

/ branch = [if(values.gameround1=="8")trial.mean]
/ ontrialend = [values.totalscore1+=values.score1]

/ responsemessage = (11, number00, 1)
/ responsemessage = (2, number01, 1)
/ responsemessage = (3, number02, 1)
/ responsemessage = (4, number03, 1)
/ responsemessage = (5, number04, 1)
/ responsemessage = (6, number05, 1)
/ responsemessage = (7, number06, 1)
/ timeout = 10000
/ posttrialpause = trial.pickcard1.timeout-trial.pickcard1.elapsedtime
</trial>
By minin72704 - 8/4/2015

After I modified those you mentioned and rerun the script, the problem ramianed existed. Specifically, I expected that red rectangle of 0~6 presented if participants press corresponding keys (e.g. press 0 on my keyboard the red rectangle will present with number 0 at exact position).
By Dave - 8/4/2015

That is exactly what the code does when you press the keys with the corresponding scancodes. The scancodes are those for the number keys *at the top of your keyboard*, they are *not* the ones for your keyboard's numpad. The numpad keys have different scancodes.
By minin72704 - 8/4/2015

Yes, I press the number keys at the top of my keyboard rather than the numpad throughout my every tests.
at the top of your keyboard
at the top of your keyboard
at the top of your keyboard
By minin72704 - 8/4/2015




I want participants to confirm their responses. If they press 1 but eventually see 2 on the screen they will feel confused.
By Dave - 8/4/2015

Double-check you're code. You have an error in there somewhere. Again, the code is:

<trial pickcard1>

/ stimulusframes = [1=roundinfo1, debuginfo,
    CR1C1_cold, CR1C2_cold, CR1C3_cold, CR1C4_cold, CR1C5_cold, CR1C6_cold,
    00,01,02,03,04,05,06]

/ validresponse = (11,2,3,4,5,6,7)

/ inputdevice = keyboard

/ ontrialend = [if(startswith(trial.pickcard1.response,"0"))values.ncards1=substring(trial.pickcard1.response,1,1)
    else values.ncards1=trial.pickcard1.response]

/ branch = [if(values.gameround1=="8")trial.mean]
/ ontrialend = [values.totalscore1+=values.score1]

/ responsemessage = (11, number00, 1)
/ responsemessage = (2, number01, 1)
/ responsemessage = (3, number02, 1)
/ responsemessage = (4, number03, 1)
/ responsemessage = (5, number04, 1)
/ responsemessage = (6, number05, 1)
/ responsemessage = (7, number06, 1)
/ timeout = 10000
/ posttrialpause = trial.pickcard1.timeout-trial.pickcard1.elapsedtime
</trial>

Pressing the "1" key will highlight "1" on-screen. Pressing "2" will highlight the "2" box on-screen, etc. I have confirmed this multiple times.
By minin72704 - 8/4/2015

I check between yours and mine more than twenty times, but I really can't find out the differences and locate problmes. Could you please help me check syntax in files, because I have already spend more than one and half day to check it and try to figure out solutions. Thank you so much.
By minin72704 - 8/4/2015

I followed your suggestions to modify codes in CCT_hot,  but it doesn't work as well. Codes are as follows (31 referred to button while 31 to button1):

<trial pickcard>
/ ontrialbegin = [if(values.ncards==0)values.button=1 else values.button=2]

/ ontrialbegin = [if(values.ncards<values.nsafecards)values.cardtype=2 else values.cardtype=3]

/ stimulusframes = [1=roundinfo, button, buttontxt, button1, buttontxt1, debuginfo,
    CR1C1, CR1C2, CR1C3, CR1C4, CR1C5, CR1C6]


/ validresponse = (31,30)

/ ontrialend = [values.responsestorage=concat(values.responsestorage,trial.pickcard.response)]

/ ontrialend = [if(trial.pickcard.response=="30")values.randomcard=list.randomcard.nextvalue]

/ ontrialend = [
    if(values.randomcard=="CR1C1"){values.CR1C1=values.cardtype; values.ncards+=1};
    if(values.randomcard=="CR1C2"){values.CR1C2=values.cardtype; values.ncards+=1};
    if(values.randomcard=="CR1C3"){values.CR1C3=values.cardtype; values.ncards+=1};
    if(values.randomcard=="CR1C4"){values.CR1C4=values.cardtype; values.ncards+=1};
    if(values.randomcard=="CR1C5"){values.CR1C5=values.cardtype; values.ncards+=1};
    if(values.randomcard=="CR1C6"){values.CR1C6=values.cardtype; values.ncards+=1};
    ]


/ ontrialend = [if(trial.pickcard.response!="31" && values.cardtype==3)
    values.score-=values.score]
/ ontrialend = [if(trial.pickcard.response=="30" && values.cardtype==2)
    values.score+=values.gainamount]

/ ontrialend = [if(values.ncards<=values.nsafecards)values.openlosscards=0]
/ ontrialend = [if(trial.pickcard.response!="31" && values.cardtype==3)
    values.openlosscards=1]
/ ontrialend = [if(trial.pickcard.response!="30" && values.cardtype==3)
    values.openlosscards=1]


/ responsemessage = (31, button_on, 1)
/ responsemessage = (31, buttontxt, 1)
/ responsemessage = (30, button_on1, 1)
/ responsemessage = (30, buttontxt1, 1)

/ branch = [if(trial.pickcard.response=="31" || trial.pickcard.response == "0")trial.prepturnover]
/ branch = [if(values.openlosscards==1 && values.losscards==1)trial.turnover]
/ branch = [if(values.openlosscards==1 && values.losscards!=1)trial.prepturnover]
/ branch = [trial.pickcard]
/ timeout= 10000

</trial>
By minin72704 - 8/5/2015

I resolve the problems in CCT_cold, it resulted from setting of path.
By minin72704 - 8/5/2015

I resolved problems in CCT_hot, it resulted from the setting of path as well. Thanks for your help.
By Dave - 8/5/2015

Apologies for the delayed response. Great to hear you were able to resolve the remaining issues.
By minin72704 - 8/9/2015

Hi, Dave,
    If i would like to give some feedbacks automatically (e.g. you can take more, that is fine!) (feedbacks are presented in form of pictures) after participants pressing "take card" button each time in CCT_hot. How could i do it?


By Dave - 8/9/2015

Set up a new <picture> element in the script that has the feedback images. Display it e.g. via the trial's /responsemessage.
By minin72704 - 8/9/2015

Hi, Dave,
    I did it before i posting. However, it didn't work. The settings you mentioned seemed to conflict with my original settings (see attach,emt for details). Beacause I want participants to receive feedback after pressing 6 (scancode is 7), but 6 is already assigned to the other button in /responsemessage. I would like participants to receive one of three kinds of feedbacks after pressing take card buttom each time in CCT_hot without  countering loss cards. 
By minin72704 - 8/9/2015

attachment is below
Hi, Dave,
    I did it before i posting. However, it didn't work. The settings you mentioned seemed to conflict with my original settings (see attach,emt for details). Beacause I want participants to receive feedback after pressing 6 (scancode is 7), but 6 is already assigned to the other button in /responsemessage. I would like participants to receive one of three kinds of feedbacks after pressing take card buttom each time in CCT_hot without  countering loss cards. 
                                - See more at: http://www.millisecond.com/forums/Topic16800.aspx?PageIndex=4&Update=1#bm16892
Hi, Dave,
    I did it before i posting. However, it didn't work. The settings you mentioned seemed to conflict with my original settings (see attach,emt for details). Beacause I want participants to receive feedback after pressing 6 (scancode is 7), but 6 is already assigned to the other button in /responsemessage. I would like participants to receive one of three kinds of feedbacks after pressing take card buttom each time in CCT_hot without  countering loss cards. 
                                - See more at: http://www.millisecond.com/forums/Topic16800.aspx?PageIndex=4&Update=1#bm16892
By minin72704 - 8/9/2015

I resolved above mentioned problems. However, the feedbacks always presented before cards being turned over. How could i reverse it (feedback alway presented after cards being turned over)?
By minin72704 - 8/9/2015

Moreover, there was always the same feedback presented. How can i make three kinds of feedbacks present alternately? for example, A feedback presents after 1st press, B feedback presents after 2nd press, etc.
By Dave - 8/9/2015

#1: You can have multiple /responsemessage attributes tied to the same response.
#2: You present different feedback images just like you always do: Have multiple items in the <picture> element and select them sequentially or via a variable (a <values> entry):

<picture peerfeedback>
/ items = ("peerfeedback.jpg", "perfeedback2.jpg", "perfeedback3.jpg")
/ hposition = 50%
/ vposition = 50%
/ select = sequence
</picture>

or, more flexibly,


<picture peerfeedback>
/ items = ("peerfeedback.jpg", "perfeedback2.jpg", "perfeedback3.jpg")
/ hposition = 50%
/ vposition = 50%
/ select = values.feedbackitem
</picture>

where you set the feedbackitem value via conditional logic as needed.

#3: If you want to display the feedback after turn-over, you need to display it via the <trial>'s /stimulustimes *before* displaying the cards or via a dedicated feedback <trial> invoked via /branch.
By minin72704 - 8/9/2015

Thanks for your instruction. I hae another problem, that is, I set timeout to 10s in <trial pickcard1> in CCT_cold, but it is lasting 20s. Could you help me point out what is the problem in my script? Thank you.
By Dave - 8/9/2015

If you want the trial to have a fixed duration, do
<trial pickcard1>

/ stimulusframes = [1=roundinfo1, debuginfo,
    CR1C1_cold, CR1C2_cold, CR1C3_cold, CR1C4_cold, CR1C5_cold, CR1C6_cold,
    00,01,02,03,04,05,06]

/ validresponse = (2,3,4,5,7,8,9)

/ ontrialend = [if(startswith(trial.pickcard1.response,"0"))values.ncards1=substring(trial.pickcard1.response,1,1)
    else values.ncards1=trial.pickcard1.response]

/ branch = [if(values.gameround1=="8")trial.mean]
/ ontrialend = [values.totalscore1+=values.score1]

/ responsemessage = (2, number00, 1)
/ responsemessage = (3, number01, 1)
/ responsemessage = (4, number02, 1)
/ responsemessage = (5, number03, 1)
/ responsemessage = (7, number04, 1)
/ responsemessage = (8, number05, 1)
/ responsemessage = (9, number06, 1)
/ trialduration= 10000
</trial>

instead of

<trial pickcard1>

/ stimulusframes = [1=roundinfo1, debuginfo,
    CR1C1_cold, CR1C2_cold, CR1C3_cold, CR1C4_cold, CR1C5_cold, CR1C6_cold,
    00,01,02,03,04,05,06]

/ validresponse = (2,3,4,5,7,8,9)

/ ontrialend = [if(startswith(trial.pickcard1.response,"0"))values.ncards1=substring(trial.pickcard1.response,1,1)
    else values.ncards1=trial.pickcard1.response]

/ branch = [if(values.gameround1=="8")trial.mean]
/ ontrialend = [values.totalscore1+=values.score1]

/ responsemessage = (2, number00, 1)
/ responsemessage = (3, number01, 1)
/ responsemessage = (4, number02, 1)
/ responsemessage = (5, number03, 1)
/ responsemessage = (7, number04, 1)
/ responsemessage = (8, number05, 1)
/ responsemessage = (9, number06, 1)
/ timeout = 10000
/ posttrialpause = trial.pickcard1.timeout-trial.pickcard1.elapsedtime

</trial>

Your getcondition trial has also has a fixed duration of 10s:

<trial getcondition1>
/ ontrialbegin = [values.trialtype1=list.trialtype1.nextvalue; values.score1=0;
    values.gameround1+=1; values.ncards1=0;
    reset(list.cardnumber1)]
/ ontrialbegin = [if(values.trialtype1==1)values.losscards1=list.losscards1.nextvalue
    else values.losscards1=noreplace(1)]
/ ontrialbegin = [if(values.trialtype1==1)values.gainamount1=list.gainamount1.nextvalue
    else values.gainamount1=noreplace(12)]
/ ontrialbegin = [if(values.trialtype1==1)values.lossamount1=list.lossamount1.nextvalue
    else values.lossamount1=noreplace(250,750)]
/ ontrialbegin = [if(values.trialtype1==1)values.score1=40]
/ ontrialbegin = [if(values.trialtype1==1)values.nsafecards1=6-values.losscards1]
/ stimulusframes = [1=BlankScreen, roundinfo1]

/ validresponse = (noresponse)
/ trialduration = 10000
/ recorddata = false
/ branch = [trial.pickcard1]
/ showmousecursor = false
</trial>

That adds up to 20 seconds per round.
By minin72704 - 8/10/2015

Thanks for your help. In addition, I have another question about BARTY (Youth Balloon Analogue Risk Task). My question is I would like to change trials to 12 rather than 30, so I revise <values> totalballoons to 12, but the program closed after 1 trial (please see attachment).  
By Dave - 8/10/2015

The script works as expected for me. A partial data file is attached. As you can see by looking at the values.ballooncount column, it does not stop after the 1st "trial" (i.e. balloon).
By Dave - 8/10/2015

I should add that there *is* one condition that will lead to the script terminating *prior* to completing 12 balloons. This is due to a flaw in your programming logic. You've set a fixed /trialduration in <trial choice>. This of course means that a participant can opt to *not respond* at all -- the trial will terminate after 15 seconds anyway. Your /branch attributes, however, don't cover that case. I.e., the script has nowhere to go from there and will terminate (that's what you instructed it to do, intentionally or not).

<trial choice>
/ ontrialbegin = [values.countchoice += 1]


/ stimulustimes = [0=balloon, rewardmeter,rewardmeter_fill, smallprize, middleprize, bigprize, bonus, fillmeter, pumpballoon, pumpcount, countballoon]
/ validresponse = (8, 7)
/responsemessage = (8,fillmeter_chosen, 200)
/responsemessage = (7, pumpballoon_selected, 200)

/ ontrialend = [if (trial.choice.response == "7" && values.countchoice == 1)
                        values.timebefore1stpump = trial.choice.latency ]
/ ontrialend = [if (trial.choice.response == "7"  && values.countchoice > 1)
                        {values.timebtwpumps = trial.choice.latency;
                        values.sum_timebtwpumps += values.timebtwpumps }]
/ ontrialend = [if (trial.choice.response == "8" && values.countchoice == 1)
                        values.timebeforecollectwithoutpump =  trial.choice.latency ]
/ ontrialend = [if (trial.choice.response == "8" && values.countchoice > 1)
                        values.timebtwlastpumpandcollect =  trial.choice.latency ]

/ ontrialend = [if (trial.choice.response == "7") picture.balloon.width += values.balloonsizeincrement]
/ ontrialend = [if (trial.choice.response == "7")picture.balloon.height += values.balloonsizeincrement]
/ ontrialend = [if (trial.choice.response == "7")shape.blank.width = picture.balloon.width]
/ ontrialend = [if (trial.choice.response == "7")shape.blank.height = picture.balloon.height]
/ ontrialend = [if (trial.choice.response == "7")values.pumpcount += 1]

/ ontrialend = [if (trial.choice.response == "7")values.totalpumpcount += 1]
/ ontrialend = [if (trial.choice.response == "7" && values.ballooncount < 11) values.totalpumpcount_10 += 1]
/ ontrialend = [if (trial.choice.response == "7" && values.ballooncount > 10 && values.ballooncount <21 ) values.totalpumpcount_20 += 1]
/ ontrialend = [if (trial.choice.response == "7" && values.ballooncount > 20 && values.ballooncount <31 ) values.totalpumpcount_30 += 1]

/ ontrialend = [if (trial.choice.response == "7" && values.pumpcount >1) values.mean_timebtwpumps = values.sum_timebtwpumps / (values.pumpcount-1) ]

/ ontrialend = [trial.choice.resetstimulusframes()]
 
/ branch = [if (values.pumpcount == values.explosionpoint && trial.choice.response == "7") trial.pop]
/ branch = [if ( trial.choice.response == "7") {trial.choice}]
/ branch = [if ( trial.choice.response == "8") trial.collect]
/ trialduration = 15000



</trial>

So, you ought to specify the *no response* case. Where do you want the script to go from there? To trial.collect? Then do

<trial choice>
...
/ branch = [if (values.pumpcount == values.explosionpoint && trial.choice.response == "7") trial.pop]
/ branch = [if ( trial.choice.response == "7") {trial.choice}]
/ branch = [if ( trial.choice.response == "8" || trial.choice.response == "0") trial.collect]
/ trialduration = 15000


</trial>

If you want it to do something else, specify that accordingly instead.
By minin72704 - 8/10/2015

It seems resulting in 15s wait after each press (pumpballoon). If i want that participants can press any times they want to within fixed 15s duration (for a balloon) before they press "collect" or balloon explored. How can I do it?
By Dave - 8/10/2015

> It seems resulting in 15s wait after each press (pumpballoon).

Yes. That's what you instructed the script to do.

> If i want that participants can press any times they want to within fixed 15s duration (for a balloon) before they press "collect" or
> balloon explored. How can I do it?

Create a new <values> entry. Set it to 15000 in <trial init>. Use it in <trial choice>'s /timeout attribute. At the end of <trial choice> subtract the trial's latency from it.
By minin72704 - 8/10/2015

I set choicetimeout=15000 in <values> and set it (values.choicetimeout) in <trial.init>'s /timeout attribute then subtract the trial's latency from it at the end of <trial choice> (/ timeout = values.choicetimeout-trial.choice.latency). But, it still didn't work (please see attachment).
By minin72704 - 8/10/2015

This is above mentioned attachment.
By Dave - 8/10/2015

> then subtract the trial's latency from it at the end of <trial choice> (/ timeout = values.choicetimeout-trial.choice.latency)

This is wrong.

You'll want

/timeout = values.choicetimeout
and
/ontrialend = [values.choicetimeout-=trial.choice.latency]

Also, you do *not* set values.choicetimeout to 15000 *in <trial init>* as I said you ought to do. You need to fix that.

Finally, I don't see how that /branch makes sense:

/ branch = [if ( trial.choice.response == "7" && trial.choice.sumlatency==trial.choice.timeout) trial.collect]
By minin72704 - 8/10/2015

I add two conditions:
1. / branch = [if ( values.pumpcount == values.explosionpoint && trial.choice.response == "7" ) values.choicetimeout-=trial.choice.latency]  ==> It is intended to set remaining wait after pop resulted from pressing too many times, and next trial will begin after 15s duration reaching.
 
2. / branch = [if ( trial.choice.response == "8" ) values.choicetimeout-=trial.choice.latency] ==> It is intended to set wait for voluntarily stop pumping.

However, both of them seem didn't work.


By Dave - 8/10/2015

Both don't make sense. You don't need new branches and you definitely don't need them in <trial choice>. If a balloon pops, the relevant <trial> is <trial pop>. That's where your <trial> choice branches to anyway. The /timeout in <trial pop> needs to be the remainder.

Same thing for a voluntary collect. <trial choice> branches to <trial collect> anyway. You need to modify <trial collect> to wait for the remaining time.
By minin72704 - 8/10/2015

Fistly, in your last attachment, the trials didn't terminate at 15s but at more than 20s. Second, I don't understand your instructions about my last two qestions, could you give me more elaborative examples? Thank you.
By Dave - 8/10/2015

If you want to have either <trial pop> or <trial collect> last for whatever remains of the allotted 15000 ms, you simply do:

<trial pop>
...
/ trialduration = values.choicetimeout
</trial>

<trial collect>
...
/trialduration = values.choicetimeout
</trial>
By minin72704 - 8/10/2015

Thnaks for your illustration. However, your second script works while the first one doesn't. Moreover, trials also didn't terminate within 15s after several presses.
trials didn't terminate at 15s but at more than 20s - See more at: http://www.millisecond.com/forums/Topic16800.aspx?PageIndex=6&Update=1#sthash.SpTRdhDM.dpuf
By Dave - 8/10/2015

Both work just fine. As for the timing: See attached.

Note: Giving participants a total of 15 seconds to make responses and having an entire *round* last approx. 15 seconds are *two different things*. Your wording and previous code snippets suggest you want the former, while you actually seem to want the latter. Such differences matter, please communicate them clearly.
By minin72704 - 8/10/2015

Thanks for your help. It looks great.
By minin72704 - 8/10/2015

It may be the last two questions (i hope so). First one, revised BARTY.iqx works well, however, it seems exceeding 2s than expect. Specifically, I expected the totoal time is 3mins 16s (1s fixation+10s instruction+15s*12 balloon+5s feedback).

The second question is about cued go no go task (see attachment). I want that each trial was exact 4s (from <trial cue> to <trial target> to <trial iti>), so i add "/ posttrialpause = 3300-trial.target.elapsedtime-trial.cue.trialduration" in <trial.target>. However, it resulted in 8s more than expect, and the colored rectangle didn't disapear immediately after my response (in fact, I want it disapeared immediately after my response then wait for a while until next fixation appeared, just as default setting). Could you help me figure out how to resolve it? Thank you so much.
By Dave - 8/11/2015

> It may be the last two questions (i hope so). First one, revised BARTY.iqx works well, however, it seems exceeding 2s than
> expect. Specifically, I expected the totoal time is 3mins 16s (1s fixation+10s instruction+15s*12 balloon+5s feedback).

Well, there's other stuff going on that you cannot control. Sometimes Inquisit will have to wait for the start of a display frame in order to start drawing stuff to the screen, etc. This can add up over the course of the entire task and there's nothing you can do about it.

As for the Cued Go/-No Go: Your math is wrong.

<trial cue> lasts 1300 ms plus a variable soa (see list.soa). <trial iti> lasts 700 ms as per values.iti. That alone gives you 2000ms + soa. If the end result is supposed to be approx. 4000ms for each (cue-target-iti) tuple of trials, the /trialduration of <trial target> should be set to 2000 ms - soa. I have no idea where you get the 3300 ms /posttrialpause figure from. It also seems that there's some confusion left regarding the various timing components of a <trial> and how they interrelate. I strongly recommend reading the "How to Control Trial Duration and Inter-Trial Intervals" topic in the documentation, which explains all of that.
By minin72704 - 8/11/2015

Thanks for your help.
By minin72704 - 8/12/2015

Hi, Dave,
    I really confused about the time control. I set a trial's timeout=9000 and / posttrialpause = trial.5losseva_self.timeout-trial.5losseva_self.elapsedtime (see the attachment). If the elapsedtime is 4s, the trial should pause 5s to the next trial. But it terminate 9s latter after my response, e.g. i response at 4s, it terminate at 13s. I know it works by setting trialduration to 9s, but it will make participants fail to confirm their response while they press the corresponding keys. How can it let it terminate at 9s whatever when participants make their responses within that trial?
By Dave - 8/12/2015

> I know it works by setting trialduration to 9s

Then please use /trialduration. That's exactly the scenario it is intended for.

> but it will make participants fail to confirm their response while they press the corresponding keys

I'm not sure what that's supposed to mean. It literally makes no difference. With /trialduration specified, the trial goes into a posttrialpause for the remainder of the specified duration.

> How can it let it terminate at 9s whatever when participants make their responses within that trial?

Use /trialduration.
By minin72704 - 8/13/2015

I finally found that the trial duration of CCT_hot within a round was more than 10s. Actually, i want one round terminate exactly at 10s whatever how many times participants press the button within that period (e.g. In round 1, participant made two presses, first press was at 3s, second at 6s, and i want it to terminate at 10s rather than 16s). Present syntax leads 10s timeout to recalculate after each press within one round (please see attchment). Could you help me to resolve it? Thank you.
By minin72704 - 8/13/2015

I finally found that the trial duration of CCT_hotwithin a round was more than 10s after I pressing more than once. Actually, i want one round terminate exactlyat 10s whatever how many times participants pressedwithin per round (e.g. In round 1, participant made two presses, first press was at 3s, secondat 6s, and i want it to terminate at 10s rather than 16s). Present syntax leads10s timeout to recalculate after each press within one round (please seeattchment). Could you help me resolve it? Thank you.

 

I finally found that the trial duration of CCT_hot within a round was more than 10s. Actually, i want one round terminate exactly at 10s whatever how many times participants press the button within that period (e.g. In round 1, participant made two presses, first press was at 3s, second at 6s, and i want it to terminate at 10s rather than 16s). Present syntax leads 10s timeout to recalculate after each press within one round (please see attchment). Could you help me to resolve it? Thank you. - See more at: http://www.millisecond.com/forums/Topic16800-7.aspx#sthash.zTWGB0iu.dpuf
By Dave - 8/13/2015

You do it in the same way as with the BARTY, which we discussed in this thread.
By minin72704 - 8/13/2015

I add / branch = [if (trial.pickcard.sumlatency==trial.pickcard.timeout) trial.turnover] in <trial pickcard>, but it was not what I intended.
By minin72704 - 8/13/2015

I revised the script as you mentioned in former post (please see the attachment). However, it only works on the first hot round, the rest of hot trials automatically and immediately terminated before i pressing the button.
By Dave - 8/13/2015

Just as with the BARTY, you ought to set the timeout variable to 10 seconds at the beginning of each round.

<trial getcondition>
/ ontrialbegin = [values.pickcardtimeout=10000; ]
...
</trial>
By minin72704 - 8/13/2015

Thanks Dave,  I love you.
By Dave - 8/13/2015

Thanks :)

You just made my day!
By minin72704 - 8/13/2015

There is another problem. I found a discrepancy between two scores in CCT_hot. Specifically, sometime the score in pick card stage was consistent with that in feedback stage (e.g. 88 points in pick card stage and reveal the same score in latter feedback stage). However, sometimes these two scores were not identical (e.g. i got 100 points in pickcard stage but it revealed 0 points in latter stage).
By minin72704 - 8/13/2015

It appears to happening only when i press pick card button and then do nothing resulted in trial terminated automatically. Moreover, I alos found that when I press "stop" button the trial terminated immediately before 10s' timeout.
By Dave - 8/13/2015

Re. the scoring: Work through the code that is responsible for that and double-check it. You need to decide what you want to do when no response occurs and adjust accordingly.

Re. the timeout: Again, just as with the BARTY, you ought to instruct the turnover trial to last for whatever remains of the 10s timeout. As with the BARTY, you do that via the /trialduration.
By minin72704 - 8/14/2015

I resulved part of problems, however, I still can't figure out how to deal with the problem of 0 scoring.
By Dave - 8/14/2015

Look at

<trial pickcard>
...
/ ontrialend = [if(trial.pickcard.response!="8" && values.cardtype==3)
    values.score-=values.score]
/ ontrialend = [if(trial.pickcard.response=="7" && values.cardtype==2)
    values.score+=values.gainamount]
...
</trial>

That's where the score is manipulated depending on *response* and the type of scheduled *card* (loss or gain).

"!=" is a logical NOT. Thus,

/ ontrialend = [if(trial.pickcard.response!="8" && values.cardtype==3)
    values.score-=values.score]

means "if the response is not a press on the key with scan code 8 AND the scheduled card is a loss card" subtract stuff. Now, which responses in your case are "not 8"? It's 7 and 0 (no response).

Similarly, there are other pieces of logic where you *don't* take into account the "no response" case:

/ ontrialend = [if(trial.pickcard.response!="8" && values.cardtype==3)
    values.openlosscards=1]
/ ontrialend = [if(trial.pickcard.response!="7" && values.cardtype==3)
    values.openlosscards=1]

Work through that logic, think through what exactly happens in each case and then modify it according to your needs, i.e., take the "no response" case into account.
By minin72704 - 8/14/2015

It is weired that it only happened when I turn over the last safe card. For example, if there were 3 loss cards in a round, the points feedback was correct when I pressed 1 or 2 times, but 0 scoring appeared  after I press 3times and stop pressing (do nothing and wait for timeout).
By minin72704 - 8/14/2015

Could you help me modify it, because I have to implement it a few hours latter. Thank you so much.
By Dave - 8/14/2015

> For example, if there were 3 loss cards in a round, the points feedback was correct when I pressed 1 or 2 times
> but 0 scoring appeared  after I press 3times and stop pressing (do nothing and wait for timeout).

This is *precisely* what I pointed out in my previous reply. Again, look at:

/ ontrialend = [if(trial.pickcard.response!="8" && values.cardtype==3)
    values.score-=values.score]                               

You've opened 3 "safe cards" and are now in the 4th instance of <trial pickcard>. Only 3 loss cards remain, i.e. values.cardtype at this point *is* 3 as in

/ ontrialend = [if(trial.pickcard.response!="8" && values.cardtype==3)
    values.score-=values.score]                               

You do *not* respond in this trial. Hence, trial.pickcard.response *is* 0. Obviously, 0 is *not* equal to 8 as in

/ ontrialend = [if(trial.pickcard.response!="8" && values.cardtype==3)
    values.score-=values.score]                               

It should now be obvious that the entire condition

/ ontrialend = [if(trial.pickcard.response!="8" && values.cardtype==3)
    values.score-=values.score]                               

is met and the score is zeroed as instructed. In your particular case, if you *don't* want this to happen, change the logic to

/ ontrialend = [if(trial.pickcard.response=="7" && values.cardtype==3)
    values.score-=values.score]                               

Work through the rest of the logic accordingly.
By minin72704 - 8/14/2015

Thanks Dave, you help me resolved all the (stupid) problems. I love you more than i can say.
By Dave - 8/14/2015

Thank you very much for the kind words and I wish you much success with your research project!