Hi, I'm trying to program a task that involves the participant inputting two integers that has to equate to 10.
Since I couldn't write in two response options for one trial page, I've used two openended options.
<openended sunnyfarm>
/ buttonlabel = "Next"
/ mask = integer
/ charlimit = 2
/ range = (0,10)
/ position = (80%, 70%)
/ stimulustimes = [0=farm, sunny, seasoncount, sunnyweather, totalcreditfarm, totalcreditinsurance]
/ontrialend = [values.farmlatency = openended.sunnyfarm.latency]
/ ontrialend = [if (openended.sunnyfarm.trialcount <= values.totalseasons) values.seasoncount +=1]
/ ontrialend = [values.creditfarminput = openended.sunnyfarm.response]
/ branch = [openended.sunnyinsurance]
/ recorddata = true
</openended>
<openended sunnyinsurance>
/ buttonlabel = "End of Season"
/ mask = integer
/ charlimit = 2
/ range = (0,10)
/ position = (70%, 70%)
/ stimulustimes = [0=farm, sunny, sunnyweather, totalcreditfarm, totalcreditinsurance]
/ ontrialend = [values.insurancelatency = openended.sunnyinsurance.latency]
/ ontrialend = [values.creditinsuranceinput==openended.sunnyinsurance]
/ ontrialend = [values.creditinsuranceinput = openended.sunnyinsurance.response]
/ ontrialend = [if (values.creditinsuranceinput + values.creditfarminput ==10) values.totalcreditfarm += values.creditfarminput else]/ ontrialend = [if (values.creditinsuranceinput + values.creditfarminput ==10) values.totalcreditinsurance += values.creditinsuranceinput]
/ branch = [trial.seasonfeedback]
/ recorddata = true
</openended>
My question is for / ontrialend = [if (values.creditinsuranceinput + values.creditfarminput ==10) values.totalcreditfarm += values.creditfarminput
else]
If the total input values do not = 10, how do I get the trial to not accept the response so that it prompts the participant to reenter a correct value? Or is there a if/else statement I could use that introduces an error message?
Alternatively, could I use an expression for /validresponse instead?
if I had a appropriateinsuranceinput = (10-values.creditfarminput), can I put / validresponse = expressions.appropriateinsuranceinput?
Thank you!