This isn't a bug -- you're assigning B to an undefined value, and then
trying to do math on it.
In general, do not check against null in JavaScript, check against
undefined (null _is_ defined, so it's different from undefined)
You want your script to look something like this: (search for "THIS
IS EXTRAORDINARILY IMPORTANT" for the relevant change)
var str = new String();
var array = new Array();
var initalised = false; // <-- UNIMPORTANT CHANGE: new Boolean() is a
waste of code, just set it to false.
var sum = 0; // <-- UNIMPORTANT CHANGE: new Number() is a waste of
code, just set it to 0
function (__structure outputStructure, __string debug, __number
debug1,__number debug2)
main (__structure inputStructure, __number increasingScale, __number
decreasingScale,
__number time, __boolean Reset)
{
var result = new Object();
if ((inputStructure != null) && !(_testMode))
{
if (Reset) initalised = false;
/* _____
Init the 2nd dimensions for array (only once)
*/
if (initalised == false)
{
for (i in inputStructure)
{
array[i] = new Array();
for (j in inputStructure[i])
{
// array[i][j] = 1 -
Math.floor(Math.random() *20)/10;
array[i][j] = inputStructure[i][j] ; // *1. trying to coerce
value not pointer?! doesn't seem to make any diff
}
}
sum++ ;
result.debug1 = sum;
initalised = true;
}
// if (sum <3) { initalised = false }
/*
Debugging test
*/
if (initalised)
/* {
str =
String.fromCharCode(Math.floor(Math.random()*512));
result.debug = str;
result.debug2 = array[4][2];
}
*/
// sum = 0 // comment this line out to count the total patch
executions rather than times per patch execution
/* _____
Main Routine
*/
if (initalised)
{
for (i in inputStructure)
{
A = inputStructure[i];
B = array[i];
// if (array[i] = null) {array[i] = new Array()} // This line
didn't work so I made the initalise routine.
for (j =0; j <A.length; j++)
{
if (B == undefined) //// <-------------- THIS IS EXTRAORDINARILY
IMPORTANT
break;
var value = A[j];
var lastValue = B[j];
if (lastValue != null)
{
if(value > lastValue) { //sum++;
lastValue +=
increasingScale * (value - lastValue);
}
else if(value < lastValue) {
//sum++;
lastValue +=
decreasingScale * (value - lastValue);
}
B[j] = lastValue;
}
else
B[j] = value;
// array[i][j] = Math.floor(array[i][j]
*10)/10;
}
}
}
}
// if (array != null)
result.outputStructure = array;
return result;
}
--
[ christopher wright ]
cwri...@kineme.net
http://kineme.net/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list (Quartzcomposer-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/archive%40mail-archive.com
This email sent to arch...@mail-archive.com