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
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 105K
sandy_d - Tuesday, November 15, 2016
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>




> I currently have the DDT so that it should run 8 delay blocks.

Please specify *precisely* what you mean by this. I.e., name the  blocks you expect to run and point at the respective sections of the code where you think you instructed the script to do so.

> but it seems that only 4 of the delay blocks actually run

Here, too, please *name* the blocks.

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
Apologies for the ambiguity.
I have the program set to run 8 delay blocks of time:
/delay1 = "30 minutes"
/delay2 = "1 hour"
/delay3 = "2 hours"
/delay4 = "4 hours"
/delay5 = "8 hours"
/delay6 = "1 day"
/delay7 = "3 days"
/delay8 = "1 week"


I believe I've written the code as so:
<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>



and

<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>





Of these 8, when the program runs, only the first 4 delays run, after which, the program ends.
The delays that are running are:
/delay1 = "30 minutes"
/delay2 = "1 hour"
/delay3 = "2 hours"
/delay4 = "4 hours"


The code for this is the same as above.





Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 105K
sandy_d - Wednesday, November 16, 2016
Apologies for the ambiguity.
I have the program set to run 8 delay blocks of time:
/delay1 = "30 minutes"
/delay2 = "1 hour"
/delay3 = "2 hours"
/delay4 = "4 hours"
/delay5 = "8 hours"
/delay6 = "1 day"
/delay7 = "3 days"
/delay8 = "1 week"


I believe I've written the code as so:
<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>



and

<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>





Of these 8, when the program runs, only the first 4 delays run, after which, the program ends.
The delays that are running are:
/delay1 = "30 minutes"
/delay2 = "1 hour"
/delay3 = "2 hours"
/delay4 = "4 hours"


The code for this is the same as above.





#1: You have not added the new, 8th delay to the delay <list>:

<list delays>
/ items = (parameters.delay1, parameters.delay2, parameters.delay3, parameters.delay4, parameters.delay5, parameters.delay6, parameters.delay7) 
/ selectionmode = sequence
/ selectionrate = block
/ resetinterval = 0
</list>

#2:

<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>

means you run 7 times the block sequence food_desc->food_asc, i.e.
(1) food_desc->food_asc ->
(2) food_desc->food_asc ->
(3) food_desc->food_asc ->
(4) food_desc->food_asc ->
(5) food_desc->food_asc ->
(6) food_desc->food_asc ->
(7) food_desc->food_asc

You sample a new delay from the <list> after each chunk of 8 blocks:

<block food_desc>
...
/ onblockbegin = [if(mod(values.blockcount,8)==1 || mod(values.blockcount,8)==3)
    values.ip_asc=0.00]
/ onblockbegin = [if(mod(values.blockcount,8)==1)
    values.delay=list.delays.nextvalue]
...
</block>

(same in <block food_asc>)

You do something completely different in the money blocks, where you sample a new delay after each chunk of 4 blocks.

<block money_asc>
...
/ 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]
...
</block>

I frankly don't quite understand the reasoning. Can you explain?

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
Dave - Wednesday, November 16, 2016
sandy_d - Wednesday, November 16, 2016
Apologies for the ambiguity.
I have the program set to run 8 delay blocks of time:
/delay1 = "30 minutes"
/delay2 = "1 hour"
/delay3 = "2 hours"
/delay4 = "4 hours"
/delay5 = "8 hours"
/delay6 = "1 day"
/delay7 = "3 days"
/delay8 = "1 week"


I believe I've written the code as so:
<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>



and

<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>





Of these 8, when the program runs, only the first 4 delays run, after which, the program ends.
The delays that are running are:
/delay1 = "30 minutes"
/delay2 = "1 hour"
/delay3 = "2 hours"
/delay4 = "4 hours"


The code for this is the same as above.





#1: You have not added the new, 8th delay to the delay <list>:

<list delays>
/ items = (parameters.delay1, parameters.delay2, parameters.delay3, parameters.delay4, parameters.delay5, parameters.delay6, parameters.delay7) 
/ selectionmode = sequence
/ selectionrate = block
/ resetinterval = 0
</list>

#2:

<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>

