• You've discovered RedGuides 📕 an EverQuest multi-boxing community 🛡️🧙🗡️. We want you to play several EQ characters at once, come join us and say hello! 👋
  • IS THIS SITE UGLY? Change the look. To dismiss this notice, click the X --->

Macro - Multidimensional Array in MAC file? (1 Viewer)

Joined
May 5, 2021
RedCents
10¢
Is it possible to make a multidimentional array in a macro ?? I don't know Lua.. and i need to be able to create a multidimental array.

Basicly.. I have a routine that pulls back 5 numbers.. and associates each number with a string value... once i run the values through a loop to get the lowest number.. i need to return the associated string value for that array item...

So.. like this:

array slot --- value --- String
1 ---- 142 ---- Head
2 ---- 221 ---- Feet
3 ---- 65 ---- Arms
4 ---- 76 ---- Chest
5 ---- 9 ---- Neck


Once i run through the loop to pull back the LOWEST number valuer for the list set of the array value ( 142/221/65/76/9 ) .. it returns back 9 ... correctly.. but i need set the STRING value associated with the array slot for value 9 ... ( NECK )

Is this doable??

I know how to setup a 2 dimentional array and pull back a value... but not 3....

INI:
    /declare x int local
    /declare myArray[5] int local

    /varset myArray[1] ${Guk_WinsToGo}
    /varset myArray[2] ${Miragul_WinsToGo}
    /varset myArray[3] ${Mistmoore_WinsToGo}
    /varset myArray[4] ${Ruj_WinsToGo}
    /varset myArray[5] ${Tak_WinsToGo}
    
    |set a default value for the greatestNumber, the first entry in the array works well
    /declare greatestNumber int local ${myArray[1]}
    |start at 2 since we already have the first value loaded, no reason to compare it to itself.
    /for x 2 to ${myArray.Size}
        |if myArray[x] is lower than the currently set lowest number
        /if (${myArray[${x}]} > ${greatestNumber}) {
            |set the lowest number to myArray[x]
            /varset greatestNumber ${myArray[${x}]}
        }
    /next x
 
Declare Three Dimensional Array in Macro Code:
/declare myArray[10,10,10]

In Lua its a bit different:
Maybe a bit harder to get your head around - but i urge you to try. Use ChatGPT to clarify stuff - because it knows Lua quite well.

Lua 3 Dimensional Array:
local array = {}

for i = 1, 10 do
  array[i] = {} -- Create the second dimension
  for j = 1, 10 do
    array[i][j] = {} -- Create the third dimension
    for k = 1, 10 do
      array[i][j][k] = whatever you like
    end
  end
end
 
Macro - Multidimensional Array in MAC file?

Users who are viewing this thread

Back
Top