## Multipliers and Feedback Response

##### Multipliers and Feedback Response
 Author Message raven posted 2 Months Ago ANSWER         Group: Forum Members Posts: 25, Visits: 57 Hi Dave,I would really appreciate if you can help me solve the following issue with my script.It uses a list of multipliers at / items = (1, 1, -1) to set probabilities for the score to go up or down. However, it says "Guess was Correct" in the feedback screen after a trial had a multiplier of -1, but I want it to say "Guess was Incorrect" for -1 multipliers and "Guess was Correct" for +1 multipliers.It reports the difference in the feedback screen correctly, so that's not an issue.I've tried to add && values.multiplier = 1 to the condition in the first line of /ontrialend, so it becomes:  if (trial.trial1.correct && values.multiplier =1), but that doesn't seem to resolve the issue either.The script is as follows:/ score = 0/ multiplier = 0/ diff = 0/ acc = ""/ ncorrect = 0/ n = 0/ cx = 50%/ items = (1, 1, -1)/ selectionmode = random/ replace = true/ ontrialbegin = [        values.n += 1;  values.ncorrect += trial.trial1.correct;        values.multiplier = list.prob.nextvalue;]/ ontrialend = [        if (trial.trial1.correct) {        values.multiplier = list.prob.nextvalue;   values.score += values.multiplier * 10;        values.diff = 0;        values.diff = values.multiplier * 10;        values.acc = "Correct";  }        else {        values.score += values.multiplier * 5;        values.diff = 0;        values.diff += values.multiplier * 5;        values.acc = "Incorrect";    }    ]/ stimulusframes = [1=stim, score]/ inputdevice = keyboard/ validresponse = ("z", "x")/ correctresponse = ("z")/ branch = [    {        trial.feedback    }]/ items = ("A", "E", "I", "O", "U")/ hposition = values.cx/ items = (50%)/ selectionrate = always / stimulusframes = [1=clearscreen, fb, score, diff, acc]/ timeout = 3500/ items = ("Performance: <%values.ncorrect%> out of <%values.n%> trials correct.")/ fontstyle = ("Arial", 21pt, true)/ size = (80%, 10%)/ erase = false/ position = (50%, 85%)/ items = ("Score changed by: <%values.diff%>")/ fontstyle = ("Arial", 21pt, true)/ position = (50%, 50%)/ items = ("Guess was: <%values.acc%>")/ fontstyle = ("Arial", 21pt, true)/ color = black/ size = (80%, 20%)/ position = (50%, 35%)/ items = ("Score: <%values.score%>")/ fontstyle = ("Arial", 21pt, true)/ size = (80%, 20%)/ erase = false/ position = (50%, 75%)/ trials = [1-30 = trial1]Your help will be much appreciated! Dave posted 2 Months Ago ANSWER         Group: Administrators Posts: 12K, Visits: 93K +x raven - 7/24/2023Hi Dave,I would really appreciate if you can help me solve the following issue with my script.It uses a list of multipliers at / items = (1, 1, -1) to set probabilities for the score to go up or down. However, it says "Guess was Correct" in the feedback screen after a trial had a multiplier of -1, but I want it to say "Guess was Incorrect" for -1 multipliers and "Guess was Correct" for +1 multipliers.It reports the difference in the feedback screen correctly, so that's not an issue.I've tried to add && values.multiplier = 1 to the condition in the first line of /ontrialend, so it becomes:  if (trial.trial1.correct && values.multiplier =1), but that doesn't seem to resolve the issue either.The script is as follows:/ score = 0/ multiplier = 0/ diff = 0/ acc = ""/ ncorrect = 0/ n = 0/ cx = 50%/ items = (1, 1, -1)/ selectionmode = random/ replace = true/ ontrialbegin = [        values.n += 1;  values.ncorrect += trial.trial1.correct;        values.multiplier = list.prob.nextvalue;]/ ontrialend = [        if (trial.trial1.correct) {        values.multiplier = list.prob.nextvalue;   values.score += values.multiplier * 10;        values.diff = 0;        values.diff = values.multiplier * 10;        values.acc = "Correct";  }        else {        values.score += values.multiplier * 5;        values.diff = 0;        values.diff += values.multiplier * 5;        values.acc = "Incorrect";    }    ]/ stimulusframes = [1=stim, score]/ inputdevice = keyboard/ validresponse = ("z", "x")/ correctresponse = ("z")/ branch = [    {        trial.feedback    }]/ items = ("A", "E", "I", "O", "U")/ hposition = values.cx/ items = (50%)/ selectionrate = always / stimulusframes = [1=clearscreen, fb, score, diff, acc]/ timeout = 3500/ items = ("Performance: <%values.ncorrect%> out of <%values.n%> trials correct.")/ fontstyle = ("Arial", 21pt, true)/ size = (80%, 10%)/ erase = false/ position = (50%, 85%)/ items = ("Score changed by: <%values.diff%>")/ fontstyle = ("Arial", 21pt, true)/ position = (50%, 50%)/ items = ("Guess was: <%values.acc%>")/ fontstyle = ("Arial", 21pt, true)/ color = black/ size = (80%, 20%)/ position = (50%, 35%)/ items = ("Score: <%values.score%>")/ fontstyle = ("Arial", 21pt, true)/ size = (80%, 20%)/ erase = false/ position = (50%, 75%)/ trials = [1-30 = trial1]Your help will be much appreciated!Oviously, this makes no sense if what you want is the feedback saying correct for positive and incorrect for negative multipliers so that's what you need to change. Set values.acc on the basis of the multiplier value, not on the basis of the trial's correct property. raven posted 2 Months Ago ANSWER         Group: Forum Members Posts: 25, Visits: 57 Hi Dave,Thanks for your reply.I'm not sure how to do that other than using the if/else conditional statements.Would you be able to give an example showing how I could set values.acc on the basis of the multiplier value in this instance? Dave posted 2 Months Ago ANSWER         Group: Administrators Posts: 12K, Visits: 93K +x raven - 7/24/2023Hi Dave,Thanks for your reply.I'm not sure how to do that other than using the if/else conditional statements.Would you be able to give an example showing how I could set values.acc on the basis of the multiplier value in this instance?Well, yes, of course you use if else statements, no different than those you already have. I'm having trouble understanding where the hang-up is.You have the multiplier in values.multiplier. If it's less than 0, set values.acc to "Incorrect". Otherwise set it to "Correct"./ ontrialbegin = [     values.n += 1;    values.multiplier = list.prob.nextvalue;]/ ontrialend = [    values.ncorrect += trial.trial1.correct;        if (trial.trial1.correct) {        values.score += values.multiplier * 10;        values.diff = 0;        values.diff = values.multiplier * 10;        if (values.multiplier < 0) {            values.acc = "Incorrect";        } else {            values.acc = "Correct";        };    }    else {        values.score += values.multiplier * 5;        values.diff = 0;        values.diff += values.multiplier * 5;        values.acc = "Incorrect";    };]/ stimulusframes = [1=stim, score]/ inputdevice = keyboard/ validresponse = ("z", "x")/ correctresponse = ("z")/ branch = [    return trial.feedback;] Edited 2 Months Ago by Dave raven posted 2 Months Ago ANSWER         Group: Forum Members Posts: 25, Visits: 57 Thanks Dave, you've pointed me in the right direction, using nested if/else statements makes sense.I will check the support docs for further details on nested expressions.Much appreciated! :)

#### Merge Selected

Merge into selected topic...

Merge into merge target...

Merge into a specific topic ID...