Millisecond Forums

branching with time limit

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

By ineke - 1/19/2014

Hello,

We want to be able to test perseverance by giving participants an unsolvable calculation. They would get 5 minutes and can fill in several responses. After each response participants get the offer to choose whether they stop the task or whether they continue. If they continue they still have (5 minutes minus the time it took to response the first time). After the second response, they again get to choose whether they continue and if yes they should get (5min - (RT to response1+ RT to response 3)) and so on ...until a time out at 5 minutes.

To be honest, I'm not sure how to start programming this. I will be one block, and I have one stimuli for the unsolvable exercise and one for the option to continue/stop. Can this all be done in one trial because I need two responses? Any help would be very welcome!! Thanks!!!
By Dave - 1/19/2014

You simply set the /timeout at the <block> level and continue as long as the participant wants via /branch attributes at the <trial> level.

<block myblock>
/ trials = [1=unsolvable]
/ timeout = 300000
</block>

<openended unsolvable>
/ stimulusframes = [1=theunsolvableproblem]
/ position = (50%, 75%)
/ branch = [trial.continue]
</openended>

<trial continue>
/ stimulusframes = [1=thequestion, yes, no]
/ validresponse = (yes, no)
/ inputdevice = mouse
/ branch = [if (trial.continue.response=="yes") openended.unsolvable]
</trial>

<text theunsolvableproblem>
/ items = ("3.6 lightyears * 255 dog years / 12 gallons of milk = ?")
</text>

<text thequestion>
/ items = ("Do you want to try again?")
</text>

<text yes>
/ items = ("YES.")
/ position = (40%, 75%)
</text>

<text no>
/ items = ("NOOOOOOOO.")
/ position = (60%, 75%)
</text>
By ineke - 2/2/2014

Thank you so much for this very clear, comprehensive (and funny) answer! Although it seems simple something went wrong because the task won't run and this is the message I got:
<openended oefening>
/branch: Missing ')'
<trial continue>
/branch: " is not a valid setting
/branch: -1.0000 is invalid. Value must greater than 0.00000
/branch: could not locate trial ".

This was the way I programmed my trials:

<openended oefening>
/ trialcode = "oefening"
/position = (50, 90)
/linelength = 9
/numlines = 1
/ validresponse = (anyresponse)
/ correctresponse = ("stop")
/ errormessage = (errormessage, 2000)
/ stimulustimes = [10 = oefening]
/  branch = [trial.continue]
</openended>

<trial continue>
/ trialcode = "continue"
/ validresponse = ("1", "0")
/ stimulustimes = [5 = continue]
/ branch = [if(trial.continue.response = "1") openended.oefening]
</trial>

By Dave - 2/2/2014

/ branch = [if(trial.continue.response = "1") openended.oefening]

#1: You are using the wrong operator in your if() condition. "=" is the *assignment operator, "==" is the *logical operator*. You don't want to assign a value to the response property here (and you can't: it's read-only as it should be). For details see the "Operators" topic in the language reference.

#2: You'll have to use keyboard scancodes. 'trial.continue.response == "1"' will not work, you need to use the scan code of the "1" key instead as in 'trial.continue.response == 2'. See the "Keyboard Scan Codes" topic in the documentation as well as Tools -> Keyboard Scancodes... for details.