Reply To: Behavioural task score

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


Hello there!

I’m still wrestling with this bit of code. Basically, I want to display the score variable after all trials, not at the end of each. So the code below is the task where the score variable is referenced and updated (‘recall’ Template) and the one-off ‘score_time’ Trial which displays the score variable.

The problems are twofold, and related: 1) where to put the score variable, and 2) how to access the score variable. I launch ‘score’ as a global variable every time, but:
– when I launch the score variable inside the ‘recall’ Template, it is not referenced later in the ‘score_time’ Trial, and ‘score_time’ only displays: ‘Your score on the recall task was: ‘ with no number (so I guess it didn’t find the ‘score’ Variable)
– when I launch the score variable outside the ‘recall’ Template, the recall score always prints as 0 in the ‘score_time’ Trial (no matter how many correct Keys I press in the trials). So I guess my code under the “question1” Key for test.pressed is not working.

Given this, it seems that launching the global score variable outside the ‘recall’ Template will at least get that variable accessible, but then I must do something that allows its value to be changed trial-by-trial, and displayed in its final, updated form at the very end. Any errors you can spot below, or any guidance you have, would be very much appreciated. Thank you so much!

    row => newTrial("recall-"+row.block,
    newVar("score", 0).global(), // score variable
        .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)
    newKey("question1", "FJ ")
        .callback( getTimer("window").stop() )
    .log("score", getVar("score"))

    newText("Your score on the recall task was: ")

(P.S. thank you so much for the server update – everything is running and loading so fast now!)