Reply To: Behavioural task score

PennController for IBEX Forums Support Behavioural task score Reply To: Behavioural task score


Hello again Jeremy,

Thank you for this response.

Unfortunately and mysteriously, the code above does not run as expected. It still goes directly to the next trial after pressing a valid key, meaning that even when outside of the .callback element, the getKey(“question1”) test does not run and no text is printed. (Like I mentioned in my last post, the text printing isn’t actually what I want to do, I’m just using it as a toy example to make it clearer what code should be running when. Eventually the ‘success’ test that I want to implement is whether they pressed the correct key, and then update the ‘score’ variable. But first I have to get a test command to actually run!).

I must be using a Timer element wrong. The the only way I can get the test to run and the text to print (code below) is if I remove the getTimer(“window”).stop() from the .callback function, but then of course the trial continues for 5s even if a valid key is pressed, and of course it’s at the end of this 5s that the text prints (putting the getTimer(“window”).wait() after the getKey().test.pressed call also, naturally, results in no evaluation of the test.pressed function and immediately starts the next trial when a valid key is pressed, the same as the code in your last response).

In any case, you’ve given quite a few responses to this so far, I totally understand if you don’t have time to give another response. I just figured I should give an update on what was/wasn’t working. I guess I’ll need to bump around the Timer commands and see what gives.

Thank you so much!


    row => 
    newVar("score", 0).global(),
        .css("font-size", "2em")
	    .css("font-family", "verdana")
    newText("instruction", "Which condition did you encounter this word experiment? Press the F KEY for INNER, the J KEY for OUTER, and the SPACEBAR for NEW WORD")
    newTimer("window", 5000).start()
    newKey("question1", "FJ ")
            newText("Good job!").print()
    .log("score", getVar("score"))