Scale feedback and timeout

PennController for IBEX Forums Support Scale feedback and timeout

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #9890
    Mercedes
    Participant

    Hi Jeremy!

    I am programming and Acceptability judgement task with oral stimuli. Right now I’ve been having two issues:

    1. I created a timeout timer so that after 7 seconds the trial ends and they show a message saying “Too Slow”. The problem is that after that message shows, the button does not continue to the next trial.

    2. I want to add a correct answer to my scale, so that if participants press 1 they will get a message saying “Correct” and if the press any of the other numbers, they will get a message saying “Incorrect”, but it does not allow me to use if…else inside test selected, or I am doing ir wrong.

    Here’s my code:

    newTrial("checks",
        newText("prueba", "Presione la barra espaciadora para continuar")
            .center()
            .print()
        ,
        newKey("separador_2", " ")
            .callback(getText("prueba").remove())
                .wait()
        ,
        newAudio("check_97", "check_97.mp3") 
        ,
        newImage("speaker_1", "altavoz.png")
               .print()
               .center()
               .size(250, 200)
        ,
        newTimer("focus",250) 
                .start()
                .wait()
        ,
        getAudio("check_97") 
                .play() 
                .wait()
        ,
         getImage("speaker_1")
            .remove()
        ,
        newTimer("timer", 7000)
                .start()
                .callback(getScale("acceptability").remove(),
                        newText("lento","<p style=font-family:helvetica;color:red padding-bottom: 25px>¡Muy lento!</p>") .center() .print() ,
                        newButton("recomenzar", "Click aquí para continuar") .center() .print()
                        )
        ,
        newScale("acceptability", 7)
                .before(newText("<p style=font-family:lucilda margin-right:2em><i>completamente inaceptable</i></p>"))
                .after(newText("<p style=font-family:lucilda><i>completamente aceptable</i></p>"))
                .callback(getTimer("timer") .stop())
                .button()
                .keys()
                .center()           
                .print()
                .wait()
        ,
        getScale("acceptability")
            .test.selected(getScale("acceptability") == 1)
            .success(newText ("correct") .print())
            .failure(newText("incorrect") .print())
        ,
        getTimer("timer")
              .callback(getButton("recomenzar") .wait() .remove())
              .callback(getText("lento") .remove())
              .wait("first")    
        )

    and the link to the demo: https://farm.pcibex.net/r/dnBMvb/

    Thank you!

    #9891
    Mercedes
    Participant

    Hi! Sorry for the stack replies, but I solved the problem with the correct/incorrect feedback below the scale. Now the issue is that when I implement the timer, the incorrect/correct feedback overlaps with the “Too Slow” message and they both appear together on the same screen.

    My idea is that when they press the button on the scale, they will see whether they pressed the correct key or not and then they press the space bar to continue to the next trial. If the timer times out before they select a key, they will get the too slow message and then press the space bar to continue to the next trial. This is my code now:

    Template("attention_checks.csv", row =>
        newTrial(row.condition,
            newText("prueba", "<p style=font-family:helvetica>Presione la barra espaciadora para continuar</p>")
                .center()
                .print()
            ,
            newKey("separador_2", " ")
                .callback(getText("prueba").remove())
                    .wait()
            ,
            newAudio(row.audio) 
            ,
            newImage("speaker_1", "altavoz.png")
                   .print()
                   .center()
                   .size(250, 200)
            ,
            newTimer("focus",250) 
                    .start()
                    .wait()
            ,
            getAudio(row.audio) 
                    .play() 
                    .wait()
            ,
            getImage("speaker_1")
                .remove()
            ,
            newTimer("timer", 7000)
                    .start()
                    .callback(getScale("acceptability_checks").remove(),
                            newText("lento","<p style=font-family:helvetica;color:red padding-bottom: 25px>¡Muy lento!</p>") .center() .print(),
                            newText("seguir", "<p style=font-family:helvetica>Presione la barra espaciadora para continuar</p>") .center() .print(),
                            newKey("recomenzar", " ")
                            )
                    .callback(getText("label_practice") .remove())
            ,
            newText("label_checks", "<p style=font-family:lucilda margin-right:2em>Usá el teclado o el mouse para responder</p>")
                .css("font-size", "0.9em")
                .css("font-style", "italic")
                .css("position", "relative")
                .css("top", "120px")
                .css("font-weight", "100")
                .center()
                .print()
            ,
            newScale("acceptability_checks", 7)
                    .before(newText("<p style=font-family:lucilda margin-right:2em><i>completamente inaceptable</i></p>"))
                    .after(newText("<p style=font-family:lucilda><i>completamente aceptable</i></p>"))
                    .callback(getTimer("timer") .stop())
                    .button()
                    .keys()
                    .center()           
                    .print()
                    .wait()
            ,
            newVar("score_attention")
                .set(getScale("acceptability_checks"))
            ,
            newVar("check_attention") .set(row.check)
                .test.is("")
                .or(getVar("check_attention").test.is(getVar("score_attention")))
                .success(
                    newText("bien", "<p style=font-family:helvetica;color:red padding-bottom: 25px>¡Correcto!</p>")
                        
                        .print()
                        .center()
                    ,
                    newText("continuar_bien","<p style=font-family:helvetica;color:red padding-bottom: 25px>Presione la barra espaciadora para continuar</p>")
                        
                        .print()
                        .center()
                    ,
                    newKey(" ") .wait()
                    )
                .failure(
                    newText("<p style=font-family:helvetica;color:red padding-bottom: 25px>¡Incorrecto!</p>")
                        
                        .print()
                        .center()
                    ,
                    newText("<p style=font-family:helvetica;color:red padding-bottom: 25px>Presione la barra espaciadora para continuar</p>")
                        
                        .print()
                        .center()
                    ,
                    newKey("continuar_mal" , " ") .wait()
                
                )
            ,
            getTimer("timer")
                    .callback(getText("lento") .remove())
                    .callback(getText("seguir") .remove())
                    .callback(getKey("recomenzar") .wait())
                    .wait("first")    
            )
        .log("group", row.group)
        .log("item", row.item)
        .log("condition", row.condition)
    )
    
    #9901
    Jeremy
    Keymaster

    Hi,

    I wrote a simplified version of your trial where I took out some elements for the sake of illustration. The main takeaway is that, since all three scenarios (correct choice, incorrect choice, no choice) end the same way (print “press a key” and wait for a keypress) you don’t have to repeat that sequence of events three times, you can write it just once at the end of the trial instead (you also don’t have to use a Var element to check the value of a column, you can pass it directly to test):

    newTrial(row.condition,
        defaultText.center().print()
        ,
        newText("prueba", "<p style=font-family:helvetica>Presione la barra espaciadora para continuar</p>")
        ,
        newTimer("timer", 7000)
        ,
        newScale("acceptability_checks", 7)
                .before(newText("<p style=font-family:lucilda margin-right:2em><i>completamente inaceptable</i></p>"))
                .after(newText("<p style=font-family:lucilda><i>completamente aceptable</i></p>"))
                .callback( getTimer("timer").stop() )
                .button()
                .keys()
                .center()
                .print()
                .log("all")
        ,
        getTimer("timer").start().wait()
        ,
        clear()
        ,
        getScale("acceptability_checks")
            .test.selected()
            .success(
                getScale("acceptability_checks").test.selected(row.check)
                    .success( newText("<p style=font-family:helvetica;color:darkgreen padding-bottom: 25px>¡Correcto!</p>") )
                    .failure( newText("<p style=font-family:helvetica;color:red padding-bottom: 25px>¡Incorrecto!</p>") )
            )
            .failure( newText("lento","<p style=font-family:helvetica;color:red padding-bottom: 25px>¡Muy lento!</p>") )
        ,
        newText("<p style=font-family:helvetica>Presione la barra espaciadora para continuar</p>")
        ,
        newKey(" ").wait()
    )
    .log("group", row.group)
    .log("item", row.item)
    .log("condition", row.condition)

    Jeremy

    #10749
    dod
    Participant

    Hi,

    I’m trying to implement something similar but on a Question controller.

    I would like to print some feedback when the answer is not correct. But being a Question, the scale.test.selected does not work. Is there a command I’m missing? I could still print the correct answer for every question. But I’d prefer not to.

    Also, I’d like to timeout the answer time and print an error message if needed. I know how to do it with a normal Timer element. And I know I can add a timeout message to the item array in the old Ibex. But I’m not sure how to implement the timeout message in PCIbex, when the timeout option is set in the Question controller.

    Thank you in advance for any help!

    • This reply was modified 10 months, 2 weeks ago by dod.
    • This reply was modified 10 months, 2 weeks ago by dod.
    #10753
    Jeremy
    Keymaster

    Hi,

    There is no test command specific to the Question controller, because the Controller element can inject any IBEX controller in a PennController trial, including custom ones. The Question controller can very easily be coded manually, so I suggest you do that to get better control over the trial’s structure:

    newTrial(
      newText("Is this a question?").center().print()
      ,
      newTimer("timeout", 3000).start()
      ,
      newScale("answer", "Yes", "No")
        .keys("Y","N")
        .button()
        .callback( getTimer("timeout").stop() ) 
        .center()
        .print()
      ,
      getTimer("timeout").wait()
      ,
      getScale("answer")
        .test.selected()
        .success( getScale("answer").test.selected("Yes").failure( newText("Wrong answer!").print() ) )
        .failure( newText("You didn't answer in time!").print() ) 
      ,
      newTimer(2000).start().wait()
    )

    Jeremy

    #10761
    dod
    Participant

    Thank you, it works!

    At that point, I’ll have to manually log the accuracy and the response time, though, right? I mean, I can log the scale selection, and set a variable to get the timing (something like newVar(“RT”).global().set(()=>Date.now()) …. getVar(“RT”).set(v=>Date.now()-v). Just thinking if there is a cleaner way to do it.

    Thank you

    #10766
    Jeremy
    Keymaster

    Hi,

    Yes, you can calculate response time upon runtime, or simply use the EventTime column to calculate it during your analyses. Same thing for accuracy: you can either set a Var element in success/failure to report accuracy directly in the results file, or you can just log the expected answer in an additional column using newTrial().log and compare it to the selection during your analyses

    Jeremy

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