• Hail, we're RedGuides. We want you to play six (yes, 6!) EverQuest characters at once. We have scripts and a friendly community to help, please join our playstyle and say hello! 👋
  • We've added LLM sections to our Terms & Rules and Resource Rules, for everyone's sanity & in-game safety.
    Read more
    a. Do not replace your voice with an LLM. This goes for your posts and your scripts. Drafting and editing with a tool is fine, but don't take you out of what you share.
    b. Do not replace your EQ character's voice with an LLM. We don't want scripts that speak over /ooc, /shout or other public channels. This has been an unwritten rule that's kept casino scripts off the site for decades, but we're now compelled to make it clear: keep automated communication private.

    Why Does RG Review Scripts?
    Nearly every LLM-written Lua script we see is making your character do impossible things, and rarely in a way that's beneficial to you. We've seen heavy server hammering, /target over impossible distances when /nav spawn would passively accomplish the same thing, a spawn search that fires 20+ times per second, and other pointless actions that are likely annoying GMs.

    You are welcome to use LLMs as a tool to structure, draft, and edit your work, but please read critically before hitting /lua run

Question - Noob questions for a lua script

Hi all,
I am trying to convert a macro for buffing the raid into a much smarter Lua, but simple syntax things are smashing me.

Here is the Psuedo Psuedo Code for what I am trying to do:
  • Determine the Number of Raiders in the raid.
  • Create a 2 Dimensional Array equal in size to the number of raiders
  • Initialise all elements of the array to 0
  • Fill the array with the name, class
In the Lua Expression Builder i know
${Raid.Members} evaluates to 54
${Raid.Member[1].Class} = Shadow Knight
${Raid.Member[1].Name} = BOB (Not really..but it does Equate to my raid leaders name.)

The code is below:

The issues are:

1. As expected... my variable raiders is 54
but when i attempt to do a for loop: for i=1, raiders do it gives a for limit must be a number

ok..weird but moving on.....
I change the for to a hard coded 54 and move on....
It creates the Table within a Table for a 2 dimensional array

Next..im trying to populate the array with data from the raid Name and Class - but the mq.TLO.Raid.Member[toon_number].Name and mq.TLO.Raid.Member[toon_number].Class) now evaluates as NULL


test.lua
Code:
local mq = require 'mq'

raiders = mq.TLO.Raid.Members

mq.cmd('/echo The Raid Total Members: ',  raiders )


myRaid ={}
for i=1, raiders do
  myRaid[i] = {}     -- create a new row
  for j=1,2 do
    myRaid[i][j] = 0
    mq.cmd('/echo Init: ',i, j, myRaid[i][j])
  end
end

toon_number = 1
while toon_number <= raiders do

mq.cmd('/echo Toon_Number:', toon_number)

mq.cmd('/echo Toon_Number:', mq.TLO.Raid.Member[toon_number].Name)
mq.cmd('/echo Toon_Number:', mq.TLO.Raid.Member[toon_number].Class)

--    myRaid[toon_number][1] = mq.TLO.Raid.Member[toon_number].Name
--    myRaid[toon_number][2] = mq.TLO.Raid.Member[toon_number].Class
--   mq.cmd('/echo Adding toon:', myRaid[toon_Number][1], myRaid[toon_number][2])
    toon_number = toon_number + 1
end

Any assistance greatly appreciated.
 
Hi all,
I am trying to convert a macro for buffing the raid into a much smarter lua, but simple syntax things are smashing me.

Here is the Psuedo Psuedo Code for what I am trying to do:
  • Determine the Number of Raiders in the raid.
  • Create a 2 Dimensional Array equal in size to the number of raiders
  • Initialise all elements of the array to 0
  • Fill the array with the name, class
In the Lua Expression Builder i know
${Raid.Members} evaluates to 54
${Raid.Member[1].Class} = Shadow Knight
${Raid.Member[1].Name} = BOB (Not really..but it does Equate to my raid leaders name.)

The code is below:

The issues are:

1. As expected... my variable raiders is 54
but when i attempt to do a for loop: for i=1, raiders do it gives a for limit must be a number

