In 4.6, I just parse them using some prewritten code.
Basically, I create the variable and default value, and add its name to an array of valid attribute names. Then I parse jsarguments for properly-formed pairs which match the format @ATTR1 VALUE (checking for the presence of ATTR1 in the atribute array). Finally I use an eval to set the value of a variable corresponding to the attribute name (ATTR=VALUE).
My parser also handles position-dependent arguments.
Apart from the code used to do the parsing etc (which isnt particularly optimised, so about 60 lines long), which could be included in a code template, that reduces my argument and attribute parsing to the following:
args = new argHandler;
// note – declare arguments in order;
var ARG1 = 100;
var ARG2 = 0;
var ATTR1 = 100;
// required : reads and evals supplied arguments
// posts all attributes as per a non-js patcher
C74 RSS Feed | © Copyright Cycling '74