## store correct response based on previous trial

 Author Message lir1995  New Member         Group: Forum Members Posts: 5, Visits: 29 Hi, I am new to Inquisit, and creating a new task that requires participants to determine whether the current item matches with the previous (like playing the game of dominoes, where a domino containing one and two would match to three, one, but not with four, five). I am looking for syntax to store the correct response based on whether the current stimulus matches with the previous. Is there a way to do this? Additionally, is there a way to counterbalance my blocks so that half of the trials in the block are "match" trials, and half of the trials are "mismatch" trials. A match trial would mean that the next stimulus contains one of the same numbers as the previous, and mismatch would mean that both of the numbers are different. Thank you very much in advance for any help! Let me know if you need additional clarification. Dave  Supreme Being         Group: Administrators Posts: 9.9K, Visits: 49K +xlir1995 - 11/21/2019Hi, I am new to Inquisit, and creating a new task that requires participants to determine whether the current item matches with the previous (like playing the game of dominoes, where a domino containing one and two would match to three, one, but not with four, five). I am looking for syntax to store the correct response based on whether the current stimulus matches with the previous. Is there a way to do this? Additionally, is there a way to counterbalance my blocks so that half of the trials in the block are "match" trials, and half of the trials are "mismatch" trials. A match trial would mean that the next stimulus contains one of the same numbers as the previous, and mismatch would mean that both of the numbers are different. Thank you very much in advance for any help! Let me know if you need additional clarification. What you're describing is basically similar a 1-back task. You can look at the n-back scripts available in the library for elaborate examples on how to implement something like this. I could give you a more concrete example / some skeleton code, but you would have to spell out the exact matching rules you wish to implement first. Dave  Supreme Being         Group: Administrators Posts: 9.9K, Visits: 49K +xDave - 11/21/2019+xlir1995 - 11/21/2019Hi, I am new to Inquisit, and creating a new task that requires participants to determine whether the current item matches with the previous (like playing the game of dominoes, where a domino containing one and two would match to three, one, but not with four, five). I am looking for syntax to store the correct response based on whether the current stimulus matches with the previous. Is there a way to do this? Additionally, is there a way to counterbalance my blocks so that half of the trials in the block are "match" trials, and half of the trials are "mismatch" trials. A match trial would mean that the next stimulus contains one of the same numbers as the previous, and mismatch would mean that both of the numbers are different. Thank you very much in advance for any help! Let me know if you need additional clarification. What you're describing is basically similar a 1-back task. You can look at the n-back scripts available in the library for elaborate examples on how to implement something like this. I could give you a more concrete example / some skeleton code, but you would have to spell out the exact matching rules you wish to implement first.Here's a simple example with two different digits between 1 and 9 sampled randomly in each trial. In match trials, one of the previous digits will be kept, the other will be replaced with a different one. In mismatch trials, both previous digits will be replaced with different ones. / ontrialbegin = [values.n1 = list.numbers.nextvalue;values.n2 = list.numbers.nextvalue;]/ stimulusframes = [1=number_one, number_two]/ validresponse = ("y", "n")/ correctresponse = ("n")/ ontrialbegin = [list.numbers.reset();values.matchposition = replace(1,2);if (values.matchposition == 1) {values.not1 = values.n1;values.not2 = values.n2;values.n2 = list.numbers.nextvalue;} else if (values.matchposition == 2) {values.not1 = values.n1;values.not2 = values.n2;values.n1 = list.numbers.nextvalue;}]/ stimulusframes = [1=number_one, number_two]/ validresponse = ("y", "n")/ correctresponse = ("y")/ ontrialbegin = [list.numbers.reset();values.not1 = values.n1;values.not2 = values.n2;values.matchposition = 0;values.n1 = list.numbers.nextvalue;values.n2 = list.numbers.nextvalue;]/ stimulusframes = [1=number_one, number_two]/ validresponse = ("y", "n")/ correctresponse = ("n")/ trials = [1= start; 2-21 = noreplace(match, mismatch)]/ items = ("<%values.n1%>")/ position = (48%, 50%)/ items = ("<%values.n2%>")/ position = (52%, 50%)/ n1 = 0/ n2 = 0/ matchposition = 0/ not1 = 0/ not2 = 0/ items = (1,2,3,4,5,6,7,8,9)/ replace = false/ selectionrate = always/ not = (values.not1)/ not = (values.not2)/ columns = (date time subject group blocknum blockcode trialnum trialcode response latency correct values.n1 values.n2 values.matchposition)/ separatefiles = true lir1995  New Member         Group: Forum Members Posts: 5, Visits: 29 This was very helpful, thanks! lir1995  New Member         Group: Forum Members Posts: 5, Visits: 29 Thank you so much again for your help! I have been working on adapting the code you sent to work with images. I will have one image on top of the other. The number of dots in each image will either match or non match. Is this even possible? I have attached the code I have been working with as well as the data file. / stimulustimes = [0=box,number_one, number_two]/ validresponse = ("y", "n")/ correctresponse = ("n")/ ontrialbegin = [values.n1 = picture.number_one.nextvalue;values.n2 = picture.number_two.nextvalue;]/ ontrialbegin = [list.dominoes.reset();values.matchposition = replace(1,2);if (values.matchposition == 1) {values.not1 = values.n1;values.not2 = values.n2;values.n2 = picture.number_two.nextvalue;} else if (values.matchposition == 2) {values.not1 = values.n1;values.not2 = values.n2;values.n1 = picture.number_one.nextvalue;}]/ stimulustimes = [0=box,number_one, number_two]/ validresponse = ("y", "n")/ correctresponse = ("y")/ ontrialend = [values.not1 = picture.mismatch1.nextvalue;values.not2 = picture.mismatch2.nextvalue;]/ ontrialbegin = [list.dominoes.reset();values.not1 = values.n1;values.not2 = values.n2;values.matchposition = 0;values.n1 = picture.number_one.nextvalue;values.n2 = picture.number_two.nextvalue;]/ stimulustimes = [0=box,number_one, number_two]/ validresponse = ("y", "n")/ correctresponse = ("n")/ ontrialend = [values.not1 = picture.mismatch1.nextvalue;values.not2 = picture.mismatch2.nextvalue]/ trials = [1= start; 2-21 = noreplace(match, mismatch)]/ n1 = 0/ n2 = 0/ matchposition = 0/ not1 = 0/ not2 = 0/ items = domino/ size = (50%, 50%)/ erase = false/1 = "1.png"/2 = "2.png"/3 = "3.png"/4 = "4.png"/6 = "5.png"/6 = "6.png"/ items = domino/ position = (50%, 68%)/ select = replace/ items = domino/ position = (50%, 32%)/ select = replace/ items = box/ size = (55%, 55%)/ erase = false/1 = "dominostim/box.png"/ items = (1,2,3,4,5,6)/ replace = false/ selectionrate = always/ not = (values.not1)/ not = (values.not2)/ items = (1,2,3,4,5,6)/ not = (values.n1)/ replace = true/ items = (1,2,3,4,5,6)/ not = (values.n2)/ replace = true/ items = domino/ select = list.not1.nextvalue/size = (40%, 40%)/ items = domino/ select = list.not2.nextvalue/size = (40%, 40%)/ columns = (date time subject group blocknum blockcode trialnum trialcode response latency correct values.n1 values.n2 values.matchposition stimulusitem stimulusitem stimulusitem values.not1)/ separatefiles = trueThank you very much, and again happy to clarify! Attachments matchdomtest3_raw_1_2019-11-24-00-57-30-094.iqdat (2 views, 2.00 KB) Dave  Supreme Being         Group: Administrators Posts: 9.9K, Visits: 49K +xlir1995 - 11/23/2019Thank you so much again for your help! I have been working on adapting the code you sent to work with images. I will have one image on top of the other. The number of dots in each image will either match or non match. Is this even possible? I have attached the code I have been working with as well as the data file. / stimulustimes = [0=box,number_one, number_two]/ validresponse = ("y", "n")/ correctresponse = ("n")/ ontrialbegin = [values.n1 = picture.number_one.nextvalue;values.n2 = picture.number_two.nextvalue;]/ ontrialbegin = [list.dominoes.reset();values.matchposition = replace(1,2);if (values.matchposition == 1) {values.not1 = values.n1;values.not2 = values.n2;values.n2 = picture.number_two.nextvalue;} else if (values.matchposition == 2) {values.not1 = values.n1;values.not2 = values.n2;values.n1 = picture.number_one.nextvalue;}]/ stimulustimes = [0=box,number_one, number_two]/ validresponse = ("y", "n")/ correctresponse = ("y")/ ontrialend = [values.not1 = picture.mismatch1.nextvalue;values.not2 = picture.mismatch2.nextvalue;]/ ontrialbegin = [list.dominoes.reset();values.not1 = values.n1;values.not2 = values.n2;values.matchposition = 0;values.n1 = picture.number_one.nextvalue;values.n2 = picture.number_two.nextvalue;]/ stimulustimes = [0=box,number_one, number_two]/ validresponse = ("y", "n")/ correctresponse = ("n")/ ontrialend = [values.not1 = picture.mismatch1.nextvalue;values.not2 = picture.mismatch2.nextvalue]/ trials = [1= start; 2-21 = noreplace(match, mismatch)]/ n1 = 0/ n2 = 0/ matchposition = 0/ not1 = 0/ not2 = 0/ items = domino/ size = (50%, 50%)/ erase = false/1 = "1.png"/2 = "2.png"/3 = "3.png"/4 = "4.png"/6 = "5.png"/6 = "6.png"/ items = domino/ position = (50%, 68%)/ select = replace/ items = domino/ position = (50%, 32%)/ select = replace/ items = box/ size = (55%, 55%)/ erase = false/1 = "dominostim/box.png"/ items = (1,2,3,4,5,6)/ replace = false/ selectionrate = always/ not = (values.not1)/ not = (values.not2)/ items = (1,2,3,4,5,6)/ not = (values.n1)/ replace = true/ items = (1,2,3,4,5,6)/ not = (values.n2)/ replace = true/ items = domino/ select = list.not1.nextvalue/size = (40%, 40%)/ items = domino/ select = list.not2.nextvalue/size = (40%, 40%)/ columns = (date time subject group blocknum blockcode trialnum trialcode response latency correct values.n1 values.n2 values.matchposition stimulusitem stimulusitem stimulusitem values.not1)/ separatefiles = trueThank you very much, and again happy to clarify!Of course it's possible. Just use values.n1 and values.n2 to select the item in the elements, i.e./ select = values.n1 and / select = values.n2 respectively./ ontrialbegin = [values.n1 = list.numbers.nextvalue;values.n2 = list.numbers.nextvalue;]/ stimulusframes = [1=number_one, number_two]/ validresponse = ("y", "n")/ correctresponse = ("n")/ ontrialbegin = [list.numbers.reset();values.matchposition = replace(1,2);if (values.matchposition == 1) {values.not1 = values.n1;values.not2 = values.n2;values.n2 = list.numbers.nextvalue;} else if (values.matchposition == 2) {values.not1 = values.n1;values.not2 = values.n2;values.n1 = list.numbers.nextvalue;}]/ stimulusframes = [1=number_one, number_two]/ validresponse = ("y", "n")/ correctresponse = ("y")/ ontrialbegin = [list.numbers.reset();values.not1 = values.n1;values.not2 = values.n2;values.matchposition = 0;values.n1 = list.numbers.nextvalue;values.n2 = list.numbers.nextvalue;]/ stimulusframes = [1=number_one, number_two]/ validresponse = ("y", "n")/ correctresponse = ("n")/ trials = [1= start; 2-21 = noreplace(match, mismatch)]/ items = domino/ position = (50%, 32%)/ select = values.n1/ items = domino/ position = (50%, 68%)/ select = values.n2/1 = "1.png"/2 = "2.png"/3 = "3.png"/4 = "4.png"/6 = "5.png"/6 = "6.png"/ n1 = 0/ n2 = 0/ matchposition = 0/ not1 = 0/ not2 = 0/ items = (1,2,3,4,5,6)/ replace = false/ selectionrate = always/ not = (values.not1)/ not = (values.not2)/ columns = (date time subject group blocknum blockcode trialnum trialcode response latency correct values.n1 values.n2 values.matchposition)/ separatefiles = true lir1995  New Member         Group: Forum Members Posts: 5, Visits: 29 Ah, I see. Thank you very much!!