means you run 7 times the block sequence food_desc->food_asc, i.e.
(1) food_desc->food_asc ->
(2) food_desc->food_asc ->
(3) food_desc->food_asc ->
(4) food_desc->food_asc ->
(5) food_desc->food_asc ->
(6) food_desc->food_asc ->
(7) food_desc->food_asc

You sample a new delay from the <list> after each chunk of 8 blocks:

<block food_desc>
...
/ onblockbegin = [if(mod(values.blockcount,8)==1 || mod(values.blockcount,8)==3)
    values.ip_asc=0.00]
/ onblockbegin = [if(mod(values.blockcount,8)==1)
    values.delay=list.delays.nextvalue]
...
</block>

(same in <block food_asc>)

You do something completely different in the money blocks, where you sample a new delay after each chunk of 4 blocks.

<block money_asc>
...
/ 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]
...
</block>

I frankly don't quite understand the reasoning. Can you explain?

My reasoning was that if I added a delay 8 to where the existing code for the other 7  delays were ( and to just copy & paste the previous delays and change it to 8), it would work.  I don't quite understand  any of this, and that was just my best guess at how to do it.



Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 105K
sandy_d - Thursday, November 17, 2016
Dave - Wednesday, November 16, 2016
sandy_d - Wednesday, November 16, 2016
Apologies for the ambiguity.
I have the program set to run 8 delay blocks of time:
/delay1 = "30 minutes"
/delay2 = "1 hour"
/delay3 = "2 hours"
/delay4 = "4 hours"
/delay5 = "8 hours"
/delay6 = "1 day"
/delay7 = "3 days"
/delay8 = "1 week"


I believe I've written the code as so:
<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>



and

<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>





Of these 8, when the program runs, only the first 4 delays run, after which, the program ends.
The delays that are running are:
/delay1 = "30 minutes"
/delay2 = "1 hour"
/delay3 = "2 hours"
/delay4 = "4 hours"


The code for this is the same as above.





#1: You have not added the new, 8th delay to the delay <list>:

<list delays>
/ items = (parameters.delay1, parameters.delay2, parameters.delay3, parameters.delay4, parameters.delay5, parameters.delay6, parameters.delay7) 
/ selectionmode = sequence
/ selectionrate = block
/ resetinterval = 0
</list>

#2:

<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>

means you run 7 times the block sequence food_desc->food_asc, i.e.
(1) food_desc->food_asc ->
(2) food_desc->food_asc ->
(3) food_desc->food_asc ->
(4) food_desc->food_asc ->
(5) food_desc->food_asc ->
(6) food_desc->food_asc ->
(7) food_desc->food_asc

You sample a new delay from the <list> after each chunk of 8 blocks:

<block food_desc>
...
/ onblockbegin = [if(mod(values.blockcount,8)==1 || mod(values.blockcount,8)==3)
    values.ip_asc=0.00]
/ onblockbegin = [if(mod(values.blockcount,8)==1)
    values.delay=list.delays.nextvalue]
...
</block>

(same in <block food_asc>)

You do something completely different in the money blocks, where you sample a new delay after each chunk of 4 blocks.

<block money_asc>
...
/ 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]
...
</block>

I frankly don't quite understand the reasoning. Can you explain?

My reasoning was that if I added a delay 8 to where the existing code for the other 7  delays were ( and to just copy & paste the previous delays and change it to 8), it would work.  I don't quite understand  any of this, and that was just my best guess at how to do it.



Go back to the original script and try to understand that first. I'll try to explain.

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

There are seven delay-"levels". Hence the script runs a sequence of four blocks 7 times. After each set of 4 blocks, the delay-level is increased. You get

Delay 1
money_desc -> money_asc -> food_desc -> food_asc
Delay 2
money_desc -> money_asc -> food_desc -> food_asc
Delay 3
money_desc -> money_asc -> food_desc -> food_asc

and so forth.

What's responsible for selecting the next delay level after each chunk of four blocks is the code I pointed out earlier

<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>

(analogous code exists in the other <block> elements, of course).

Now, if you want to run 8 delays and only for the food items, you need to run 8 sequences of *two* blocks. And you need to select the next delay level after each chunk of *two* blocks, not 4 or 8.


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search