Is there a way to count words in openended while subjects are writing and using the count as a condition for ending the trial? More concretely, I want to modify the Picture Story Exercise module posted on the Inquisit website so that participants have to write a minimum of 100 words for each openenden iteam before they can move on to the next trail.
You'll want to use /isvalidresponse along with a bunch of (recursive*) <expressions>. Not easy to do, but should be possible. (I'd recommend counting the number of spaces.) Using the number of characters as criterion would be considerably easier (/range attribute or use the length() function).
*cf. the Self-Paced Reading script available from the Task Library.
And just for fun here's a little word-counting algorithm that doesn't require any recursion:
<values>/ mysentence = "The quick brown fox jumps over the lazy dog."</values><expressions>/ nwords = length(values.mysentence)-length(replaceall(values.mysentence," ",""))+1</expressions><text mytext>/ items = ("The sentence ~"<%values.mysentence%>~" contains <%expressions.nwords%> words.")</text>