|
Grif Beginner
Joined: 22 Dec 2002 Posts: 13 Location: USA
|
Posted: Sun Dec 22, 2002 5:31 pm
Arrays |
Is there an easy way to edit your arrays like you can your variables and triggers ect. through the Settings menu?
I see ways to get at: Alias, Triggers, Macros, Vars, Paths
But no way to get at the arrays stored in a var...when you goto the var all you see is <Array> ...and no way to edit it
Also, does Zmud allow for 2D, 3D, 4D ect arrays?
Thanks
--Grif-- |
|
|
|
Charbal GURU
Joined: 15 Jun 2001 Posts: 654 Location: USA
|
Posted: Sun Dec 22, 2002 7:19 pm |
Arrays were provided mainly for COM interoperability... however, as you've no doubt found, they can be quite useful in scripts.
The Settings Editor in 6.16 is not able to edit arrays directly. Things show up as <Array> as you've seen.
However, since 6.20, you can edit arrays in the Settings Editor. Even though they appear like stringlists, the array datatype is preserved when you edit them.
So if you upgrade to the public version 6.40, this will be an option.
As for multi-dimensional arrays... yes, it is possible, but not with native zMUD functions.
If you want to store an item in (x,y,z) where coordinates are in the range (0,0,0)-(max1,max2,max3), you can store it in element x*(max2+1)*(max3+1)+y*(max3+1)+z of a flat array.
So if max1, max2 and max3 are all 2, we have the following correspondences:
(0,0,0) 0
(0,0,1) 1
(0,0,2) 2
(0,1,0) 3
(0,1,1) 4
(0,1,2) 5
(0,2,0) 6
(0,2,1) 7
(0,2,2) 8
(1,0,0) 9
and so on.
And you could do the same thing for getting elements as well. Not the most elegant solution, of course, but workable. It may be better to use some other datatype, however. Depending on how you are using arrays, stringlists may suffice and those can be nested (in 6.40, not 6.16).
If this is regarding some specific thing you are trying to do and you post the problem, we might be able to find something more tractable than multi-dimensional arrays and stringlists.
- Charbal |
|
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|