displaying a cropped word after manipulating that word's presentation time

12 views
Skip to first unread message

yana.ar...@gmail.com

unread,
Jun 10, 2021, 5:21:07 AM6/10/21
to ibexexperiments
Hi All, 

I'm trying to get my critical words to appear for a different time than all other words in a sentence. My solution so far is to add # before every critical word in the stimuli set, and  set the timing for that word in the wordPauseTimeout function in DashedSentence. 

So, my stimuli look something like this:

    [["practice1",1], "DashedSentence", {s: "Word word word #critical and another #critical"},"Question", {q:"Question? ", as: ["target","word"]}],


wordPauseTimeout function to display targets for 3000ms: 

            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].substring(0,1) == "#") {
                        duration = 3000;
                    }
                    t.utils.setTimeout(wordTimeout, duration);
                }
                wordPauseTimeout();


What I can't figure out though is how to get rid of the # for the actual word presentation? I tried putting an if statement that crops and presents currentWord in various places in DashedSentence, but it either ends up not cropping them, or cropping them before wordPauseTimeout manipulates the timing, so critical words end up not being presented for 3000ms. Any pointers would be appreciated! 

Jeremy Zehr

unread,
Jun 10, 2021, 11:18:48 AM6/10/21
to ibexexperiments
Hi,

You can try replacing line 127 (.text(this.words[j]));) with:
.text(this.words[j].replace(/^#/,'')));

and line 271 (this.wordSpan.text(this.words[this.currentWord]);) with:
this.wordSpan.text(this.words[this.currentWord].replace(/^#/,''));

yana.ar...@gmail.com

unread,
Jun 11, 2021, 4:26:26 AM6/11/21
to ibexexperiments
This works! Thanks a lot
Reply all
Reply to author
Forward
0 new messages