PennController for IBEX › Forums › Support › Refreshing canvas › Reply To: Refreshing canvas
June 7, 2021 at 8:42 am
#7022
rventura
Participant
Hi Jeremy,
That’s perfect, thank you! I have yet another question. I want to have a score tracker and for that I initialize a global variable with newVar(“value”, 0).global(). But when I try to update a Text element with getText(“value”).text( getVar(“value”) ), I get an error message I cannot decipher. The code and the error message are below:
newTrial("Begin_2",
newVar("value", 0).global(),
newText("<h4>You are about to start Phase 2!</h4>").print(),
newButton("Begin Phase 2!")
.center()
.print()
.wait()
);
Template( GetTable( "icon.csv" ), row =>
newTrial("Phase_2",
newCanvas("score", 600,20)
.add( 275, 0,
newText("score", "score: ")
).print()
.add( 325, 0,
newText( "value", "0" )
).print()
,
getText("value").text( getVar("value") ),
);
And the error message:
[8:33:40] Command ‘0’ unknown on Var element ‘value’. (PennController: 34)
[8:33:40] Command ‘length’ unknown on Var element ‘value’. (PennController: 34)
[8:33:40] Command ‘parentNode’ unknown on Var element ‘value’. (PennController: 34)
Thanks,
Rafael