scripting: fix operator precedence
scripting: implement "on" and "when" ops, cache unchanged expr
add control clocking example script