Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Arrays to list
- Blaze349
-
Scratcher
1000+ posts
Arrays to list
Does anyone know of a converter that converts arrays to list.
- fezzinate
-
Scratcher
100+ posts
Arrays to list
Not sure if I understand. In scratch a list is an array.
- Zro716
-
Scratcher
1000+ posts
Arrays to list
Not sure if I understand. In scratch a list is an array.I think he means converting a multi-dimensional array to a Scratch list (one-dimensional).
In that case I happen to have a simple formula for finding out the multi-dimensional position on a one-dimensional list:
define get item (a)(b)(c) . . . of listHopefully you get the idea that with each dimension the dimensions before it are multiplied together.
set [item v] to (item ((a) + (((a-size) * ((b) -(1))) + (((a-size) * (b-size)) * ((c) - (1))))) of [list v])
- Blaze349
-
Scratcher
1000+ posts
Arrays to list
Never mind I wanted to convert a 1-D array(with commas) to a scratch list (without commas). I figured it out now.Not sure if I understand. In scratch a list is an array.I think he means converting a multi-dimensional array to a Scratch list (one-dimensional).
In that case I happen to have a simple formula for finding out the multi-dimensional position on a one-dimensional list:define get item (a)(b)(c) . . . of listHopefully you get the idea that with each dimension the dimensions before it are multiplied together.
set [item v] to (item ((a) + (((a-size) * ((b) -(1))) + (((a-size) * (b-size)) * ((c) - (1))))) of [list v])



- forth
-
Scratcher
15 posts
Arrays to list
Not sure if I understand. In scratch a list is an array.I think he means converting a multi-dimensional array to a Scratch list (one-dimensional).
In that case I happen to have a simple formula for finding out the multi-dimensional position on a one-dimensional list:define get item (a)(b)(c) . . . of listHopefully you get the idea that with each dimension the dimensions before it are multiplied together.
set [item v] to (item ((a) + (((a-size) * ((b) -(1))) + (((a-size) * (b-size)) * ((c) - (1))))) of [list v])
Thanks, i like your post at the right time! Look at the germans: http://scratch.mit.edu/discuss/post/322996- BlazeStudios
-
New Scratcher
5 posts
Arrays to list
ThanksNot sure if I understand. In scratch a list is an array.I think he means converting a multi-dimensional array to a Scratch list (one-dimensional).
In that case I happen to have a simple formula for finding out the multi-dimensional position on a one-dimensional list:define get item (a)(b)(c) . . . of listHopefully you get the idea that with each dimension the dimensions before it are multiplied together.
set [item v] to (item ((a) + (((a-size) * ((b) -(1))) + (((a-size) * (b-size)) * ((c) - (1))))) of [list v])
- Discussion Forums
- » Help with Scripts
-
» Arrays to list