Global Arrays

Need help running MacroQuest2? Ask your questions about how to get things to work on your computer.

Moderator: MacroQuest Developers

gillgian
orc pawn
orc pawn
Posts: 18
Joined: Tue Mar 16, 2004 3:09 pm

Global Arrays

Post by gillgian » Mon Mar 22, 2004 3:20 pm

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

Lax
We're not worthy!
We're not worthy!
Posts: 3524
Joined: Thu Oct 17, 2002 1:01 pm
Location: ISBoxer
Contact:

Post by Lax » Mon Mar 22, 2004 3:36 pm

Arrays are technically global, but are destroyed when the macro ends unless specified.
Lax Lacks
Master of MQ2 Disaster
Purveyor of premium, EULA-safe MMORPG Multiboxing Software
* Multiboxing with ISBoxer: Quick Start Video
* EQPlayNice, WinEQ 2.0

gillgian
orc pawn
orc pawn
Posts: 18
Joined: Tue Mar 16, 2004 3:09 pm

Post by gillgian » Mon Mar 22, 2004 4:08 pm

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

ml2517
a grimling bloodguard
a grimling bloodguard
Posts: 1216
Joined: Wed Nov 12, 2003 1:12 am

Post by ml2517 » Mon Mar 22, 2004 9:59 pm

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.