Reply To: Refreshing canvas

PennController for IBEX Forums Support Refreshing canvas Reply To: Refreshing canvas

#7030
rventura
Participant

Hi Jeremy,

Thanks for the quick reply! The code that I posted here had a few typos, but the code that’s giving the error message didn’t. My bad for obscuring the issue in a failed attempt to make the post easier to read. Besides, missing parentheses and extra comes don’t usually give me the error messages I’m receiving. Is there a way to check/update my PennController version? I gave the elements different names but still get the same error.

Here’s the full code:

newTrial("Begin_2",
    
    //
    newVar("value", 0).global(),

    newText("<h4>You are about to start Phase 2!</h4>")
        .print(),
        
    newText("<p> </p>").print(),
    newButton("Begin Phase 2!")
        .center()
        .print()
        .wait()

);

//Phase 2: Produce
Template( GetTable( "icon.csv" ), row => 
    newTrial("Phase_2",
    
        //
        newCanvas("score", 600,20)
            .add( 275, 0,
                newText("score", "score: ")
            ).print()
            .add( 325, 0,
                newText( "score_value", "0" )
            ).print()
        ,
        
        getText("score_value").text( getVar("value") ),

        //
        newCanvas("next_trial", 600,250)
            .add( "center at 50%", "middle at 50%",
                newText("<p>Next . . .</p>")
            ).print()
        ,
        
        newTimer("wait", 600).start().wait(),
        getCanvas("next_trial").remove(),

        newCanvas(600,250)
            .add("center at 50%", "middle at 50%", newImage("pic", row.File))
            .print()
        ,
        
        newScale("answer", row.A1, row.A2, row.A3, row.A4 )
            .center()
            .vertical()
            .labelsPosition("right")
            .print()
            .wait()
        ,
        
        getScale("answer")
            .test.selected( row.Noun1)
            .or( getScale("answer").test.selected( row.Noun2) )
            .success(
                getVar("value").set( v => v+1 ),
                getText("score_value").text( getVar("value") )
            )
            .failure(
                getText("score_value").text( getVar("value") ) 
            )
        ,
            
        newText("<p> </p>").print(),
        newButton("next", "Next")
            .center()
            .print()
            .wait()
        
    )
);

Best,
Rafael