Using variable in map list [i]
Hey folks, I'm using this bit of code:
for i = 1 to rows do ( currentRow = i for i = ((currentRow*framesAcross)-(framesAcross-1)) to (framesAcross*(currentRow)) do ( theComp.mapList[i].coords.V_Offset = ((spriteHeightOffset*currentRow)-spriteHeightOffset) rowSet = currentRow theComp.mapList[((rowSet)*(i))].coords.U_Offset = 1 ) )
Basically, when it gets to:
theComp.mapList[((rowSet)*(i))].coords.U_Offset = 1
It errors "-- Unknown property: "coords" in undefined <<"
If I change the variable rowSet to a number it's then fine.
So... is it not being able to read the variable (that's why I created rowSet because I thought it wasn't able to read currentRow)... so... if there any way I can get it to read it?
Comments
First, using two i-loops is a
First, using two i-loops is a bit counterintuitive, when the first one is basically
for currentRow = 1 to rows do ...
anyway. Second, if you don't have just a very few iterations going on in the second loop, not only is assigning the start-range and end-range value to a variable easier to read, it's also faster in effect. The rowSet assignment doesn't change anything for sure, what you get there is most likely a numberi
for whichtheComp.mapList[i]
returns undefined. You should be able to see the number in the stack trace when it errors out...Some of my scripts and MCGs :: 3ds Max SDK Intro for Scripters