ok..weird but moving on.....
I change the for to a hard coded 54 and move on....
It creates the Table within a Table for a 2 dimensional array

Next..im trying to populate the array with data from the raid Name and Class - but the mq.TLO.Raid.Member[toon_number].Name and mq.TLO.Raid.Member[toon_number].Class) now evaluates as NULL


test.lua
Code:
local mq = require 'mq'

raiders = mq.TLO.Raid.Members

mq.cmd('/echo The Raid Total Members: ',  raiders )


myRaid ={}
for i=1, raiders do
  myRaid[i] = {}     -- create a new row
  for j=1,2 do
    myRaid[i][j] = 0
    mq.cmd('/echo Init: ',i, j, myRaid[i][j])
  end
end

toon_number = 1
while toon_number <= raiders do

mq.cmd('/echo Toon_Number:', toon_number)

mq.cmd('/echo Toon_Number:', mq.TLO.Raid.Member[toon_number].Name)
mq.cmd('/echo Toon_Number:', mq.TLO.Raid.Member[toon_number].Class)

--    myRaid[toon_number][1] = mq.TLO.Raid.Member[toon_number].Name
--    myRaid[toon_number][2] = mq.TLO.Raid.Member[toon_number].Class
--   mq.cmd('/echo Adding toon:', myRaid[toon_Number][1], myRaid[toon_number][2])
    toon_number = toon_number + 1
end

Any assistance greatly appreciated.
Something like this?
Code:
local mq = require 'mq'

local raiders = mq.TLO.Raid.Members

mq.cmd('/echo The Raid Total Members: ',  raiders )


local myRaid ={}
for i=1, raiders() do
  myRaid[i] = {}     -- create a new row
  for j=1,2 do
    myRaid[i][j] = 0
    mq.cmd('/echo Init: ',i, j, myRaid[i][j])
  end
end

local toon_number = 1
while toon_number <= raiders() do

mq.cmd('/echo Toon_Number:', toon_number)

mq.cmd('/echo Toon_Number:', mq.TLO.Raid.Member[toon_number].Name)
mq.cmd('/echo Toon_Number:', mq.TLO.Raid.Member[toon_number].Class)

--    myRaid[toon_number][1] = mq.TLO.Raid.Member[toon_number].Name
--    myRaid[toon_number][2] = mq.TLO.Raid.Member[toon_number].Class
--   mq.cmd('/echo Adding toon:', myRaid[toon_Number][1], myRaid[toon_number][2])
    toon_number = toon_number + 1
end
 
Yep...that solved the first part.. so If I am accessing a TLO like mq.TLO.Raid.Members i need () on the end of the variable?

do I need to do something similar for mq.TLO.Raid.Member[1].Name
 
Yep...that solved the first part.. so If I am accessing a TLO like mq.TLO.Raid.Members i need () on the end of the variable?

do I need to do something similar for mq.TLO.Raid.Member[1].Name
Code:
local mq = require 'mq'

local raiders = mq.TLO.Raid.Members

mq.cmd('/echo The Raid Total Members: ',  raiders )


local myRaid ={}
for i=1, raiders() do
  myRaid[i] = {}     -- create a new row
  for j=1,2 do
    myRaid[i][j] = 0
    mq.cmd('/echo Init: ',i, j, myRaid[i][j])
  end
end

local toon_number = 1

while toon_number <= raiders() do
local Toon_Name = mq.TLO.Raid.Member(toon_number).Name()
local Toon_Class = mq.TLO.Raid.Member(toon_number).Class()
mq.cmd('/echo Toon_Number:', toon_number)
mq.cmd('/echo Toon_Name: ', Toon_Name)
mq.cmd('/echo Toon_Class: ', Toon_Class)

myRaid[toon_number][1] = mq.TLO.Raid.Member[toon_number].Name
myRaid[toon_number][2] = mq.TLO.Raid.Member[toon_number].Class
--mq.cmd('/echo Adding toon:', myRaid[toon_number][1], myRaid[toon_number][2])
    toon_number = toon_number + 1
end
 
Question - Noob questions for a lua script

Users who are viewing this thread

Back
Top
Cart