I've read the guide and the reference entry, but I'm still having trouble with multidimensional lists. I'd like to define one that has a variable lenght, not a static length, so something like: groups[10][5] will not work for me.
I am using a proc to create this MDlist for another proc to reference. The purposes of this proc is to search through a list of players, sort them by the value of a particular variable they have on them, and then group them into the MDlist according to that value.
So, for example:
player1.color = red
player2.color = green
player3.color = blue
player4.color = yellow
player5.color = red
player6.color = green
player7.color = blue
player8.color = yellow
I would like the multidemensional list to be something like:
groups[red] = list(player1, player5)
etc...
Again, the number of colors and the number of players that could belong to each color are variable every time this proc is called, so I can't simply do groups[4][4].
This isn't my exact proc, because my exact proc is pretty garbled by now. This is what I would like to do with it, though.
The way I've tried to do it is first gather a list of all the colors that exist and put them into a temporary list, called temp. These colors are strings, of course. Then, I tried to make group[] = temp (the first dimension). Then, for each group, I ran through all the players in the area and if they had the right color, put them into group[color][index].
When the list is supposed to be converted into a string and displayed, nothing shows!
=$= Big J Money =$=
ID:147620
Feb 29 2004, 8:29 am
|
|
Feb 29 2004, 8:46 am
|
|
Here is an example, that will show you how you can manipulate multi-dimensional lists (I hope!).
|