Conditional Branching - incorrect answer goes back to instructions page


Author
Message
liznik
liznik
Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)
Group: Forum Members
Posts: 7, Visits: 43
Completely new to programming, and I'm not sure what I am doing wrong at this point, I have tried to rearrange everything. What I want to happen: The participant learns the values of each picture (eg -10 points, 10 points etc) in the instructions page. (which would have the text there but i didnt bother to enter it). They will then be quizzed on the picture, and if they don't type in the right answer they will have to go back to the instructions page. The learning phase will only end if they get all the stimuli correct. I cannot get them to back to the instructions page if they get something wrong 
I have also added/taken away this attribute for the openended elements. But i'm not sure if it matters/is important for the end results 
/validresponse = ("-10", "10", "-20", "20")


<page instructions>
/1 = "text"
</page>

<trial instructions>
/ stimulusframes = [1=instructions]
/ validresponse = (" ")
/ recorddata = false
</trial>

<openended gain20house>
/stimulusframes = [1=gain20house]
/position = (50,50)
/correctresponse = ("20")
/branch = [
if (openended.gain20house.response !=("20")) trial.instructions
]
</openended>

<openended lose10animal>
/stimulusframes = [1=lose10animal]
/position = (50,50)
/correctresponse = ("-10")
/branch = [
if (openended.lose10animal.response !=("-10")) trial.instructions
]
</openended>

<openended lose20place>
/stimulusframes = [1=lose20place]
/position = (50,50)
/correctresponse = ("-20")
/branch = [
if (openended.lose20place.response !=("-20")) trial.instructions
]
</openended>

<openended gain10object>
/stimulusframes = [1=gain10object]
/position = (50,50)
/correctresponse = ("10")
/branch = [
if (openended.gain10object.response !=("10")) trial.instructions
]
</openended>
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
<openended gain20house>
/stimulusframes = [1=gain20house]
/position = (50,50)
/correctresponse = ("20")
/branch = [
if (openended.gain20house.response !=("20")) trial.instructions
]

</openended>

needs to read

<openended gain20house>
/stimulusframes = [1=gain20house]
/position = (50,50)
/ validresponse = (anyresponse)
/ mask = integer
/correctresponse = ("20")
/branch = [
if (openended.gain20house.response !="20") trial.instructions
]

</openended>

i.e., not extra parentheses around "20". (Same for the /branch syntax in the other <openended> elements).

As for the rest, I can't say much because the description "They will then be quizzed on the picture, and if they don't type in the right answer they will have to go back to the instructions page. The learning phase will only end if they get all the stimuli correct." can be interpreted in a number of different ways.
Do you want them to get all questions correct in one go (i.e., complete a flawless run-through of all 4 questions)?
Or do you want to successively eliminate questions that were answered correctly? I.e., participant gets 1st question correct, gets 2nd question wrong, goes back to instructions. Moving on from there, s/he only gets questions 2, 3 and 4 (because question 1 was already answered correctly in the 1st try).

Edited 8 Years Ago by Dave
liznik
liznik
Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)
Group: Forum Members
Posts: 7, Visits: 43
Thank you, 

I have the instructions I want to use, just didn't bother adding it in there since I thought it wasn't necessary). We want the participants to answer the questions all correctly in one go. (They are to memorize the values of each stimuli in the instructions and be tested on it through the questions). If they get any of the 4 questions wrong they will have to redo all 4 until all 4 are correct in one go. Once they are able to get all 4 correct at once they can go into the testing phase otherwise I want it to keep looping back to in the instructions. 
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
Ah, then you probably don't want to work with branching at the <openended>-level at all. Instead, I'd use a /stop attribute in the <block> to terminate it upon error, and repeat the <block> with a /branch at the <block> level in that case. In essence:

<expt>
/ blocks = [1=practice; 2=test]
</expt>

<block practice>
/ stop = [block.practice.error]
/ branch = [if (block.practice.error) block.practice]
/ preinstructions = (practice_instructions)
/ trials = [1-4 = noreplace(a,b,c,d)]
</block>

<block test>
/ preinstructions = (test_instructions)
</block>

<page practice_instructions>
^practice instructions here
</page>

<page test_instructions>
^you have completed practice & reached the test phase
</page>

<trial a>
/ stimulusframes = [1=debug]
/ validresponse = ("a", "b", "c", "d")
/ correctresponse = ("a")
</trial>

<trial b>
/ stimulusframes = [1=debug]
/ validresponse = ("a", "b", "c", "d")
/ correctresponse = ("b")
</trial>

