Reply To: Reaction times of a selector response

PennController for IBEX Forums Support Reaction times of a selector response Reply To: Reaction times of a selector response

#5093
Jeremy
Keymaster

Hi,

As you found out, you cannot pass a Var element to initiate another element. This is because all the new* commands (but not their corresponding blocks of commands) are evaluated at the very beginning of the experiment, at which point the Var elements have not been set in the yet-to-come flow of trial events.

What you can do instead is use the .text command of the Text element, like this:

newVar("RT").set( v=>Date.now() )
,
newButton("Click!").print().wait()
,
getVar("RT").set( v=>Date.now()-v )
,
newText().text( getVar("RT") ).print()

Jeremy