Author Message L123 posted Last Week ANSWER HOT         Group: Forum Members Posts: 4, Visits: 10 Hey,I have an experiment where I want to have users decide between 1, 2 or 3 (keyboard input). If they decide for a specific number (either 1 or 3), they should get a message of being correct or incorrect. If they decide for number 2, they should see another trial. This works fine so far, but now I want to specify the correct (and incorrect) numbers using a list. Unfortunately, it doesn't work and the correct number is not assigned in my data either. Here is the code: (copied the relevant parts only):/1 = "1"/2 = "3"/3 = "1"/4 = "3"/ items = [item.item_correct_answers]/ select = values.currentscenario// select = 2/1 = "3"/2 = "1"/3 = "3"/4 = "1"/ items = [item.item_incorrect_answers]/ select = values.currentscenario/ currentscenario = 0/ stimulusframes = [1 = fixation; 100 = override_fixation, instruction, stimulus_70, orangeChoice, blueChoice, automationChoice, press_1, press_2, press_3]/ inputdevice = keyboard/ validresponse = ("1", "2", "3")/ correctresponse = (list.correct_answers.currentvalue)/ responsemessage = (list.correct_answers.currentvalue, feedback_correct, 1500)/ responsetrial = ("2", task_70_advice)/ responsemessage = (list.incorrect_answers.currentvalue, feedback_incorrect, 1500)/ ontrialbegin = [  values.currentscenario = values.currentscenario + 1;]/ trials = [1-4 = sequence(task_70)]/ blocks = [    1 = task;]Thanks in advance! Dave          Group: Administrators Posts: 12K, Visits: 84K +x L123 - 8/1/2022Hey,I have an experiment where I want to have users decide between 1, 2 or 3 (keyboard input). If they decide for a specific number (either 1 or 3), they should get a message of being correct or incorrect. If they decide for number 2, they should see another trial. This works fine so far, but now I want to specify the correct (and incorrect) numbers using a list. Unfortunately, it doesn't work and the correct number is not assigned in my data either. Here is the code: (copied the relevant parts only):/1 = "1"/2 = "3"/3 = "1"/4 = "3"/ items = [item.item_correct_answers]/ select = values.currentscenario// select = 2/1 = "3"/2 = "1"/3 = "3"/4 = "1"/ items = [item.item_incorrect_answers]/ select = values.currentscenario/ currentscenario = 0/ stimulusframes = [1 = fixation; 100 = override_fixation, instruction, stimulus_70, orangeChoice, blueChoice, automationChoice, press_1, press_2, press_3]/ inputdevice = keyboard/ validresponse = ("1", "2", "3")/ correctresponse = (list.correct_answers.currentvalue)/ responsemessage = (list.correct_answers.currentvalue, feedback_correct, 1500)/ responsetrial = ("2", task_70_advice)/ responsemessage = (list.incorrect_answers.currentvalue, feedback_incorrect, 1500)/ ontrialbegin = [  values.currentscenario = values.currentscenario + 1;]/ trials = [1-4 = sequence(task_70)]/ blocks = [    1 = task;]Thanks in advance!/ items = [item.item_correct_answers]/ select = values.currentscenario// select = 2This is not how you define items in a list. Lists don't use elements. L123          Group: Forum Members Posts: 4, Visits: 10 Can I get it working with a textbox then?I also tried adding the correct answers directly within the list element:/ items = ("1" "3" "1" "3")/ select = values.currentscenarioIt still does not work though. Dave          Group: Administrators Posts: 12K, Visits: 84K +x L123 - 8/1/2022Can I get it working with a textbox then?I also tried adding the correct answers directly within the list element:/ items = ("1" "3" "1" "3")/ select = values.currentscenarioIt still does not work though. There are multple other issues with your code. It's not even clear what exactly it's supposed to do, since you only posted some non-runnable excerpts. Do the following:- Create a small, self-contained demo that mirrors the actual script's setup.- Post that code here and explain clearly what you intend it to do.Then I can show you how to do it right L123          Group: Forum Members Posts: 4, Visits: 10 Thank you!Below you can find a small demo that runs. What I want to do is iterate over a list with different answers. Participants have to choose between A or B. In the first trial, A is correct, in the second trial, B is correct (and so on - that is subject to change in the future). They can also request advice. Now the advice also iterates over a list of items. However, I cannot set the correct and incorrect responses (with corresponding response message) based on the current trial / list. The iteration of advice works for each trial, but setting the correct answers and response message and incorrect answers and response message for the current trial does not work. // define correct answers (would be great to use this item element for easier customization)/ 1 = "1"/ 2 = "3"/ 3 = "1"/ 4 = "3"// define the correct answers, as of now in a list element/ items = (1, 3, 1, 3)/ select = values.currentscenario// select = 2// define incorrect answers (would be great to use this item element for easier customization)/ 1 = "3"/ 2 = "1"/ 3 = "3"/ 4 = "1"// define the incorrect answers, as of now in a list element/ items = [item.item_incorrect_answers]/ select = values.currentscenario// select = 2// define texts/items = ("+")/ fontstyle = ("Arial", 5%, false, false, false, false, 5, 1)/ size = (30%, 30%)/ txbgcolor = white/ txcolor = black/ vjustify = center/ hjustify = center/ position = (50%, 50%)/items = ("Correct!")/ fontstyle = ("Arial", 5%, false, false, false, false, 5, 1)/ size = (30%, 30%)/ txbgcolor = white/ txcolor = black/ vjustify = center/ hjustify = center/ position = (50%, 50%)/ items = ("Incorrect!")/ fontstyle = ("Arial", 5%, false, false, false, false, 5, 1)/ size = (30%, 30%)/ txbgcolor = white/ txcolor = black/ vjustify = center/ hjustify = center/ position = (50%, 50%)// Ask participants to press either 1 or 3 on their keyboard, if they want help, they should press 2/ items = ("A (Press 1) or B (Press 3)? If you want support, press 2") / fontstyle = ("Arial", 4%) / position = (50%, 60%)/ txcolor = black/ txbgcolor = white // Override the fixation with a white screen/ shape = rectangle/ size = (30%, 30%)/ color = (255,255,255)/ vjustify = center/ hjustify = center/ position = (50%, 50%)// specify advice/1 = "Advice: 1"/2 = "Advice: 3"/3 = "Advice: 1"/4 = "Advice: 3"// provide advice/ items = advice_answer_text/ select = values.currentscenario/ fontstyle = ("Arial", 5%) / position = (50%, 75%)/ size = (32%, 15%)/ vjustify = center/ hjustify = center/ txcolor = white/ txbgcolor = grey // define data to be recorded/ columns = (build, computer.platform, date, time, subject, group, session, blockcode, blocknum, trialcode, trialnum, list.correct_answers.currentvalue, response, latency, correct)// define values/ currentscenario = 0 // In this practice trial, I can define the correct answers. 1 is correct, 1 gives the "correct" Feedback and 3 gives the "incorrect" feedback. However, the correct response might change in other trials (to be B, so 3, for example)/ stimulusframes = [1 = fixation; 100 = override_fixation, instruction]/ inputdevice = keyboard/ validresponse = ("1", "2", "3")/ correctresponse = ("1")/ responsemessage = ("1", feedback_correct, 0)/ responsemessage = ("3", feedback_incorrect, 0)/ posttrialpause = 1500// this code works, but it does not give the "feedback_correct" or "feedback_incorrect" response and also does not code the correctresponse in the data section/ stimulusframes = [1 = fixation; 100 = override_fixation, instruction]/ inputdevice = keyboard/ validresponse = ("1", "2", "3")/ correctresponse = (list.correct_answers.currentvalue)/ responsemessage = (list.correct_answers.currentvalue, feedback_correct, 1500)/ responsetrial = ("2", task_70_advice)/ responsemessage = (list.incorrect_answers.currentvalue, feedback_incorrect, 1500)/ ontrialbegin = [  values.currentscenario = values.currentscenario + 1;]// if participants wanted to get advice (pressed 2 in the other trial), they can get advice here and choose again. However, it does not correctly code correct/incorrect either/ stimulusframes = [1 = override_fixation, instruction, advice_answer]/ inputdevice = keyboard/ validresponse = ("1", "3")/ responsemessage = (list.correct_answers.currentvalue, feedback_correct, 1500)/ responsemessage = (list.incorrect_answers.currentvalue, feedback_incorrect, 1500)// define blocks/ trials = [1 = practice]/ trials = [1-4 = sequence(task_70)]// define experiment/ blocks = [    1 = practice_task;    2 = task;] Dave          Group: Administrators Posts: 12K, Visits: 84K +x L123 - 8/1/2022Thank you!Below you can find a small demo that runs. What I want to do is iterate over a list with different answers. Participants have to choose between A or B. In the first trial, A is correct, in the second trial, B is correct (and so on - that is subject to change in the future). They can also request advice. Now the advice also iterates over a list of items. However, I cannot set the correct and incorrect responses (with corresponding response message) based on the current trial / list. The iteration of advice works for each trial, but setting the correct answers and response message and incorrect answers and response message for the current trial does not work. // define correct answers (would be great to use this item element for easier customization)/ 1 = "1"/ 2 = "3"/ 3 = "1"/ 4 = "3"// define the correct answers, as of now in a list element/ items = (1, 3, 1, 3)/ select = values.currentscenario// select = 2// define incorrect answers (would be great to use this item element for easier customization)/ 1 = "3"/ 2 = "1"/ 3 = "3"/ 4 = "1"// define the incorrect answers, as of now in a list element/ items = [item.item_incorrect_answers]/ select = values.currentscenario// select = 2// define texts/items = ("+")/ fontstyle = ("Arial", 5%, false, false, false, false, 5, 1)/ size = (30%, 30%)/ txbgcolor = white/ txcolor = black/ vjustify = center/ hjustify = center/ position = (50%, 50%)/items = ("Correct!")/ fontstyle = ("Arial", 5%, false, false, false, false, 5, 1)/ size = (30%, 30%)/ txbgcolor = white/ txcolor = black/ vjustify = center/ hjustify = center/ position = (50%, 50%)/ items = ("Incorrect!")/ fontstyle = ("Arial", 5%, false, false, false, false, 5, 1)/ size = (30%, 30%)/ txbgcolor = white/ txcolor = black/ vjustify = center/ hjustify = center/ position = (50%, 50%)// Ask participants to press either 1 or 3 on their keyboard, if they want help, they should press 2/ items = ("A (Press 1) or B (Press 3)? If you want support, press 2") / fontstyle = ("Arial", 4%) / position = (50%, 60%)/ txcolor = black/ txbgcolor = white // Override the fixation with a white screen/ shape = rectangle/ size = (30%, 30%)/ color = (255,255,255)/ vjustify = center/ hjustify = center/ position = (50%, 50%)// specify advice/1 = "Advice: 1"/2 = "Advice: 3"/3 = "Advice: 1"/4 = "Advice: 3"// provide advice/ items = advice_answer_text/ select = values.currentscenario/ fontstyle = ("Arial", 5%) / position = (50%, 75%)/ size = (32%, 15%)/ vjustify = center/ hjustify = center/ txcolor = white/ txbgcolor = grey // define data to be recorded/ columns = (build, computer.platform, date, time, subject, group, session, blockcode, blocknum, trialcode, trialnum, list.correct_answers.currentvalue, response, latency, correct)// define values/ currentscenario = 0 // In this practice trial, I can define the correct answers. 1 is correct, 1 gives the "correct" Feedback and 3 gives the "incorrect" feedback. However, the correct response might change in other trials (to be B, so 3, for example)/ stimulusframes = [1 = fixation; 100 = override_fixation, instruction]/ inputdevice = keyboard/ validresponse = ("1", "2", "3")/ correctresponse = ("1")/ responsemessage = ("1", feedback_correct, 0)/ responsemessage = ("3", feedback_incorrect, 0)/ posttrialpause = 1500// this code works, but it does not give the "feedback_correct" or "feedback_incorrect" response and also does not code the correctresponse in the data section/ stimulusframes = [1 = fixation; 100 = override_fixation, instruction]/ inputdevice = keyboard/ validresponse = ("1", "2", "3")/ correctresponse = (list.correct_answers.currentvalue)/ responsemessage = (list.correct_answers.currentvalue, feedback_correct, 1500)/ responsetrial = ("2", task_70_advice)/ responsemessage = (list.incorrect_answers.currentvalue, feedback_incorrect, 1500)/ ontrialbegin = [  values.currentscenario = values.currentscenario + 1;]// if participants wanted to get advice (pressed 2 in the other trial), they can get advice here and choose again. However, it does not correctly code correct/incorrect either/ stimulusframes = [1 = override_fixation, instruction, advice_answer]/ inputdevice = keyboard/ validresponse = ("1", "3")/ responsemessage = (list.correct_answers.currentvalue, feedback_correct, 1500)/ responsemessage = (list.incorrect_answers.currentvalue, feedback_incorrect, 1500)// define blocks/ trials = [1 = practice]/ trials = [1-4 = sequence(task_70)]// define experiment/ blocks = [    1 = practice_task;    2 = task;]I don't see any need to use lists here at all. The simplest way to get this working properly based on what you have is this:// define correct answers (would be great to use this item element for easier customization)/ 1 = "1"/ 2 = "3"/ 3 = "1"/ 4 = "3"// define incorrect answers (would be great to use this item element for easier customization)/ 1 = "3"/ 2 = "1"/ 3 = "3"/ 4 = "1"// define texts/items = ("+")/ fontstyle = ("Arial", 5%, false, false, false, false, 5, 1)/ size = (30%, 30%)/ txbgcolor = white/ txcolor = black/ vjustify = center/ hjustify = center/ position = (50%, 50%)/items = ("Correct!")/ fontstyle = ("Arial", 5%, false, false, false, false, 5, 1)/ size = (30%, 30%)/ txbgcolor = white/ txcolor = black/ vjustify = center/ hjustify = center/ position = (50%, 50%)/ items = ("Incorrect!")/ fontstyle = ("Arial", 5%, false, false, false, false, 5, 1)/ size = (30%, 30%)/ txbgcolor = white/ txcolor = black/ vjustify = center/ hjustify = center/ position = (50%, 50%)// Ask participants to press either 1 or 3 on their keyboard, if they want help, they should press 2/ items = ("A (Press 1) or B (Press 3)? If you want support, press 2")/ fontstyle = ("Arial", 4%)/ position = (50%, 60%)/ txcolor = black/ txbgcolor = white// Override the fixation with a white screen/ shape = rectangle/ size = (30%, 30%)/ color = (255,255,255)/ vjustify = center/ hjustify = center/ position = (50%, 50%)// specify advice/1 = "Advice: 1"/2 = "Advice: 3"/3 = "Advice: 1"/4 = "Advice: 3"// provide advice/ items = advice_answer_text/ select = values.currentscenario/ fontstyle = ("Arial", 5%)/ position = (50%, 75%)/ size = (32%, 15%)/ vjustify = center/ hjustify = center/ txcolor = white/ txbgcolor = grey// define data to be recorded/ columns = (build, computer.platform, date, time, subject, group, session,blockcode, blocknum, trialcode, trialnum, values.incorrectanswer, values.correctanswer, responsetext, latency, correct)// define values/ currentscenario = 0/ correctanswer = " "/ incorrectanswer = " "// In this practice trial, I can define the correct answers. 1 is correct, 1 gives the "correct" Feedback and 3 gives the "incorrect" feedback. However, the correct response might change in other trials (to be B, so 3, for example)/ stimulusframes = [1 = fixation; 100 = override_fixation, instruction]/ inputdevice = keyboard/ validresponse = ("1", "2", "3")/ correctresponse = ("1")/ responsemessage = ("1", feedback_correct, 0)/ responsemessage = ("3", feedback_incorrect, 0)/ posttrialpause = 1500// this code works, but it does not give the "feedback_correct" or "feedback_incorrect" response and also does not code the correctresponse in the data section/ stimulusframes = [1 = fixation; 100 = override_fixation, instruction]/ inputdevice = keyboard/ validresponse = ("1", "2", "3")/ correctresponse = (values.correctanswer) // correct answer is pressing the correct key as stored in values.correctanswer/ responsemessage = (values.correctanswer, feedback_correct, 1500) // give correct feedback/ responsetrial = ("2", task_70_advice)/ responsemessage = (values.incorrectanswer, feedback_incorrect, 1500) // give error feedback/ ontrialbegin = [ values.currentscenario = values.currentscenario + 1; // store correct key for the current scenario in a variable values.correctanswer = item.item_correct_answers.item(values.currentscenario); // store incorrect key for the current scenario in a variable values.incorrectanswer = item.item_incorrect_answers.item(values.currentscenario);]// if participants wanted to get advice (pressed 2 in the other trial), they can get advice here and choose again. However, it does not correctly code correct/incorrect either/ stimulusframes = [1 = override_fixation, instruction, advice_answer]/ inputdevice = keyboard/ validresponse = ("1", "3")/ responsemessage = (values.correctanswer, feedback_correct, 1500) // give correct feedback/ responsemessage = (values.incorrectanswer, feedback_incorrect, 1500) // give error feedback// define blocks/ trials = [1 = practice]/ trials = [1-4 = sequence(task_70)]// define experiment/ blocks = [ 1 = practice_task; 2 = task;] L123          Group: Forum Members Posts: 4, Visits: 10 Works perfectly! Thank you so much!

#### Merge Selected

Merge into selected topic...

Merge into merge target...

Merge into a specific topic ID...