Multidimensional Arrays?
Posted:
Wed Feb 02, 2011 11:37 am
by poopbrigade
Umm hello every one how do you code Multidimensional Arrays in GE?
thanx in advance XD.
Re: Multidimensional Arrays?
Posted:
Wed Feb 02, 2011 12:04 pm
by Bee-Ant
Go to Script->Global code
Then type any array you want, for example:
- Code: Select all
int Array[100][100];
Then type the list name in the textbox then click "Add"
Re: Multidimensional Arrays?
Posted:
Wed Feb 02, 2011 12:42 pm
by poopbrigade
XD thanx. so how do i add values to it?
Re: Multidimensional Arrays?
Posted:
Wed Feb 02, 2011 4:30 pm
by Hblade
Use this command to add values
- Code: Select all
Array[1][1] = 28;
Array[2][1] = 99;
Array[1][2] = 129;
theres examples :3 From his array variable you can have up to 100X100, so you can have about... 100,000 different usages for that one variable lol
Re: Multidimensional Arrays?
Posted:
Thu Feb 03, 2011 9:49 am
by Hblade
your welcome, and thanks :3
Re: Multidimensional Arrays?
Posted:
Fri Feb 04, 2011 9:10 pm
by Game A Gogo
important note
you decalre an array like so: int Array[100][100]
but if you inpute Array[100][100]=1; you will receive an error, that's because the array ID (The number) goes from 0 to 99, thus 100 possible slots
So when you're using an array, always take that in notice.
less important note:
even though Array[0][100]=1; will work, that's because of buffer overflow (I beleive, I'd have to google about this to know for sure), since Array[1][0] is stored after Array[0][99] in memory, the algebra behind the compiler will reach for that array since it doesn't exacly checks what's the maximum of the array size. Unless you're reading from Array[100][100] wouldn't work, because after Array[99][99] there is no more array data in memory (Probably data to inform the array is over).
also, if any of the formentioned information is untrue, please correct me!