Multidimensional Arrays?

Non-platform specific questions.

Multidimensional Arrays?

Postby poopbrigade » Wed Feb 02, 2011 11:37 am

Umm hello every one how do you code Multidimensional Arrays in GE?

thanx in advance XD.
When life gives you oranges, make orange juice. When life gives you poop, make fertilizer not poop juice.

Image
Current project __ CorPsEdEaRtH
Estimated work done __ 12%
User avatar
poopbrigade
 
Posts: 129
Joined: Thu Aug 27, 2009 12:17 pm
Location: In Earth. Being Burried XD
Score: 46 Give a positive score

Re: Multidimensional Arrays?

Postby Bee-Ant » Wed Feb 02, 2011 12:04 pm

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" :D
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: Multidimensional Arrays?

Postby poopbrigade » Wed Feb 02, 2011 12:42 pm

XD thanx. so how do i add values to it?
When life gives you oranges, make orange juice. When life gives you poop, make fertilizer not poop juice.

Image
Current project __ CorPsEdEaRtH
Estimated work done __ 12%
User avatar
poopbrigade
 
Posts: 129
Joined: Thu Aug 27, 2009 12:17 pm
Location: In Earth. Being Burried XD
Score: 46 Give a positive score

Re: Multidimensional Arrays?

Postby Hblade » Wed Feb 02, 2011 4:30 pm

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
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: Multidimensional Arrays?

Postby poopbrigade » Thu Feb 03, 2011 1:57 am

XD thanx +!
When life gives you oranges, make orange juice. When life gives you poop, make fertilizer not poop juice.

Image
Current project __ CorPsEdEaRtH
Estimated work done __ 12%
User avatar
poopbrigade
 
Posts: 129
Joined: Thu Aug 27, 2009 12:17 pm
Location: In Earth. Being Burried XD
Score: 46 Give a positive score

Re: Multidimensional Arrays?

Postby Hblade » Thu Feb 03, 2011 9:49 am

your welcome, and thanks :3
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: Multidimensional Arrays?

Postby Game A Gogo » Fri Feb 04, 2011 9:10 pm

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!
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest