GetVar Error Posted bylh555 July 23, 2023 PennController for IBEX › Forums › Support › GetVar Error Tagged: getVar element This topic has 1 reply, 2 voices, and was last updated 3 years ago by Jeremy. Viewing 2 posts - 1 through 2 (of 2 total) Author Posts July 23, 2023 at 2:53 pm #10777 lh555Participant Hi Jeremy, I’ve been trying to write code for an experiment that at one point prints out the value of a Var element. However, I can’t get it to work and get an error. For reference, this is the code: PennController.ResetPrefix(null); newTrial('test', newVar('var-int','hello') , newText('text',getVar('var-int')) .print() , newButton('button','Click') .print() .wait() ) I get the following error: ‘Command ‘replace’ unknown on Var element ‘hello’’ Any help would be greatly appreciated. July 24, 2023 at 2:43 am #10787 JeremyKeymaster Hi, You cannot reference a Var element in a newX command, because elements are created upon opening the experiment but evaluated upon runtime The solution is to use the .text command: newTrial('test', newVar('var-int','hello') , newText('text') .text( getVar('var-int') ) .print() , newButton('button','Click') .print() .wait() ) Jeremy Author Posts Viewing 2 posts - 1 through 2 (of 2 total) You must be logged in to reply to this topic. Log In Username: Password: Keep me signed in Log In