Feedback after selecting an image

PennController for IBEX Forums Support Feedback after selecting an image

This topic contains 5 replies, has 2 voices, and was last updated by Jeremy Jeremy 2 days, 13 hours ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #4691
    Avatar
    Elise
    Participant

    Hi,

    I am programming a reading experiment. Participants read a sentence and then they see two pictures. They should choose one of pictures with the “F” or “J” key. For the practice trials, I want to implement feedback. Here is how I tried it:

    PennController.Template("Materials_Practice.csv",
        row => ["dashed_practice",
        "DashedSentence", {s: row.Sentence},
        "PennController", PennController(
        newImage("CoveredPicture", "covered.png")
            .settings.size(500,500)
            ,  
        newImage("1", row.Picture)
            .settings.size(500,500)
            ,
        newText("leftLabel","(F)")
            ,
        newText("rightLabel","(J)")
            ,
        newCanvas(700,500)
            .settings.add(   350 , 0 , getImage("CoveredPicture"))
            .settings.add( -250, 0 , getImage("1") )
            .print()
            ,
        newCanvas(500,500)
            .settings.add(0,500, getText("leftLabel"))
            .settings.add(600,500, getText("rightLabel"))
            .print()
            ,
        newKey("answer","FJ")
            .wait()
        ,
        newText("positive feedback", "Correct!")    
        ,
        newText("negative feedback", "Wrong...")
        ,
        PennController(getKey("answer")    
            .test.pressed("F")
            .success( 
                getText("positive feedback")
                    .print()
            )
            .failure(
                getText("negative feedback")
                    .print()))
          )]),

    What happens is, that the experiment is loading forever and no error message as usual appears.
    What is my fault or how do I implement feedback in another way?

    Thanks!

    Elise

    #4692
    Jeremy
    Jeremy
    Keymaster

    Hi Elise,

    The problem is coming from the PennController command that you call from inside another PennController command, just before your getKey("answer"). It simply shouldn’t be there. Try again with the fixed script below:

    PennController.Template("Materials_Practice.csv",
        row => ["dashed_practice",
        "DashedSentence", {s: row.Sentence},
        "PennController", PennController(
        newImage("CoveredPicture", "covered.png")
            .settings.size(500,500)
            ,  
        newImage("1", row.Picture)
            .settings.size(500,500)
            ,
        newText("leftLabel","(F)")
            ,
        newText("rightLabel","(J)")
            ,
        newCanvas(700,500)
            .settings.add(   350 , 0 , getImage("CoveredPicture"))
            .settings.add( -250, 0 , getImage("1") )
            .print()
            ,
        newCanvas(500,500)
            .settings.add(0,500, getText("leftLabel"))
            .settings.add(600,500, getText("rightLabel"))
            .print()
            ,
        newKey("answer","FJ")
            .wait()
        ,
        newText("positive feedback", "Correct!")    
        ,
        newText("negative feedback", "Wrong...")
        ,
        getKey("answer")    
            .test.pressed("F")
            .success( 
                getText("positive feedback")
                    .print()
            )
            .failure(
                getText("negative feedback")
                    .print()
            )
        ,
        newButton("continue", "Next")
            .print()
            .wait()  // You need to wait before going to the next trial
        )]
    )

    Jeremy

    #4693
    Avatar
    Elise
    Participant

    Hi Jeremy,

    thank you for your help!

    The problem now is, that I can’t press any key anymore. If I comment out that part:

    newButton("continue", "Next")
            .print()
            .wait()  // You need to wait before going to the next trial

    I can select a picture, but the next trial starts immediately. I suppose that the feedback is there, but I can’t see it.
    Do I have to implement the .wait command somewhere else?

    Elise

    #4694
    Jeremy
    Jeremy
    Keymaster

    The problem is coming from the Canvas elements: PennController doesn’t understand that you specified the dimension of an anonymous element, instead it takes the first number to be the element’s id (in your case, 700 for the first Canvas, 500 for the second one). As a result the second number is interpreted as the Canvas’ width instead of its height, and so its height is null, making the feedback and button appear behind the Canvas (= under a 0px tall element). Give a name to each of you Canvas and the problem should go away (I would also suggest resizing your Canvas, they are very big right now)

    Jeremy

    #4695
    Avatar
    Elise
    Participant

    Hey Jeremy,

    thanks for your reply. You were right, the button and the feedback massage were behind the picture. But the feedback massage “Wrong” is printed without pressing any key. I took the pictures and the dashed sentence out and it is still the case that the feedback massage “Wrong” is printed although no key was pressed. I would be very thankful if you could help fixing this problem.

    Elise

    #4696
    Jeremy
    Jeremy
    Keymaster

    Hi Elise,

    There must be something else going on in your script, because when I try the script above, neither “wrong” nor “correct” appears on the screen until I press the corresponding key. Do you have any print command elsewhere, maybe called on defaultText? Do you use the print command on the wrong-feedback element somewhere ahead of the key test?

    Jeremy

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.