<trial c>
/ stimulusframes = [1=debug]
/ validresponse = ("a", "b", "c", "d")
/ correctresponse = ("c")
</trial>

<trial d>
/ stimulusframes = [1=debug]
/ validresponse = ("a", "b", "c", "d")
/ correctresponse = ("d")
</trial>

<text debug>
/ items = ("The correct response is <%script.currenttrial%>")
</text>

Hope this helps.

chenxyu
chenxyu
Associate Member (216 reputation)Associate Member (216 reputation)Associate Member (216 reputation)Associate Member (216 reputation)Associate Member (216 reputation)Associate Member (216 reputation)Associate Member (216 reputation)Associate Member (216 reputation)Associate Member (216 reputation)
Group: Forum Members
Posts: 18, Visits: 252
Dave - 10/27/2016
Ah, then you probably don't want to work with branching at the <openended>-level at all. Instead, I'd use a /stop attribute in the <block> to terminate it upon error, and repeat the <block> with a /branch at the <block> level in that case. In essence:

<expt>
/ blocks = [1=practice; 2=test]
</expt>

<block practice>
/ stop = [block.practice.error]
/ branch = [if (block.practice.error) block.practice]
/ preinstructions = (practice_instructions)
/ trials = [1-4 = noreplace(a,b,c,d)]
</block>

<block test>
/ preinstructions = (test_instructions)
</block>

<page practice_instructions>
^practice instructions here
</page>

<page test_instructions>
^you have completed practice & reached the test phase
</page>

<trial a>
/ stimulusframes = [1=debug]
/ validresponse = ("a", "b", "c", "d")
/ correctresponse = ("a")
</trial>

<trial b>
/ stimulusframes = [1=debug]
/ validresponse = ("a", "b", "c", "d")
/ correctresponse = ("b")
</trial>

<trial c>
/ stimulusframes = [1=debug]
/ validresponse = ("a", "b", "c", "d")
/ correctresponse = ("c")
</trial>

<trial d>
/ stimulusframes = [1=debug]
/ validresponse = ("a", "b", "c", "d")
/ correctresponse = ("d")
</trial>

<text debug>
/ items = ("The correct response is <%script.currenttrial%>")
</text>

Hope this helps.

Hi Dave,
What would you recommend if I do not want participants to start over if they answered only one question incorrectly? Specifically, they don't have to answer all questions correctly in one go, rather I want to direct them to a previous surveypage (where the instructions are embedded) if they answered one question incorrectly and then give them another chance to answer the same question until they are correct. I guess, what I'm really asking is how to branch to the instruction surveypage AND the question surveypage so they get to see the instructions and have another chance to answer the question.

I hope my questions make sense. Attached below is part of my script. With the current setup, it only branches to the instruction page, but I want it to also branch to the question.

Thank you for your time!

<textbox GroceryShoppingListTest1>
/ caption = "What is the first item on your shopping list?"
/correctresponse = ("sushi")
/validresponse=(anyresponse)
/multiline = false
/position = (10, 30)
/required = true
/ txcolor = black
</textbox>

<surveypage GroceryShoppingListTest1>
/ questions = [1=GroceryShoppingListTest1]
/ fontstyle = ("Arial", 4.5%, false, false, false, false, 5, 1)
/itemfontstyle = ("Arial", 3.5%, false, false, false, false, 5, 1)
/responsefontstyle = ("Arial", 2%, false, false, false, false, 5, 1)
/ orientation = horizontal
/ showpagenumbers = false
/ showbackbutton = false
/ showquestionnumbers = false
/ branch = [ if (textbox.GroceryShoppingListTest1 !="sushi") surveypage.GroceryShoppinglist] 
</surveypage>


Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
chenxyu - 5/16/2022

Hi Dave,
What would you recommend if I do not want participants to start over if they answered only one question incorrectly? Specifically, they don't have to answer all questions correctly in one go, rather I want to direct them to a previous surveypage (where the instructions are embedded) if they answered one question incorrectly and then give them another chance to answer the same question until they are correct. I guess, what I'm really asking is how to branch to the instruction surveypage AND the question surveypage so they get to see the instructions and have another chance to answer the question.

I hope my questions make sense. Attached below is part of my script. With the current setup, it only branches to the instruction page, but I want it to also branch to the question.

Thank you for your time!

<textbox GroceryShoppingListTest1>
/ caption = "What is the first item on your shopping list?"
/correctresponse = ("sushi")
/validresponse=(anyresponse)
/multiline = false
/position = (10, 30)
/required = true
/ txcolor = black
</textbox>

