HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Multiple Arrays...

06-16-2004, 10:45 PM#1
Ninja73
o_O o_O o_O
Ok, im confused as shit! I have an array called like playernumber with a size of 10 and another array called votedgame with an array size of 30. How could i make a "double array" so that each player from 1 to 10 could each have their own slot in and array of 1-30. So like player 1 would have 30 slots and player 2 would have 30 and so on. Is there a way 2 do this without makeing 10 seprate variables with arrays of 30 each?
06-16-2004, 11:12 PM#2
th15
There are several ways to do this using the game cache. Personally I achieve 2-dimensional arrays by "nesting" my array numbers.

In your case i would have a single array that encompasses 100-130, 200-230 e.t.c all the way to 1200-1230. BTW the array "Size" that they ask you to set doesn't really do very much (you can exceed it at will). So, when I set the variable I would do this "Set DoubleArray[(Playernumberx100)+vote number] = VotedNumber"

Get me?
06-17-2004, 06:14 AM#3
Ninja73
I sorta get it, could u explain it a little more indepth of how i could use this as a contidion also like if doublearray...
06-17-2004, 03:22 PM#4
th15
When player 1 votes for vote #1, do this action (vote number is an integer variable that keeps track of which vote this is, VotedNumber is another integer variable that stores the number that the player voted for):
Set DoubleArray[(Playernumberx100)+vote number] = VotedNumber

This sets the value of DoubleArray[101] to be whatver VotedNumber is. So you see, with just 1 array, I've stored player number, vote count number and lastly the actual value that the player voted for.
06-18-2004, 01:12 AM#5
Ninja73
Thank You!