• 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

Lua - Function Call from EQ

I have my buffing routines setup like the following. 1 buffing file for each class. I am showing the Druid one. I am leaving out all the details of each function as it's not important

druid.petBuff = function()
Code:
local mq = require('mq')
local casting = require('casting')
local buffing = require('buffing')

local druid = {}

druid.selfBuff = function()
druid.partyBuff = function()
druid.petBuff = function()
druid.resistBuff = function()
druid.invisBuff = function()
return druid

When I want to have my party invis themselves, I do the following

From EQ
Code:
/bcga //lua run invis_routine

And my invis_routine file looks like
Code:
local class_name = mq.TLO.Me.Class.Name()
print(class_name)

if(class_name == "Druid") then
    druid.invisBuff()
elseif (class_name == "Beastlord") then
    beastlord.invisBuff()
elseif (class_name == "Enchanter") then
    enchanter.invisBuff()
elseif (class_name == "Magician") then
    mage.invisBuff()
else
    print('No invis buff routine for this ' .. class_name)
end

I was wondering if there was a way to do away with the invis_routine file and somehow call the functions directly from EQ. Something like
Code:
/bct Druid //lua run druid.invisBuff
/bct Mage //lua run mage.invisBuff
/bct Enchanter //lua run enchanter.invisBuff
/bct Beastlord //lua run beastlord.invisBuff
 
Last edited:
You can pass parameters to your script. For example:

Code:
/bct DruidName //lua run buffs druid invis

In your code, you have access to parameters like so:

args.lua
Lua:
local arguments = {...}

for index, value in ipairs(arguments) do
   print(index..', '..value)
end


Output
Code:
> /lua run args foo bar foobar
Running lua script 'args' with PID 1
1, foo
2, bar
3, foobar
Ending lua script 'args' with PID 1 and status 0
 
Right!!!!! I should have know that!
You might want to try not running the Lua from scratch each time. Not sure about your overall design, but you could consider something like:
Code:
function print_error()
  print('Invis not supported for this class!')
end
function do_invis()
  print('Casting invis!')
end

local invis_routine = print_error

if mq.TLO.Me.Class.ShortName() == 'BRD' then
  invis_routine = do_invis
end

local function invis_all()
  mq.cmd('/bcga //dinvis')
end

mq.bind('/binvis',invis_routine)
mq.bind('/binvisa',invis_all)

while true do
  mq.delay(1000)
end

You could then type /dinvis to invis current character, or /dinvisa to invis everyone running the invis Lua.
 
You might want to try not running the Lua from scratch each time. Not sure about your overall design, but you could consider something like:
Code:
function print_error()
  print('Invis not supported for this class!')
end
function do_invis()
  print('Casting invis!')
end

local invis_routine = print_error

if mq.TLO.Me.Class.ShortName() == 'BRD' then
  invis_routine = do_invis
end

local function invis_all()
  mq.cmd('/bcga //dinvis')
end

mq.bind('/binvis',invis_routine)
mq.bind('/binvisa',invis_all)

while true do
  mq.delay(1000)
end

You could then type /dinvis to invis current character, or /dinvisa to invis everyone running the invis Lua.
Let me think on this ... sounds intriguing ...
 
Lua - Function Call from EQ

Users who are viewing this thread

Back
Top
Cart