Tooltips Displaying in a Contingent and Undesireable Manner

PennController for IBEX Forums Support Tooltips Displaying in a Contingent and Undesireable Manner

Tagged: 

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #11134
    jkesan
    Participant

    Dear Jeremy and others,

    My issue is within the function defined as runexperiment. I need a tooltip to display whenever participants take more than 10 seconds to click on an image. There is a second tooltip in play to warn participants that they provided the wrong answer. The incorrect answer tooltip operates correctly and independently of the slowclick warning tooltip. The essential problem is that the slowclick warning tooltip only displays if the participant has responded incorrectly, in addition to responding too slowly. The fact that incorrect is only checked when checks=1 is intentional.

    Thanks,
    jkesan

    https://farm.pcibex.net/r/wGMBWa/

    newTrial(“initVars”,
    newVar(“incorrectCount”).global().set(0),
    newVar(“timeout”).global().set(0),
    );

    const runExperiment = (LP,MP,RP,topL,botL,topM,botM,topR,botR,soundfile,correct,checks,onsetToPronoun,begOfCritical,endOfCritical) => [
    // This section lets you change location of the pictures when they are displayed
    newCanvas(“images”, 1200, 600) // 600px height: we will print the button at the bottom
    .color(“white”) // Use a white background
    .add( “center at 25%” , “center at 25%” , newImage(“p1”, LP + “.png” ).size(250) )
    .add( “center at 50%” , “center at 25%” , newImage(“p2”, MP + “.png”).size(250) )
    .add( “center at 75%” , “center at 25%” , newImage(“p3”, RP + “.png”).size(250) )
    .add( “center at 25%” , 300 , newImage(“topL”, topL + “.jpg”).size(125) ) // replaced o1 with topL etc
    .add(“center at 25%” , 425 , newImage(“botL”, botL + “.jpg”).size(125) )
    .add(“center at 50%”, 300 , newImage(“topM”, topM + “.jpg”).size(125) )
    .add(“center at 50%” , 425 , newImage(“botM”, botM + “.jpg”).size(125) )
    .add(“center at 75%”, 300 , newImage(“topR”, topR + “.jpg”).size(125) )
    .add(“center at 75%”, 425 , newImage(“botR”, botR + “.jpg”).size(125) )

    .print(“center at 50vw”,”top at 2em”).log()
    ,
    newButton(“Go”)
    .print( “center at 50%” , “bottom at 100%” , getCanvas(“images”) )
    .wait()
    .remove()
    .log()
    ,
    // These are the feedback tooltips, in case the mouse moves too early or click is too late

    newTooltip(“slowClickWarning”, “CLICKED TOO LATE. You took too long to click on your selection. Please try to click faster next time!”)
    ,
    newTooltip(‘incorrect’, ‘That is not the correct answer. Please choose the item mentioned in the story.’)
    ,
    newVar(‘trialID’).global()
    ,
    getVar(‘trialID’).set(soundfile)
    ,
    newVar(“RT”, 0).global()
    ,

    // Launch timers to detect early movement and late clicks
    // Sets up timers. Early warning and late warnings.
    newTimer(“earlyStart”, (parseInt(onsetToPronoun) )).start().log()
    ,
    newTimer(“onset”, parseInt(begOfCritical))
    .callback(getVar(“RT” ).set(v=>Date.now()))
    .start()
    .log()
    ,
    // At trial start
    newVar(“slowClick”, false).global(),
    newTimer(“timeLimit”, parseInt(endOfCritical)+10000)
    .callback(() => getVar(“slowClick”).set(true))
    .start()
    .log(),

    // Start tracking mouse movements and clicks
    newVar(‘check’).set(0 + checks)
    ,
    // Play the audio description
    newAudio(“description”, soundfile + “.mp3”).play()
    ,
    // Make the images clickable
    newSelector(“imageSelection”)
    .add(getImage(“topL”), getImage(“botL”), getImage(“topM”),
    getImage(“botM”), getImage(“topR”), getImage(“botR”))
    .log()
    .callback(

    // Compute RT
    getVar(“RT”).set(v => Date.now() – v).global().log(),

    // Determine whether slow-click happened
    getTimer(“timeLimit”).test.ended()
    .success(
    getVar(“slowClick”).set(true),
    getVar(“timeout”).set(v => v + 1).log()

    ),

    // —- SLOW CLICK WARNING —-
    getVar(“slowClick”).test.is(true)
    .success(
    getTooltip(“slowClickWarning”)
    .print(“center at 50%”, “middle at 60%”)
    .wait()
    ),

    // —- INCORRECT ANSWER WARNING —-
    getVar(“check”).test.is(1)
    .and(
    getSelector(“imageSelection”).testNot.selected(correct)
    )
    .success(
    getVar(“incorrectCount”).set(v => v + 1).log(),
    getTooltip(“incorrect”)
    .print(“center at 50%”, “middle at 50%”)
    .wait()
    )
    )

    .wait()
    ,
    getVar(“slowClick”).test.is(true)
    .success(
    getTooltip(“slowClickWarning”)
    .print(“center at 50%”, “middle at 60%”)
    .wait()
    ),
    getVar(“check”).test.is(1)
    .success( getSelector(“imageSelection”).test.selected(correct)
    .failure(
    getTooltip(“incorrect”).print(“center at 50%”, “middle at 50%”).wait())
    )
    ,
    getButton(‘continueExp’)
    .click()
    ]

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.