<surveypage GroceryShoppingListTest1>
/ questions = [1=GroceryShoppingListTest1]
/ fontstyle = ("Arial", 4.5%, false, false, false, false, 5, 1)
/itemfontstyle = ("Arial", 3.5%, false, false, false, false, 5, 1)
/responsefontstyle = ("Arial", 2%, false, false, false, false, 5, 1)
/ orientation = horizontal
/ showpagenumbers = false
/ showbackbutton = false
/ showquestionnumbers = false
/ branch = [ if (textbox.GroceryShoppingListTest1 !="sushi") surveypage.GroceryShoppinglist] 
</surveypage>


I can't answer that question based on an isolated, incomplete code snippet.

chenxyu
chenxyu
Associate Member (216 reputation)Associate Member (216 reputation)Associate Member (216 reputation)Associate Member (216 reputation)Associate Member (216 reputation)Associate Member (216 reputation)Associate Member (216 reputation)Associate Member (216 reputation)Associate Member (216 reputation)
Group: Forum Members
Posts: 18, Visits: 252
Dave - 5/16/2022
chenxyu - 5/16/2022

Hi Dave,
What would you recommend if I do not want participants to start over if they answered only one question incorrectly? Specifically, they don't have to answer all questions correctly in one go, rather I want to direct them to a previous surveypage (where the instructions are embedded) if they answered one question incorrectly and then give them another chance to answer the same question until they are correct. I guess, what I'm really asking is how to branch to the instruction surveypage AND the question surveypage so they get to see the instructions and have another chance to answer the question.

I hope my questions make sense. Attached below is part of my script. With the current setup, it only branches to the instruction page, but I want it to also branch to the question.

Thank you for your time!

<textbox GroceryShoppingListTest1>
/ caption = "What is the first item on your shopping list?"
/correctresponse = ("sushi")
/validresponse=(anyresponse)
/multiline = false
/position = (10, 30)
/required = true
/ txcolor = black
</textbox>

<surveypage GroceryShoppingListTest1>
/ questions = [1=GroceryShoppingListTest1]
/ fontstyle = ("Arial", 4.5%, false, false, false, false, 5, 1)
/itemfontstyle = ("Arial", 3.5%, false, false, false, false, 5, 1)
/responsefontstyle = ("Arial", 2%, false, false, false, false, 5, 1)
/ orientation = horizontal
/ showpagenumbers = false
/ showbackbutton = false
/ showquestionnumbers = false
/ branch = [ if (textbox.GroceryShoppingListTest1 !="sushi") surveypage.GroceryShoppinglist] 
</surveypage>


I can't answer that question based on an isolated, incomplete code snippet.

Sorry. My script might be a complete mess, but here is what I really want to do: Event 1: participants will see some general instructions; Event 2: participants will see a shopping list; Event 3: they will be tested on the list. Then, if they recall all items from the list correctly, they move on to the next phase. If not, they will go back to Event 2 and Event 3 to restudy and be tested again. My question is how can I accomplish this using /branch?

Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
chenxyu - 5/16/2022
Dave - 5/16/2022
chenxyu - 5/16/2022

Hi Dave,
What would you recommend if I do not want participants to start over if they answered only one question incorrectly? Specifically, they don't have to answer all questions correctly in one go, rather I want to direct them to a previous surveypage (where the instructions are embedded) if they answered one question incorrectly and then give them another chance to answer the same question until they are correct. I guess, what I'm really asking is how to branch to the instruction surveypage AND the question surveypage so they get to see the instructions and have another chance to answer the question.

I hope my questions make sense. Attached below is part of my script. With the current setup, it only branches to the instruction page, but I want it to also branch to the question.

Thank you for your time!

<textbox GroceryShoppingListTest1>
/ caption = "What is the first item on your shopping list?"
/correctresponse = ("sushi")
/validresponse=(anyresponse)
/multiline = false
/position = (10, 30)
/required = true
/ txcolor = black
</textbox>

<surveypage GroceryShoppingListTest1>
/ questions = [1=GroceryShoppingListTest1]
/ fontstyle = ("Arial", 4.5%, false, false, false, false, 5, 1)
/itemfontstyle = ("Arial", 3.5%, false, false, false, false, 5, 1)
/responsefontstyle = ("Arial", 2%, false, false, false, false, 5, 1)
/ orientation = horizontal
/ showpagenumbers = false
/ showbackbutton = false
/ showquestionnumbers = false
/ branch = [ if (textbox.GroceryShoppingListTest1 !="sushi") surveypage.GroceryShoppinglist] 
</surveypage>


