Timed response with feedback

PennController for IBEX Forums Support Timed response with feedback

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #8023
    vlanglois
    Participant

    Hello!

    I’m coding up a simple flanker task, and I’m having some trouble incorporating a timed response that includes feedback. The goal is to have the participant respond with either “F” or “J”, and depending on their answer, feedback should be given. If they don’t respond, it should return a message like “Too slow”. So far, I have been able to get the feedback working, however if I do not press any key, the image stays on the screen and the script doesn’t move forward.

    Here is the code for that part below. And here’s the demonstration link: https://farm.pcibex.net/r/RgVUnM/

    PennController.ResetPrefix(null)
    Sequence("flanker-practice") 
    
    Template("flanker-practice.csv", row =>
        newTrial("flanker-practice",
            newText("Press either the <b>F</b> key if you see a left arrow, or the <b>J</b> key if you see a right arrow.")
                .center()
                .print()
            ,
            newTimer("wait", 3000)
                .start()
                .wait()
            ,
            clear()
            ,
            newTimer("RT",2000).start()
            ,
            newImage("Image", row.Image)
                .center()
                .print()
            ,
            newKey("FJ")
                .wait()
                .log("first")
                .callback(getTimer("RT").stop())
            ,
            getTimer("RT").wait()
            ,
            getImage("Image").remove()
            ,
            getKey("FJ")
                .test.pressed()
                .success(getKey("FJ").test.pressed("F")
                    .success( newText("success", "Correct!").center().print())
                    .failure(newText("negative feedback", "Wrong answer!")
                        .log()
                        .print()
                        .center()
                        .cssContainer({"font-size": "160%", "color": "red"})
                )
            )
            .failure(newText("slow", "Too slow...")
                .log()
                .print()
                .center()
                .cssContainer({"font-size": "160%", "color": "red"})  
            )
            ,
            getKey("FJ").disable()
            ,
            getTimer("wait").start().wait()
        )
    .setOption("hideProgressBar",true)
    .log("Image", row.Image)
    )

    I also looked at previous forum posts, but the code from those posts also didn’t work. I believe it probably has something to do with one of the timers, but I’m not sure.

    Thank you so much!

    #8033
    Jeremy
    Keymaster

    Hi,

    If you don’t want to halt the script until the participant presses a key, remove .wait() that you’re calling on the Key element

    Jeremy

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