Delay blocks not running


Author
Message
sandy_d
sandy_d
Expert (1.3K reputation)Expert (1.3K reputation)Expert (1.3K reputation)Expert (1.3K reputation)Expert (1.3K reputation)Expert (1.3K reputation)Expert (1.3K reputation)Expert (1.3K reputation)Expert (1.3K reputation)
Group: Forum Members
Posts: 13, Visits: 58
Hello,

I currently have the DDT so that it should run 8 delay blocks. but it seems that only 4 of the delay blocks actually run (that is, after the 4th delay is completed, the program will exist )

I was wondering if there was an error in the script that I didn't catch that would account for this.
I've attached the script thus far below.

Any help on this would be greatly appreciated!

Thank you!


<summarydata>
/columns = (script.startdate, script.starttime, script.subjectid, script.groupid, script.elapsedtime, computer.platform, values.completed, parameters.delayedreward,
values.ip_delay1_M, values.ip_delay2_M, values.ip_delay3_M, values.ip_delay4_M, values.ip_delay5_M, values.ip_delay6_M, values.ip_delay7_M, values.ip_delay8_M
values.ip_delay1_F, values.ip_delay2_F, values.ip_delay3_F, values.ip_delay4_F, values.ip_delay5_F, values.ip_delay6_F, values.ip_delay7_F, values.ip_delay8_F)
/ separatefiles = true
</summarydata>


*****************************************************************************************************************
*****************************************************************************************************************
    Values: updated automatically on runtime of script
*****************************************************************************************************************
*****************************************************************************************************************
/ completed:                        0 = script was not completed; 1 = script was completed (all conditions run)
/ immediatereward:                    stores the current reward for the immediate response
/ order:                            stores direction of current reward adjustment ("ascending" or "descending")
/ delay:                            stores the current temporal delay
/ object:                            stores the object option of the block (1-2: selected food options; 3 = money)
/ foodchoice:                        stores the selected food option
/ ip_found:                            helper variable to determine indifference point (ch

anges value if ip is found)
/ ip_asc:                            stores ip value for ascending blocks
/ ip_desc:                            stores ip value for descending blocks
/ ip:                                stores final ip value
/ blockcount:                        counts the blocks
/ trialcount:                        counts the trials
/ blocktype:                        stores the type of block "money" or "food"
/ previousresponse:                    stores the previous response
/ immediateresponsestreak:            counts the numbers of consecutive choices of immediate reward
/ delayedresponsestreak:            counts the numbers of consecutive choices of delayed reward

summary variables:
/ip_delay1_M-
/ip_delay8_F:                        the IPs for the 8 different delays for food (F) and money (M) blocks

<values>
/ completed = 0
/ immediatereward = 0.00
/ order = ""
/ delay = 0
/ object = 0
/ foodchoice = 0
/ ip_found = 0
/ ip_asc = 0.00
/ ip_desc = 0.00
/ ip = 0.00
/ blockcount = 0
/ trialcount = 0
/ blocktype = ""
/ previousresponse = ""
/ immediateresponsestreak = 0
/ delayedresponsestreak = 0

/ip_delay1_M = 0
/ip_delay2_M = 0
/ip_delay3_M = 0
/ip_delay4_M = 0
/ip_delay5_M = 0
/ip_delay6_M = 0
/ip_delay7_M = 0
/ip_delay8_M = 0

/ip_delay1_F = 0
/ip_delay2_F = 0
/ip_delay3_F = 0
/ip_delay4_F = 0
/ip_delay5_F = 0
/ip_delay6_F = 0
/ip_delay7_F = 0
/ip_delay8_F = 0
</values>

*****************************************************************************************************************
*****************************************************************************************************************
    Expressions
*****************************************************************************************************************
*****************************************************************************************************************
<expressions>
/ immediatereward = format("%.2f", values.immediatereward)
/ delayedreward = format("%.2f", parameters.delayedreward)
/ ip_asc = format("%.2f", values.ip_asc)
/ ip_desc = format("%.2f", values.ip_desc)
/ ip = format("%.2f", values.ip)
/ objectdescription = getitem(item.objectdescriptions, values.object)
</expressions>

