Embedded Expressions
There is an option for advanced users to extend the declarative ERTS scripting language with a concept of JavaScript-like expressions that behave similar to the concept of eval() function in other programming languages. The use of expressions requires basic understanding of programming languages and is only required if you want to define dynamic content and custom adaptive event flow that goes beyond what the capabilities of the conventional ERTS scripting language.
Expressions are defined as blocks of multiple expressions. This allows you to compute multiple variables in several expressions and reuse the variable in a next expression. The value of variables is available at the script level in form of Variable names which can be used to command arguments at trial and session level. Some data types can use variable names within their definition to dynamically change the definition. For example, a text variable can be embedded into a text picture to display dynamic content such as a last reaction time, percent errors or bonus points computed with help of expressions.
The OE trial command (On Expression) uses the result of the last expression in an expression block to branch to specific trial commands depending on its value (similar to a switch / case statement). This allows you to realize any response-dependent flow.
Example for displaying reaction time of last response
PICTURE ShowRT T
Your last RT was @VLastRt@ msec
EXPRESSION GetLastRt
@LastRt = get_rsp('rt')
@LastRt n(@LastRt, 3, 4)
TRIAL T1
…
RK Press
SP Target Circle ? 0 1
EX GetLastRt
SP ShowRT Center 1 2000
Copyright 2021 - BeriSoft Inc.
All rights reserved