• You've discovered RedGuides, an EverQuest multi-boxing and scripting community 🧙‍♀️⚙️. We want you to play several EQ characters at once, come join us and say hello! 👋

  • A TLP without truebox has thawed (Very Vanilla ready)
    Frostreaver

Question - Creating an array with a list of values

Rare Spawn

Well-known member
Joined
Oct 10, 2022
RedCents
3,282¢
Hello Coders,
Can someone show me a better way to do this? I need a list of values for a /for loop. Thanks!

Code:
    /declare Shift[10] float local 0
    /varset Shift[1] 0.00
    /varset Shift[2] 356.00
    /varset Shift[3] 4.00
    /varset Shift[4] 352.00
    /varset Shift[5] 8.00
    /varset Shift[6] 348.00
    /varset Shift[7] 12.00
    /varset Shift[8] 344.00
    /varset Shift[9] 16.00
    /varset Shift[10] 340.00
 
Hello Coders,
Can someone show me a better way to do this? I need a list of values for a /for loop. Thanks!

Code:
    /declare Shift[10] float local 0
    /varset Shift[1] 0.00
    /varset Shift[2] 356.00
    /varset Shift[3] 4.00
    /varset Shift[4] 352.00
    /varset Shift[5] 8.00
    /varset Shift[6] 348.00
    /varset Shift[7] 12.00
    /varset Shift[8] 344.00
    /varset Shift[9] 16.00
    /varset Shift[10] 340.00
Lua:
local values = {0, 356, 4, 352, 8, 348, 12, 344, 16}
 
you could make it a string, then use .Arg to loop through the values

Code:
sub main
    /declare my_numbers string  local 0  356 4 352 8 348 12 344 16
    /declare i          int     local 0
   
    /for i 1 to ${my_numbers.Count[ ]}
        /echo ${i} ${my_numbers.Arg[${i},]}
    /next i

/return

the my_numbers string, starts with a space, it does that to make sure .Count[ ] counts tyhe right number of spaces

also the string cant be more than 2048 long including spaces, or it blows up
 
Last edited:
Question - Creating an array with a list of values

Users who are viewing this thread

Back
Top
Cart