I can't answer that question based on an isolated, incomplete code snippet.

Sorry. My script might be a complete mess, but here is what I really want to do: Event 1: participants will see some general instructions; Event 2: participants will see a shopping list; Event 3: they will be tested on the list. Then, if they recall all items from the list correctly, they move on to the next phase. If not, they will go back to Event 2 and Event 3 to restudy and be tested again. My question is how can I accomplish this using /branch?

Are they to be restested on the *entire* list ("Event 3") as you state now or only on the items they got wrong as you suggested earlier (" [...] if they answered one question incorrectly and then give them another chance to answer the same question until they are correct.")? These are obviously not the same, so please be precise.

Further, if you won't provide your actual code, I don't know how to help you. So maybe clean things up or at least provide a stripped down version that shows what you are actually doing

chenxyu
chenxyu
Associate Member (216 reputation)Associate Member (216 reputation)Associate Member (216 reputation)Associate Member (216 reputation)Associate Member (216 reputation)Associate Member (216 reputation)Associate Member (216 reputation)Associate Member (216 reputation)Associate Member (216 reputation)
Group: Forum Members
Posts: 18, Visits: 252
They will not be retested for the entire list. For instance, if one person answers the first three questions right but the last one wrong, they will not have to start from question one after viewing the list again. There are four <textbox> questions on <surveypages>. Please see below.

Thank you so much for your help!


<textbox GroceryShoppingListTest1>
/ caption = "What is the first item on your shopping list?"
/correctresponse = ("sushi")
/validresponse=(anyresponse)
/multiline = false
/position = (10, 30)
/required = true
/ txcolor = black
</textbox>

<textbox GroceryShoppingListTest2>
/ caption = "What is the second item on your shopping list?"
/correctresponse = ("coffee")
/validresponse=(anyresponse)
/multiline = false
/position = (10, 30)
/required = true
/ txcolor = black
</textbox>

<textbox GroceryShoppingListTest3>
/ caption = "What is the third item on your shopping list?"
/correctresponse = ("detergent")
/validresponse=(anyresponse)
/multiline = false
/position = (10, 30)
/required = true
/ txcolor = black
</textbox>

<textbox GroceryShoppingListTest4>
/ caption = "What is the fourth item on your shopping list?"
/correctresponse = ("peanut butter")
/validresponse=(anyresponse)
/multiline = false
/position = (10, 30)
/required = true
/ txcolor = black
</textbox>

<surveypage GroceryShoppingListTest1>
/ questions = [1=GroceryShoppingListTest1]
/ fontstyle = ("Arial", 4.5%, false, false, false, false, 5, 1)
/itemfontstyle = ("Arial", 3.5%, false, false, false, false, 5, 1)
/responsefontstyle = ("Arial", 2%, false, false, false, false, 5, 1)
/ orientation = horizontal
/ showpagenumbers = false
/ showbackbutton = false       
/ showquestionnumbers = false  
/branch= [if (textbox.GroceryShoppingListTest1.response != "sushi") surveypage.GroceryShoppingList]  
</surveypage>

<surveypage GroceryShoppingListTest2>
/ questions = [1=GroceryShoppingListTest2]
/ fontstyle = ("Arial", 4.5%, false, false, false, false, 5, 1)
/itemfontstyle = ("Arial", 3.5%, false, false, false, false, 5, 1)
/responsefontstyle = ("Arial", 2%, false, false, false, false, 5, 1)
/ orientation = horizontal
/ showpagenumbers = false
/ showbackbutton = false
/ showquestionnumbers = false
[if (textbox.GroceryShoppingListTest2.response != "coffee") surveypage.GroceryShoppingList]
</surveypage>

<surveypage GroceryShoppingListTest3>
/ questions = [1=GroceryShoppingListTest3]
/ fontstyle = ("Arial", 4.5%, false, false, false, false, 5, 1)
/itemfontstyle = ("Arial", 3.5%, false, false, false, false, 5, 1)
/responsefontstyle = ("Arial", 2%, false, false, false, false, 5, 1)
/ orientation = horizontal
/ showpagenumbers = false
/ showbackbutton = false
/ showquestionnumbers = false
[if (textbox.GroceryShoppingListTest3.response != "detergent") surveypage.GroceryShoppingList]
</surveypage>

