I've been tinkering with some button scripts, trying to leverage built-in functionality to do what should be simple things without using JScript.
I'm dismayed to see any attempts of evaluating variables thwarted by DOpus executing @if
s and @evalalways
s before any of the things I need them to evaluate have been set.
I've been trying things like
@set glob:a=10
@evalalways:=if($glob:a != ""){Output("yes: " + $glob:a); return true;} Output("no"); return false;
@output a: '{$glob:a}'
@set glob:a=10
=if($glob:a != ""){Output("yes: " + $glob:a); return true;} Output("no"); return false;
@output a: '{$glob:a}'
With the result always being
- when the variable is not global, the evaluator always reads it as empty.
- when it is global, the evaluator receives the value of the last execution (not the current one)
This leads me to believe the evaluations are hoisted and executed before the preceding lines.
A) Is there a way to run checks against variables set by @set
that can be executed within the flow of a DOpus button script? (Ideally, arbitrary Evaluator code, giving us opportunity to check custom criteria with string/RegExp/whatever operations)
B) If not: Can we get a way to only evaluate things according to the flow of the script as defined by the user?
Alternatively, and stupidly, a way to also hoist the @set
ting of variables