PennController for IBEX › Forums › Support › varying word presentation depending on length
Tagged: DashedSentence, RSVP, timing
- This topic has 2 replies, 2 voices, and was last updated 3 years, 10 months ago by yanaib.
-
AuthorPosts
-
November 23, 2020 at 6:01 am #6375yanaibParticipant
Hi,
I can’t quite figure out how to add varying word presentation time to dashedsentence (in speeded acceptability mode). I would like to display every word up to 12 characters long for 250ms, and then add 20 extra ms for every character over 12, i.e. a word of 14 characters will be displayed for 290ms.
I’ve added the following to the wordPauseTimeout() function (line 152, I think).:
if (t.words[t.currentWord].length > 12) {
var extraTime = (t.words[t.currentWord].length – 12) * 20;
t.wordTime = t.wordTime + extraTime;
}Judging from console.log, it looks like it’s at least executed at the right time, but this updated controller breaks the word-by-word presentation: the whole sentence is presented, and then a few first words are removed left to right one by one. I’m not sure exactly what I’m getting wrong, and I’m especially confused as to why this disrupts word-by-word presentation: I wrote an if statememnt specifically to isolate it from the rest of the code so that it at least doesn’t break it if it fails to work.
I would appreciate any help!
Many thanks
Yana
November 23, 2020 at 12:39 pm #6377JeremyKeymasterHi Yana,
I think you’re doing the right thing inserting your code in the wordPauseTimeout function, but when I open the js file I see that line 152 is part of the wordTimeout function, so I just want to make sure you’re editing the right function.
However I’m afraid that directly modifying t.wordTime will cause problems after encountering the first over-12-character word, because the subsequent words will inherit the extra duration. Here is how I rewrote the whole if statement, and it seems to be working smoothly:
if (this.mode == "speeded acceptability") { var t = this; function wordTimeout() { t.blankWord(t.currentWord); ++(t.currentWord); if (t.currentWord >= t.stoppingPoint) t.finishedCallback([[["Sentence (or sentence MD5)", t.sentenceDesc]]]); else t.utils.setTimeout(wordPauseTimeout, t.wordPauseTime); } function wordPauseTimeout() { t.showWord(t.currentWord); t.utils.clearTimeout(wordPauseTimeout); let duration = t.wordTime; if (t.words[t.currentWord].length > 12) { var extraTime = (t.words[t.currentWord].length - 12) * 200; duration += extraTime; } t.utils.setTimeout(wordTimeout, duration); } wordPauseTimeout(); }
I used 200 so I could clearly tell when the extra time was added to the normal display time. For reference, here are the parameters I used to test the DashedSentence:
{ s: "Extralongitudinal is not a word that makes much anticonstitutional sense", wordTime: 250, mode: "speeded acceptability" }
Jeremy
November 23, 2020 at 3:48 pm #6378yanaibParticipantThanks a lot for the explanation and your solution, this works seamlessly!
Yana
-
AuthorPosts
- You must be logged in to reply to this topic.