## branching with time limit

 Author Message ineke Distinguished Member Group: Forum Members Posts: 20, Visits: 62 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!!! Dave Supreme Being Group: Administrators Posts: 9.8K, Visits: 47K You simply set the /timeout at the level and continue as long as the participant wants via /branch attributes at the level./ trials = [1=unsolvable]/ timeout = 300000/ stimulusframes = [1=theunsolvableproblem]/ position = (50%, 75%)/ branch = [trial.continue]/ stimulusframes = [1=thequestion, yes, no]/ validresponse = (yes, no)/ inputdevice = mouse/ branch = [if (trial.continue.response=="yes") openended.unsolvable]/ items = ("3.6 lightyears * 255 dog years / 12 gallons of milk = ?")/ items = ("Do you want to try again?")/ items = ("YES.")/ position = (40%, 75%)/ items = ("NOOOOOOOO.")/ position = (60%, 75%) ineke Distinguished Member Group: Forum Members Posts: 20, Visits: 62 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: /branch: Missing ')'/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:/ trialcode = "oefening"/position = (50, 90)/linelength = 9/numlines = 1/ validresponse = (anyresponse)/ correctresponse = ("stop")/ errormessage = (errormessage, 2000)/ stimulustimes = [10 = oefening]/  branch = [trial.continue]/ trialcode = "continue"/ validresponse = ("1", "0")/ stimulustimes = [5 = continue]/ branch = [if(trial.continue.response = "1") openended.oefening] Dave Supreme Being Group: Administrators Posts: 9.8K, Visits: 47K / 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.