Reply To: Timers

PennController for IBEX Forums Support Timers Reply To: Timers

#7329
Jeremy
Keymaster

You get this error message because you are attempting to close the content of newTrial( twice:

    ,
    // Wait 1s before moving to the next trial
    newTimer(6000).start().wait()
  )
  .log( "word"    , row.Word       ) // Append the value of 'Word' at the end of the results lines

    newTimer(2000).start().wait()
  )
  .log( "transition"    , row.Transition      ) // Append the value of 'Word' at the end of the results lines
)

The first lone ) in this code matches the ( of the newTrial( above in your code. The next .log line applies to that newTrial(...) object whose content was just closed with the preceding ). However, on the next line, you are trying to add yet another newTimer element, even though that line is no longer placed inside the parentheses of a newTrial: that does not make sense to the script, which for all it knows is inside the parentheses of Template, but is done with the newTrial(...) it has already processed at that point. Because newTrial has already been closed, the next lone ) matches the remaining open (, which is the one from the Template( above in your code. Accordingly, the last .log command applies to that Template(...) object, but there is no log command on such objects, only on newTrial(...) objects (and on trial-internal elements, but they have a different meaning). Finally, the very last lone ) matches nothing, because at that point in your script there’s no open ( left

You can see short error messages about those issues in the text editor on your project’s page, if you move your cursor over the red X icons that appear to the left of the line numbers

What you probably want is this:

Template("Word Pair List .csv" , row =>
  newTrial( "experimental-trial" ,
    defaultText.center()            // Horizontally center all Text elements automatically
    ,
    newText("word", row.Word)       // Show the text from the 'Word' column
        .css("font-size", "24pt")   // Increase the font size
        .log()                      // Reports when the Text is displayed in the results file
        .print()
    ,
    newTimer(6000).start().wait()   // Give 6s to read the word
    ,
    getTex("word").remove()         // Take the word off the page
    ,
    newTimer(2000).start().wait()   // Wait 2s on the empty page
  )
  .log( "word"        , row.Word       ) // Append the value of 'Word' at the end of the results lines
  .log( "transition"  , row.Transition ) // Append the value of 'Transition' at the end of the results lines
)

Let me know if you have questions

Jeremy