In the following script the conditional (a > 100) cause a QC crash. (Q1. Why?) Also a is equal to inputNumber[1] value at end of execution when it should
be staying the same each loop as in:
                        a = inputNumber [0] + 1;
(Q2 Why isn't a always = 1?)

A1:  That's no crash.  A hang is not a crash.
Details: you're in a while loop. The exit condition is only set when inputNumber[0] + 1 is greater than 100. Thus, if inputNumber[0] is less than or equal to 99, you'll never exit the loop. In Comp. Sci. Parlance, this is called an "Infinite Loop" (where Apple's located, incidentally). Before anyone says "well, they should detect infinite loops and stuff!", read up on the Halting Problem. ;) Generally, don't use while loops in QC unless you really know what you're doing. for loops are generally safer (but can also be infinite, of course).


A2:  from your code, you're setting a to inputNumber[1] with the line
        if (a = inputNumber [1])  // this works though

"=" is an assignment operator (as in, x=4, cool="a string", result = new Object(), etc.) So your line above sets "a" to "inputNumber[1]". I'm guessing you're trying to check for equality. That's what the "==" operator (and "===" operator in JS) are for -- there are subtle details between == and ===, but I think == will suffice for number comparisons.


A3: I'm 100% certain it's not getting to "5000 in a nanosecond" -- a 3.0GHz Core i7 takes 0.333 ns for a single clock cycle. Unless it's doing 1666.667 instructions per clock (a GPU could perhaps pull this off, but they're much lower clocked), you're physically not able to accomplish that ;)

But more seriously -- the javascript patch is executed once per frame. Once. I'm pretty certain your loop logic is broken such that trying to grapple with any output is pretty meaningless; try fixing the conditions, and then see what's going on.

--
[ christopher wright ]
[email protected]
http://kineme.net/

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to