*****************************************************************************************************************
*****************************************************************************************************************
    List Elements
*****************************************************************************************************************
*****************************************************************************************************************
    Delay Periods (8)
*****************************************************************************************************************
*****************************************************************************************************************
<list delays>
/ items = (parameters.delay1, parameters.delay2, parameters.delay3, parameters.delay4, parameters.delay5, parameters.delay6, parameters.delay7, parameters.delay8) 
/ selectionmode = sequence
/ selectionrate = block
/ resetinterval = 0
</list>

*****************************************************************************************************************
*****************************************************************************************************************
    Immediate Rewards (26 -- Descending Order)
*****************************************************************************************************************
*****************************************************************************************************************
<list immediaterewards_desc>
/ items = (10.00, 9.75, 9.50, 9.25, 9.00, 8.75, 8.50, 8.25, 8.00, 7.00, 6.75, 6.00, 6.25, 6.00, 5.75, 5.50, 5.25, 5.00, 4.75, 4.50, 4.25, 4.00, 3.75, 3.50, 3.25, 3.00)
/ selectionmode = sequence
/ selectionrate = trial
</list>

*****************************************************************************************************************
*****************************************************************************************************************
    Immediate Rewards (26 -- Ascending Order)
*****************************************************************************************************************
*****************************************************************************************************************
<list immediaterewards_asc>
/ items = (0.10, 0.25, 0.50, 0.75, 1.00, 1.50, 2.00, 2.50, 3.00, 3.50, 4.00, 4.50, 5.00,
    5.50, 6.00, 6.50, 7.00, 7.50, 8.00, 8.50, 9.00, 9.25, 9.50, 9.75, 9.90, 10.00)
/ selectionmode = sequence
/ selectionrate = trial
</list>

*****************************************************************************************************************
*****************************************************************************************************************
    Stimulus Elements
*****************************************************************************************************************
*****************************************************************************************************************
    For DDT Trial
*****************************************************************************************************************
*****************************************************************************************************************
<text question>
/ items = question
/ select = 1
/ erase = false
/ position = (50%, 50%)
</text>

<text or>
/ items = question
/select = 3
/ erase = false
/ position = (50%, 65%)
</text>

<text immediate>
/ items = question
/ select = 2
/ txbgcolor = grey
/ vjustify = center
/ size = (20%, 20%)
/ position = (30%, 65%)
</text>

<text delayed>
/ items = question
/ select = 4
/ txbgcolor = grey
/ vjustify = center
/ size = (20%, 20%)
/ position = (70%, 65%)
</text>

<picture objectpic>
/ items = objectpicitems
/ select = values.object
/ position = (50%, 25%)
/ erase = false
</picture>


**************************************************************************************************************
**************************************************************************************************************
    Debug Stuff
