how to get data out of array - JScript

Post Reply
clankill3r
Posts: 131
Joined: 21 Oct 2012, 15:36

how to get data out of array - JScript

Post by clankill3r » 31 Oct 2012, 11:31

pretty low in the code i use:

LogMessage("rot_col_"+col+"_f1");

In the top i have arrays defined like that.
However it logs the message as a string and not the array values, how can i change that?

(code should run without doing anything special)

Code: Select all

var rot_col_0_f1 = new Array(275,95,275,95,275,95,275,95,275,95,275,95,275,95,275,95,275,95,260,260,260,260,260,260,260,260,260,260,359,179,359,179,359,179,359,179,359,179,359,179,359,179,359,179,359,179,359,179,359,179);
var rot_col_1_f1 = new Array(266,86,266,86,266,86,266,86,266,86,266,86,266,86,266,86,266,86,266,299,299,299,299,299,299,299,299,359,179,359,179,359,179,359,179,359,179,359,179,359,179,359,179,359,179,359,179,359,179,359);
var rot_col_2_f1 = new Array(8,8,179,359,179,359,179,359,179,359,179,359,179,359,179,359,179,359,179,359,179,359,179,359,179,359,179,359,179,359,179,359,179,359,179,359,179,359,179,359,179,359,179,359,179,359,179,359,179,359);
var rot_col_3_f1 = new Array(50,230,50,230,50,224,224,224,224,359,179,359,179,359,179,359,179,359,179,359,179,359,179,359,179,359,179,359,179,359,179,359,179,359,179,359,179,359,179,359,179,359,179,359,179,359,179,179,179,179);
var rot_col_4_f1 = new Array(230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,230,242,62,242,62,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179);
var rot_col_5_f1 = new Array(134,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179);
var rot_col_6_f1 = new Array(38,218,38,218,38,218,38,218,38,218,38,218,38,218,38,218,38,218,38,218,38,218,38,218,38,218,38,218,38,218,38,218,38,218,38,218,38,218,38,218,38,218,38,218,38,218,38,218,38,218);
var rot_col_7_f1 = new Array(269,89,269,89,269,89,269,89,269,89,269,89,269,89,269,89,269,89,269,89,269,89,269,89,269,89,269,89,269,89,269,89,269,89,269,89,269,89,269,89,269,89,269,89,269,89,269,89,269,89);
var rot_col_8_f1 = new Array(179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179);
var rot_col_9_f1 = new Array(17,197,17,197,17,197,17,197,17,197,17,197,17,197,17,197,17,197,17,197,17,197,17,197,17,197,17,197,17,197,17,197,17,197,17,197,17,197,17,197,17,197,17,197,17,179,179,179,179,179);
var rot_col_10_f1 = new Array(167,347,167,347,167,347,167,347,167,347,167,347,167,347,167,347,167,347,167,347,167,347,167,347,167,347,167,347,167,347,167,347,167,347,167,347,167,347,167,347,167,347,359,359,359,359,359,359,359,359);
var rot_col_11_f1 = new Array(278,278,278,278,278,278,278,2,182,2,182,2,182,2,182,2,182,2,182,2,182,2,182,2,182,2,182,2,182,2,182,2,182,2,182,2,182,2,182,2,182,2,182,2,179,179,179,179,179,179);
var rot_col_12_f1 = new Array(104,284,104,284,104,284,104,284,104,284,104,284,104,284,104,284,104,284,104,284,104,284,104,284,104,284,104,284,104,284,104,284,104,284,104,284,104,284,104,284,104,284,359,359,359,359,359,359,359,359);
var rot_col_13_f1 = new Array(269,89,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179);
var rot_col_14_f1 = new Array(35,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179);
var rot_col_15_f1 = new Array(179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179);
var rot_col_16_f1 = new Array(305,125,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179);
var rot_col_17_f1 = new Array(98,98,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179);
var rot_col_18_f1 = new Array(359,359,167,347,167,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179);
var rot_col_19_f1 = new Array(284,305,125,305,125,305,125,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179);
var rot_col_20_f1 = new Array(179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179);
var rot_col_21_f1 = new Array(179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179);
var rot_col_22_f1 = new Array(224,335,155,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179);
var rot_col_23_f1 = new Array(71,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179);
var rot_col_24_f1 = new Array(65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65);
var rot_col_25_f1 = new Array(167,167,167,167,167,167,167,167,167,167,167,167,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179);
var rot_col_26_f1 = new Array(71,251,71,251,71,251,71,251,71,251,71,251,71,251,71,251,71,251,71,251,71,251,71,251,71,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179);
var rot_col_27_f1 = new Array(68,248,68,248,68,248,68,248,68,248,68,248,68,248,68,248,68,248,68,248,68,248,68,248,68,248,68,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179);
var rot_col_28_f1 = new Array(146,326,146,326,146,326,146,326,146,326,146,326,146,326,146,326,146,326,146,326,146,326,146,326,146,326,146,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179);
var rot_col_29_f1 = new Array(194,14,194,14,194,14,194,14,194,14,194,14,194,14,194,14,194,14,194,14,194,14,194,14,194,14,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179);


var nCollumns = 10;
var nCells = 5

var nFrames = 1;



// create objects
for(var col = 0; col < nCollumns; col++) {
	for(var cell = 0; cell < nCells; cell++) {
		var cellShape = CreatePrim("Cube", "MeshSurface", "c_"+col+"_"+cell, null);
		Translate(cellShape, col*10, cell*10, 0, siRelative, siView, siObj, siXYZ, null, null, null, null, null, null, null, null, null, 0, null);
	}
}

// set keyframes
for(var frame = 1; frame <= nFrames; frame++) {
	// those 2 go paired
	SetValue("PlayControl.Key", frame, null);
	SetValue("PlayControl.Current", frame, null);
	for(var col = 0; col < nCollumns; col++) {
		for(var cell = 0; cell < nCells; cell++) {
			var target = "c_"+col+"_"+cell;
			// how to get array value?
			LogMessage("rot_col_"+col+"_f1");
	
			Rotate(target, 0, -15.1887379601143, 0, siRelative, siLocal, siObj, siXYZ, null, null, null, null, null, null, null, 0, null);
			SaveKey(target+".kine.local.rotx,"+target+".kine.local.roty,"+target+".kine.local.rotz", 1, null, null, null, false, null);
		}
	}
}

User avatar
xsisupport
Posts: 713
Joined: 09 Jun 2009, 11:02
Location: Montreal Canada
Contact:

Re: how to get data out of array - JScript

Post by xsisupport » 31 Oct 2012, 11:52

// Steve Blair
// "You're not a runner, you're just a guy who runs" -- my wife
//
// My Blogs: Arnold | Softimage

Post Reply

Who is online

Users browsing this forum: No registered users and 16 guests