PennController for IBEX › Forums › Support › conditions in self-paced reading experiment › Reply To: conditions in self-paced reading experiment
Hi,
There are a few things that cause your script to crash:
- Elements should not be created by nesting them, ie. this is not valid syntax: newText((newScale. Either you create a Text element (if you just want to show a sentence or a paragraph on the screen) or you create a Scale element (if you want to provide participants with one). If you want to show both elements on the same line, one before the other, that’s what the before and after commands are for (you can use new* or get* commands inside the parentheses of non-new/get* commands).
- All new* commands follow the same syntactic rules, in particular, they all require to be immediately followed by a pair of parentheses in which you (optionally) pass parameters. The first occurrence of newScale in your script comes with no such pair of parentheses, but the second occurrence does.
- Besides a first optional name parameter, the parameter(s) of newScale can have two possible formats (as described on the documentation): either you use a single number that specifies the number of points on your scale, or you give a series of strings (separated by commas) that correspond to the labels of your scale’s buttons. So either something like newScale("yesno", "Yes", "No") or something like newScale("correctness", 5).
- The script will execute the lines in newTrial from the top down, and will only halt on wait commands. Since your script has no wait command, it will execute all the lines in an instant and immediately reach the closing parenthesis of newTrial, effectively ending your trial milliseconds after it started. You want to insert a wait command somewhere.
I am not totally sure what exactly you want your script to do, but below is a working variant of it. Note that I took the liberty to get rid of the .settings prefixes that became deprecated with PennController 1.7, and that the Text element named DashedSentence is just that: a Text element, so the content of row.DS will be printed at once. If you want to use the native-Ibex DashedSentence controller, you can use newController("DashedSentence", {s: row.DS}).print().wait() (you can take a look at the Controller element documentation page and this topic in the FAQ/Tips section).
Template(row => newTrial( newText(row.sentence) .print() , newText("DashedSentence", row.DS) .print() , newScale("yesnocorrect", "Yes","No" ) .labelsPosition("right") .keys() .before( newText("Is the sentence correct?") ) .print() , newText("How correct would you say it is?") .print() , newScale("correct", 5) .keys() .before(newText("completely incorrect")) .after(newText("completely correct")) .print() .wait() ) )
If you haven’t done so yet (or if you want a refresher) I strongly recommend that you read the tutorial. You can also watch this video of a webinar on this tutorial that we recorded just yesterday.
Best,
Jeremy