<surveypage GroceryShoppingListTest4>
/ questions = [1=GroceryShoppingListTest4]
/ fontstyle = ("Arial", 4.5%, false, false, false, false, 5, 1)
/itemfontstyle = ("Arial", 3.5%, false, false, false, false, 5, 1)
/responsefontstyle = ("Arial", 2%, false, false, false, false, 5, 1)
/ orientation = horizontal
/ showpagenumbers = false
/ showbackbutton = false
/ showquestionnumbers = false
[if (textbox.GroceryShoppingListTest4.response != "peanut butter") surveypage.GroceryShoppingList]
</surveypage>
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
chenxyu - 5/16/2022
They will not be retested for the entire list. For instance, if one person answers the first three questions right but the last one wrong, they will not have to start from question one after viewing the list again. There are four <textbox> questions on <surveypages>. Please see below.

Thank you so much for your help!


<textbox GroceryShoppingListTest1>
/ caption = "What is the first item on your shopping list?"
/correctresponse = ("sushi")
/validresponse=(anyresponse)
/multiline = false
/position = (10, 30)
/required = true
/ txcolor = black
</textbox>

<textbox GroceryShoppingListTest2>
/ caption = "What is the second item on your shopping list?"
/correctresponse = ("coffee")
/validresponse=(anyresponse)
/multiline = false
/position = (10, 30)
/required = true
/ txcolor = black
</textbox>

<textbox GroceryShoppingListTest3>
/ caption = "What is the third item on your shopping list?"
/correctresponse = ("detergent")
/validresponse=(anyresponse)
/multiline = false
/position = (10, 30)
/required = true
/ txcolor = black
</textbox>

<textbox GroceryShoppingListTest4>
/ caption = "What is the fourth item on your shopping list?"
/correctresponse = ("peanut butter")
/validresponse=(anyresponse)
/multiline = false
/position = (10, 30)
/required = true
/ txcolor = black
</textbox>

<surveypage GroceryShoppingListTest1>
/ questions = [1=GroceryShoppingListTest1]
/ fontstyle = ("Arial", 4.5%, false, false, false, false, 5, 1)
/itemfontstyle = ("Arial", 3.5%, false, false, false, false, 5, 1)
/responsefontstyle = ("Arial", 2%, false, false, false, false, 5, 1)
/ orientation = horizontal
/ showpagenumbers = false
/ showbackbutton = false       
/ showquestionnumbers = false  
/branch= [if (textbox.GroceryShoppingListTest1.response != "sushi") surveypage.GroceryShoppingList]  
</surveypage>

<surveypage GroceryShoppingListTest2>
/ questions = [1=GroceryShoppingListTest2]
/ fontstyle = ("Arial", 4.5%, false, false, false, false, 5, 1)
/itemfontstyle = ("Arial", 3.5%, false, false, false, false, 5, 1)
/responsefontstyle = ("Arial", 2%, false, false, false, false, 5, 1)
/ orientation = horizontal
/ showpagenumbers = false
/ showbackbutton = false
/ showquestionnumbers = false
[if (textbox.GroceryShoppingListTest2.response != "coffee") surveypage.GroceryShoppingList]
</surveypage>

<surveypage GroceryShoppingListTest3>
/ questions = [1=GroceryShoppingListTest3]
/ fontstyle = ("Arial", 4.5%, false, false, false, false, 5, 1)
/itemfontstyle = ("Arial", 3.5%, false, false, false, false, 5, 1)
/responsefontstyle = ("Arial", 2%, false, false, false, false, 5, 1)
/ orientation = horizontal
/ showpagenumbers = false
/ showbackbutton = false
/ showquestionnumbers = false
[if (textbox.GroceryShoppingListTest3.response != "detergent") surveypage.GroceryShoppingList]
</surveypage>

<surveypage GroceryShoppingListTest4>
/ questions = [1=GroceryShoppingListTest4]
/ fontstyle = ("Arial", 4.5%, false, false, false, false, 5, 1)
/itemfontstyle = ("Arial", 3.5%, false, false, false, false, 5, 1)
/responsefontstyle = ("Arial", 2%, false, false, false, false, 5, 1)
/ orientation = horizontal
/ showpagenumbers = false
/ showbackbutton = false
/ showquestionnumbers = false
[if (textbox.GroceryShoppingListTest4.response != "peanut butter") surveypage.GroceryShoppingList]
</surveypage>

Look, four surveypages tell me nothing -- how are these actually run? In a block? In a survey? Selected randomly? Sequentially?

Please provide something that can actually be run and accurately conveys your actual setup. Thanks.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search