Reply To: Comprehension Questions and Fillers

PennController for IBEX Forums Support Comprehension Questions and Fillers Reply To: Comprehension Questions and Fillers

#5679
Jeremy
Keymaster

Hi,

Right now, your code looks up every row from your table and for every single one of them, it outputs one corresponding trial presenting the value of the Description column onto the page, waiting for a keypress on the spacebar, and showing the values of the answer1 and answer2 column, waiting for a click on one of them. Once a click happens, it goes to the next trial, ie. the next row, and it does all of this all over again. This is how the Template command works.

From the description of your problem, I am guessing that you split each of your items across several rows in your table, and that you want each row’s Description corresponding to the same item to appear on the screen one at a time, moving on to the next one by pressing the spacebar. Then you want to show the Question(s?) along with answer1 and answer2. Did I get it right?

If what I described is what you want to do, you need to use the Controller element, using DashedSentence with the option display set to "in place"—you’d also need to make sure your table has the right format. Here is an example of how to implement what I described, adding the subtlety of optional questions:

AddTable("myTable", `Item,Sentence,Question,answer1,answer2
1,This_is_region1_of_item1 and_this_is_region2_of_item1,Question for item 1,Answer1 for item1,Answer2 for item1
2,This_is_region1_of_item2 and_this_is_region2_of_item2,,,
3,This_is_region1_of_item3 and_this_is_region2_of_item3,Question for item 3,Answer1 for item3,Answer2 for item3`)

Template( variable => 
  newTrial( "experiment" ,
    newController("DashedSentence", {s: variable.Sentence, display: "in place", hideUnderscores: true})
        .print()
        .log()
        .wait()
        .remove()
    ,
    ( variable.Question ? [
       newText( variable.Question ).print()
       ,
       newText( "answer1" , variable.answer1 ).print() ,
       newText( "answer2" , variable.answer2 ).print() 
       ,
       newSelector("answer").add( getText("answer1") , getText("answer2") ).log().wait()
    ] : [
        null
    ])
  )
  .log( "Item"   , variable.Item   )
)

Jeremy