I have had a quick look at your code, and I do think while() is to blame. I say this because this JSFX loop will do only 5 iterations, not 10 as you might expect: Code:
--------------------- Sig courtesy of ///Maniac '99 Z3 2.3 '97 740iL '90 735iL '65 Sunbeam Alpine - Pimpmobile
I modified the code to use the "new while" syntax. Of course it works perfectly. In fact , if not some very old version of Reapers needs to be supported, I thing the "old while"should be banned. I feel it would be a decent move to update the JSFXes that come with Reaper on that behalf, as they will be used as examples for new would be JSFX programmers (like myself) and with "old while" they cause a lot of unnecessary confusion. -Michael
No way! The "old while" is not just syntactically different, it is functionally different, and it makes perfect sense. In fact, if we had to remove something (for an absolute reason, I sure don't want to), it should be the "new while". Reason: you can use a condition "?" and "old while" to implement the "new while", but you can't use the "new while" to implement the "old while". So from a usage perspective, the "old while" is superior. The old while functions like the do...while construct in C, and it is very useful, even more so because JS and EEL lack "break" or "continue" statements. For example: Code:
I almost always use the old-style while, mostly to stay compatible with older REAPER/JSFX, but sometimes also because it can be more convenient. However, in the examples for my JSFX libs I do try to use the newer syntax, as not to confuse JSFX newbies (especially those coming from C, JavaScript, etc.). However, I disagree the bundled JSFX plug-ins should be updated with the new syntax. IMHO they are not necessarily examples, and I feel that it is up to the original author to use whatever syntax he likes.
Well I agree that the "new while" is much clearer and useful in cases where you need the condition first, for example you don't have to duplicate the condition and it looks cleaner too. I only said in the arbitrary situation where one of them had to be removed, I would choose the new while to be removed, simply because I can live without it (not that I would want to, it was just a hypothetical example). But yes, I know what you mean about those annoying "attacks" in other regions, I was in fact speaking in general too. :)