**************************************************************************************************************
**************************************************************************************************************
<text debug>
/ items = ("Block = <%values.blockcount%> | Blocktype = <%values.blocktype%> | Order = <%values.order%> | IP_Desc = <%expressions.ip_desc%> | IP_Asc = <%expressions.ip_asc%> | IP = <%expressions.ip%>
Delayedstreak = <%values.delayedresponsestreak%> | Immediatestreak = <%values.immediateresponsestreak%>")
/ fontstyle = ("Arial", 2.00%)
/ erase = false
/ position = (50%, 5%)
/ size = (90%, 5%)
</text>

*****************************************************************************************************************
*****************************************************************************************************************
    For Food Pick Trial
*****************************************************************************************************************
*****************************************************************************************************************
<text foodcaption>
/ items = foodcaptions
/ select = 1
/ position = (50%, 10%)
</text>

<picture foodapic>
/ items = foodpics
/ select = 1
/ position = (30%, 30%)
</picture>

<picture foodbpic>
/ items = foodpics
/ select = 2
/ position = (70%, 30%)
</picture>

<picture foodcpic>
/ items = foodpics
/ select = 3
/ position = (30%, 70%)
</picture>

<picture fooddpic>
/ items = foodpics
/ select = 4
/ position = (70%, 70%)
</picture>

<text foodatxt>
/ items = foodcaptions
/ select = 2
/ position = (30%, 50%)
</text>

<text foodbtxt>
/ items = foodcaptions
/ select = 3
/ position = (70%, 50%)
</text>

<text foodctxt>
/ items = foodcaptions
/ select = 4
/ position = (30%, 90%)
</text>

<text fooddtxt>
/ items = foodcaptions
/ select = 5
/ position = (70%, 90%)
</text>
**************************************************************************************************************
**************************************************************************************************************
    Trial Elements
**************************************************************************************************************
**************************************************************************************************************
    DDT Choice Trial
**************************************************************************************************************
**************************************************************************************************************
<trial discounttrial>
/ pretrialpause = parameters.pretrialdelay
/ posttrialpause = parameters.posttrialdelay
/ ontrialbegin = [values.trialcount+=1]
/ ontrialbegin = [if(values.trialcount==1)
    values.previousresponse="" else values.previousresponse=trial.discounttrial.response]
/ ontrialbegin = [if(values.order=="descending")
    values.immediatereward=list.immediaterewards_desc.nextvalue]
/ ontrialbegin = [if(values.order=="ascending")
    values.immediatereward=list.immediaterewards_asc.nextvalue]

/ stimulusframes = [1=objectpic, question, or, immediate, delayed]
/ validresponse = (immediate, delayed)

/ ontrialend = [if(values.previousresponse=="immediate" && trial.discounttrial.response=="immediate")
    values.immediateresponsestreak+=1 else
    values.immediateresponsestreak=0]
/ ontrialend = [if(values.previousresponse=="delayed" && trial.discounttrial.response=="delayed")
    values.delayedresponsestreak+=1 else
    values.delayedresponsestreak=0]
/ ontrialend = [if(values.order=="descending" && values.ip_found==0 && values.delayedresponsestreak==1){
    values.ip_desc=values.immediatereward; values.ip_found=1}]
/ ontrialend = [if(values.order=="ascending" && values.ip_found==0 && values.immediateresponsestreak==1){
    values.ip_asc=values.immediatereward; values.ip_found=1}]
</trial>

**************************************************************************************************************
**************************************************************************************************************
    Compute Indifference Point
**************************************************************************************************************
**************************************************************************************************************
<trial compute_ip>
/ ontrialbegin = [if(values.order=="descending" && values.ip_found==0)
    values.ip_desc=values.immediatereward]
/ ontrialbegin = [if(values.order=="ascending" && values.ip_found==0)
    values.ip_asc=parameters.delayedreward]
/ ontrialbegin = [if(values.ip_desc!=0.00 && values.ip_asc!=0.00)
    values.ip=(values.ip_desc+values.ip_asc)*0.5]

/ontrialbegin = [if (values.ip != 0 && values.blocktype == "money" && values.delay == parameters.delay1)
                    {values.ip_delay1_M = values.ip}]
/ontrialbegin = [if (values.ip != 0 && values.blocktype == "money" && values.delay == parameters.delay2)
                    {values.ip_delay2_M = values.ip}]
/ontrialbegin = [if (values.ip != 0 && values.blocktype == "money" && values.delay == parameters.delay3)
                    {values.ip_delay3_M = values.ip}]
/ontrialbegin = [if (values.ip != 0 && values.blocktype == "money" && values.delay == parameters.delay4)
                    {values.ip_delay4_M = values.ip}]
/ontrialbegin = [if (values.ip != 0 && values.blocktype == "money" && values.delay == parameters.delay5)
                    {values.ip_delay5_M = values.ip}]
/ontrialbegin = [if (values.ip != 0 && values.blocktype == "money" && values.delay == parameters.delay6)
                    {values.ip_delay6_M = values.ip}]
/ontrialbegin = [if (values.ip != 0 && values.blocktype == "money" && values.delay == parameters.delay7)
                    {values.ip_delay7_M = values.ip}]
/ontrialbegin = [if (values.ip != 0 && values.blocktype == "money" && values.delay == parameters.delay8)
                    {values.ip_delay8_M = values.ip}]


/ontrialbegin = [if (values.ip != 0 && values.blocktype == "food" && values.delay == parameters.delay1)
                    {values.ip_delay1_F = values.ip}]
/ontrialbegin = [if (values.ip != 0 && values.blocktype == "food" && values.delay == parameters.delay2)
                    {values.ip_delay2_F = values.ip}]
/ontrialbegin = [if (values.ip != 0 && values.blocktype == "food" && values.delay == parameters.delay3)
                    {values.ip_delay3_F = values.ip}]
/ontrialbegin = [if (values.ip != 0 && values.blocktype == "food" && values.delay == parameters.delay4)
                    {values.ip_delay4_F = values.ip}]
/ontrialbegin = [if (values.ip != 0 && values.blocktype == "food" && values.delay == parameters.delay5)
                    {values.ip_delay5_F = values.ip}]
/ontrialbegin = [if (values.ip != 0 && values.blocktype == "food" && values.delay == parameters.delay6)
                    {values.ip_delay6_F = values.ip}]
/ontrialbegin = [if (values.ip != 0 && values.blocktype == "food" && values.delay == parameters.delay7)
                    {values.ip_delay7_F = values.ip}]
/ontrialbegin = [if (values.ip != 0 && values.blocktype =="food"  && values.delay == parameters.delay8)
                    {values.ip_delay8_F = values.ip}]
                         
                   

/ validresponse = (noresponse)
/ trialduration = 0
</trial>

**************************************************************************************************************
**************************************************************************************************************
    Preferred Food Trial
**************************************************************************************************************
**************************************************************************************************************
<trial foodchoice>
/ stimulusframes = [1=foodcaption, foodapic, foodbpic, foodcpic, fooddpic, foodatxt, foodbtxt, foodctxt, fooddtxt]
/ validresponse = (foodapic, foodbpic, foodcpic, fooddpic)
/ ontrialend = [if(trial.foodchoice.response=="foodapic")values.foodchoice=1]
/ ontrialend = [if(trial.foodchoice.response=="foodbpic")values.foodchoice=2]
/ ontrialend = [if(trial.foodchoice.response=="foodcpic")values.foodchoice=3]
/ ontrialend = [if(trial.foodchoice.response=="fooddpic")values.foodchoice=4]
</trial>

**************************************************************************************************************
**************************************************************************************************************
    Block Elements
**************************************************************************************************************
**************************************************************************************************************
    Food Preference Block
**************************************************************************************************************
**************************************************************************************************************
<block foodchoice>
/ preinstructions = (foodintro)
/ postinstructions = (foodoutro)
/ trials = [1=foodchoice]
</block>

**************************************************************************************************************
**************************************************************************************************************
    DDT Blocks
**************************************************************************************************************
**************************************************************************************************************
    Money Discounting (Descending)
**************************************************************************************************************
**************************************************************************************************************
<block money_desc>
/ onblockbegin = [values.object=5; values.blocktype="money"; values.ip_found=0]
/ onblockbegin = [values.immediateresponsestreak=0; values.delayedresponsestreak=0]
/ onblockbegin = [values.previousresponse=""]
/ onblockbegin = [values.blockcount+=1; values.trialcount=0]
/ onblockbegin = [values.order="descending"; values.ip_desc=0.00; values.ip=0.00]
/ onblockbegin = [if(mod(values.blockcount,4)==1 || mod(values.blockcount,4)==3)
    values.ip_asc=0.00]
/ onblockbegin = [if(mod(values.blockcount,4)==1)
    values.delay=list.delays.nextvalue]
/ trials = [1-26=discounttrial; 27=compute_ip]
</block>

**************************************************************************************************************
**************************************************************************************************************
    Money Discounting (Ascending)
**************************************************************************************************************
**************************************************************************************************************
<block money_asc>
/ onblockbegin = [values.object=5; values.blocktype="money"; values.ip_found=0]
/ onblockbegin = [values.immediateresponsestreak=0; values.delayedresponsestreak=0]
/ onblockbegin = [values.previousresponse=""]
/ onblockbegin = [values.blockcount+=1; values.trialcount=0]
/ onblockbegin = [values.order="ascending"; values.ip_asc=0.00; values.ip=0.00]
/ onblockbegin = [if(mod(values.blockcount,8)==1 || mod(values.blockcount,4)==3)
    values.ip_desc=0.00]
/ onblockbegin = [if(mod(values.blockcount,8)==1)
    values.delay=list.delays.nextvalue]
/ trials = [1-26=discounttrial; 27=compute_ip]
</block>

**************************************************************************************************************
**************************************************************************************************************
    Food Discounting (Descending)
**************************************************************************************************************
**************************************************************************************************************
<block food_desc>
/ onblockbegin = [values.object=values.foodchoice; values.blocktype="food"; values.ip_found=0]
/ onblockbegin = [values.immediateresponsestreak=0; values.delayedresponsestreak=0]
/ onblockbegin = [values.previousresponse=""]
/ onblockbegin = [values.blockcount+=1; values.trialcount=0]
/ onblockbegin = [values.order="descending"; values.ip_desc=0.00; values.ip=0.00]
/ onblockbegin = [if(mod(values.blockcount,4)==1 || mod(values.blockcount,4)==3)
    values.ip_asc=0.00]
/ onblockbegin = [if(mod(values.blockcount,4)==1)
    values.delay=list.delays.nextvalue]
/ trials = [1-26=discounttrial; 27=compute_ip]
</block>

**************************************************************************************************************
**************************************************************************************************************
    Food Discounting (Ascending)
**************************************************************************************************************
**************************************************************************************************************
<block food_asc>
/ onblockbegin = [values.object=values.foodchoice; values.blocktype="food"; values.ip_found=0]
/ onblockbegin = [values.immediateresponsestreak=0; values.delayedresponsestreak=0]
/ onblockbegin = [values.previousresponse=""]
/ onblockbegin = [values.blockcount+=1; values.trialcount=0]
/ onblockbegin = [values.order="ascending"; values.ip_asc=0.00; values.ip=0.00]
/ onblockbegin = [if(mod(values.blockcount,4)==1 || mod(values.blockcount,4)==3)
    values.ip_desc=0.00]
/ onblockbegin = [if(mod(values.blockcount,4)==1)
    values.delay=list.delays.nextvalue]
/ trials = [1-26=discounttrial; 27=compute_ip]
</block>

**************************************************************************************************************
**************************************************************************************************************
    Expt Elements
**************************************************************************************************************
**************************************************************************************************************
    Order: Money(Descending), Money(Ascending), Food(Descending), Food(Ascending)
**************************************************************************************************************
**************************************************************************************************************
<expt>
/ preinstructions = (generalintro)
/ postinstructions = (generaloutro)
/ blocks = [1=foodchoice; 2-8=sequence( food_desc, food_asc)]
/ subjects = (1 of 4)
/ groupassignment = groupnumber
/onexptend = [values.completed = 1]
</expt>

**************************************************************************************************************
**************************************************************************************************************
    Order: Money(Ascending), Money(Descending), Food(Ascending), Food(Descending)
**************************************************************************************************************
**************************************************************************************************************
<expt>
/ preinstructions = (generalintro)
/ postinstructions = (generaloutro)
/ blocks = [1=foodchoice; 2-8=sequence( food_asc, food_desc)]
/ subjects = (2 of 4)
/ groupassignment = groupnumber
/onexptend = [values.completed = 1]
</expt>

**************************************************************************************************************
**************************************************************************************************************
    Order: Food(Descending), Food(Ascending), Money(Descending), Money(Ascending)
**************************************************************************************************************
**************************************************************************************************************
<expt>
/ preinstructions = (generalintro)
/ postinstructions = (generaloutro)
/ blocks = [1=foodchoice; 2-8=sequence(food_desc, food_asc,)]
/ subjects = (3 of 4)
/ groupassignment = groupnumber
/onexptend = [values.completed = 1]
</expt>

**************************************************************************************************************
**************************************************************************************************************
    Order: Food(Ascending), Food(Descending), Money(Ascending), Money(Descending)
**************************************************************************************************************
**************************************************************************************************************
<expt>
/ preinstructions = (generalintro)
/ postinstructions = (generaloutro)
/ blocks = [1=foodchoice; 2-8=sequence(food_asc, food_desc, money_asc, money_desc)]
/ subjects = (4 of 4)
/ groupassignment = groupnumber
/onexptend = [values.completed = 1]
</expt>




Attachments
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Reading This Topic

Explore
Messages
Mentions
Search