Resources not loading with attention checks

PennController for IBEX Forums Support Resources not loading with attention checks

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #9953
    grachek
    Participant

    Hello! I’m creating a task that asks participants what they know about a language using images and pictures. The design is sort of like a lexical decision task, except that participants see an image with the audio for a word presented and then have to decide if the word matches the picture.

    I’m trying to add two different kinds of attention checks to the experiment: one with images (“did you see this image on the previous screen?”), and the other with audio (“did you hear this word on the previous screen?”). These should only appear after specific trials which I indicated in my conditions file – columns without attention checks are blank, those with attention checks have an image or audio file listed.

    The issue is that all the resources for the task run fine until I add the attention check code to the experiment. Once the attention checks are added, the experiment then has to stop and load resources after every trial (without the attention checks it doesn’t do this). Have I done something in the attention check code that is causing this issue? This is the code I’m using for the attention check with words (image one also looks similar):

             newVar("attChWord", row.attentionCheckWord)
             ,
             getVar("attChWord")
                 .test.is("")
                  .failure(
                     newAudio("attentionCheckWord", row.attentionCheckWord)
                         .play()
                         .log()
                     ,
                      newText("Did you hear this word on the previous screen?")
                          .print("center")
                      ,
                       newText("Yes (F)")
                          .print("center at 35vw", "middle at 60vh")
                      ,
                       newText("No (J)")
                          .print("center at 65vw", "middle at 60vh")
                      ,
                       newKey("AttChAnswerW", "FJ")
                          .log()
                          .wait()
                     )
                 .success()
    
    #9955
    Jeremy
    Keymaster

    Hi,

    Use the javascript ternary conditional operator instead of a PennController Var element so that you don’t create an Audio element for rows that miss a valid value in the attentionCheckWord cell:

    ...(row.attentionCheckWord ? [
        newAudio("attentionCheckWord", row.attentionCheckWord)
            .play()
            .log()
        ,
        newText("Did you hear this word on the previous screen?")
            .print("center")
        ,
        newText("Yes (F)")
            .print("center at 35vw", "middle at 60vh")
        ,
        newText("No (J)")
            .print("center at 65vw", "middle at 60vh")
        ,
        newKey("AttChAnswerW", "FJ")
            .log()
            .wait()
    ] : [])

    Jeremy

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.