Page 1 of 1

Global Arrays

Posted: Mon Mar 22, 2004 3:20 pm
by gillgian
Are arrays global? I want to make an array for moblist and i would need to access that list through the program. In the manual i see local, global and array. Do i need to do this:

Code: Select all

/define MobList global array
I didnt see anything in the manual or on the forums concerning this. Thanks in advance

Posted: Mon Mar 22, 2004 3:36 pm
by Lax
Arrays are technically global, but are destroyed when the macro ends unless specified.

Posted: Mon Mar 22, 2004 4:08 pm
by gillgian
Ah, Another question i had concerning "arrays" is how to clear em. I assume the programmer is responsible for maintaning the count of an array. Example:

Code: Select all

| To clear the array set count to -1
/varset somearray_count -1
The only problem i see with this the actual memory allocation for this array is still in memory. Is this acceptable? I did see the /zapvars command but did not see how i could clear an individual array.

oh, should i be asking these questions in the macro help section? sorry to spam this area with questions not related to mq2 specifically

Posted: Mon Mar 22, 2004 9:59 pm
by ml2517
Yes you have to keep count of your array elements yourself.


As far as I know there is no way to clear arrays besides /zapvars and/or ending the macro.

But you *can* re-use the array elements by just changing their values. I do this all of the time. As long as you keep the count accurate you will be fine.