Reusing keys

PennController for IBEX Forums Support Reusing keys

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #5714
    angelica
    Participant

    Hi Jeremy,

    I’d like to do a speeded grammaticality judgment experiment where the participant has two seconds to provide a judgement before it times out.

    I’m running into some logging issues because I use the F/J keys in both the judgment section and the comprehension question section.

    customTrial = label => variable => newTrial( label ,
        defaultText
            .center()
        ,
        ...
        ,
        // 3a. Judgment
        	// Participant presses F/J to make a judgment and continue. 
        newText("placeholder", "+++++++")
            .cssContainer({"width": "600px", "height": "50px","font-size": "150%"})
        ,
        newText("not_okay", "F)  NOT OKAY")
            .italic()
            .cssContainer({"width": "300px"})
        ,
        newText("okay", "J)  OKAY")
            .italic()
            .cssContainer({"width": "300px"})
        ,
        newCanvas("j_display", 600, 400)
            .add(0, 145, getText("placeholder"))
            .add(0, 350, getText("not_okay"))
            .add(300, 350, getText("okay"))
            .print()
            .log()
        ,
        newKey("judgment", "FJ")				
        	.callback(getTimer("window").stop())
        	.log("all")							
        ,
        // 3b. Time out
    	newTimer("window", 2000)
        	.log()
            .start()
            .wait("first")
        ,
        newText("tooSlow", "Please answer more quickly! Remember, speed is important.")
    		.cssContainer({"margin":"145px 0 0 0", "width":"600px"})
        ,
        newText("next", "Press the spacebar to continue.")
        	.italic()
        	.cssContainer({"margin":"105px 0 0 0", "width":"600px"})
        ,
        clear()
        ,
        getKey("judgment")
        	.test.pressed()
        	.success(newText(" ").print())
        	.failure(
        		getText("tooSlow").print(),
        		getText("next").print(),
        		getKey("continue").wait())
    	,
    	clear()
    	,
    	// 4. Comprehension question 
    		// Participant presses F/J to answer question and continue.
        (variable.question?[
      	...
        ,
        newKey("answer", "FJ")				
            .log("all")
            .wait()
        ]:null)
        ,
        clear()
    	,
        // 5. Feedback
        (variable.feedback?[
      	...
        ]:null)
    )

    For trials without a comprehension question, if a judgment is never provided then it’s nicely logged as Never:
    ...,Key,judgment,Key,NA,Never,,practice,1,J,,NULL

    For trials with a comprehension question, if a judgment is never provided then when the question is answered the keypress is logged as validating both the “judgment” and “answer” Keys.

    ...,Key,judgment,PressedKey,J,1593044024281,,practice,2,J,F,NULL
    ...,Key,answer,PressedKey,J,1593044024281,,practice,2,J,F,Wait success

    If a judgment is made and a trial has a comprehension question, then the “judgment” keypress is logged twice, first as its actual value and then as an echo of the “answer” keypress.

    ...,Key,judgment,PressedKey,F,1593044176147,,practice,2,J,F,NULL
    ...,Key,judgment,PressedKey,J,1593044177099,,practice,2,J,F,NULL
    ...,Key,answer,PressedKey,J,1593044177099,,practice,2,J,F,Wait success

    Is there a way to avoid this?

    As a second question, is it possible to completely end a trial early? At the moment, if the judgment section times out the trial moves on the comprehension question/feedback sections, if there are any, but I’d like to be able to have the trial end and move onto the next trial.

    Best,
    Angelica

    #5717
    Jeremy
    Keymaster

    Hi Angelica,

    Use disable on your Key element after you’re done with it, it should stop recording keypresses.

    To end a trial early, use the special command end

    Jeremy

    #5722
    angelica
    Participant

    Hi Jeremy,

    Thank you!

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