Reply To: Comprehension question and rshuffle in self-paced reading

PennController for IBEX Forums Support Comprehension question and rshuffle in self-paced reading Reply To: Comprehension question and rshuffle in self-paced reading

#7614
JunLyu
Participant

Thank you Jeremy! I tried the code below. I assume that although “global” in name, it still needs to be embedded within the “local” environment of newTrial? Is that correct? (I was thinking maybe a “global” variable should stand on its own, on a par with newTrial).

Template("demo.csv", row =>
    newTrial("experimental-trial",
    newController("DashedSentence",{s: row.Sentence})
        .cssContainer({"margin-top":"2em", "margin-bottom":"2em"})
        .print()
        .center()
        .log()      
        .wait()
        .remove()
    ,
    newText("CompQuestion", row.Question)
        .center()
        .print()
    ,
    newVar("isCorrect").global()
    ,
    newScale("answer",...[row.Answer1,row.Answer2].sort(v=>0.5-Math.random()))
        .labelsPosition("right")
        .center()
        .log()
        .print()
        .wait()
        .test.selected( row.Answer1 )
        .success( getVar("isCorrect").set(true) )  
        .failure( getVar("isCorrect").set(false) )
        .log("isCorrect", getVar("isCorrect"))
        )
    )

Jun