i just made a js script, wich does a pretty simple thing:
creating a ramp from 0 to n-1 with a delay(ms) after each
increment. (of course something similar is already done as
max externals, but for now i like to understand and recap things with scripting)
when adjusting a very small ms delay value (as argument of the js object)
i get irregular output of js object. it ramps, but not to the
expected value (n-1). in the appended patch i like to ramp to the value 1999. with 20ms everthing working fine, but the smaller the interval gets the bigger the difference between n-1 and the outputs gets. for example:
each time i ramp with 2 ms it stop at different vals. 1976, 1997 etc.
why is it?
is this because the js stuff is executed at low priority at the max sheduler?
i also looked for an alternative to the "task"-way,
but settimeout does not seem to work within the js object…
– Pasted Max Patch, click to expand. –
Copy all of the following text. Then, in Max, select New From Clipboard.