• 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 - Stacking arguments in Lua

I am trying to convert the summon food and drink macro to a Lua. The first argument

Code:
if not mq.TLO.Me.Invis()
works, stops casting. If I add a check for moving

Code:
if not mq.TLO.Me.Invis() and not mq.TLO.Me.Moving()
It ignores the second argument. What am I doing wrong, lol?

I eventually want to add a check to make it only cast when ACTIVE or RESTING.

Thanks in advance.
 
Code:
if not mq.TLO.Me.Invis() and not mq.TLO.Me.Moving() and mq.TLO.Me.CombatState() ~= 'COMBAT' then

Should work. I'm still learning though.
 
A quick test: /lua parse if not mq.TLO.Me.Invis() and not mq.TLO.Me.Moving() then print('not active') end printed out the expected result for my character hanging around in the guild hall. Put a script together

Lua:
---@type Mq
local mq = require('mq')

if not mq.TLO.Me.Invis() and not mq.TLO.Me.Moving() then
    print('not active')
end

and got the same result.

Post your code. Maybe we can offer a better answer.
 
This didn't start out as my coding. Originally posted by PolDetson. I am just modifying it for safety checks. I applied the suggestion of burdsjm, and now it works. If I change COMBAT to ACTIVE will it wait until after cooldown to begin summoning again after combat?

Lua:
-- SummonFood.lua - by PolDetson
-- Modified to Snacks.lua by Randyleo for more safety checks
--
-- This requires the Warm Milk Dispenser & Fresh Cookie Dispenser
--
-- version 1.2
local mq = require('mq')

while true do

  if mq.TLO.FindItemCount(52199)() < 5 then
        if not mq.TLO.Me.Invis() and not mq.TLO.Me.Moving() and mq.TLO.Me.CombatState() ~= 'COMBAT' and mq.TLO.FindItem("Warm Milk Dispenser")() ~= nil and mq.TLO.FindItem("Warm Milk Dispenser").TimerReady() then
      mq.cmd.echo('\agSummoning Milk\ap')
      mq.cmd('/useitem "Warm Milk Dispenser"')
      mq.delay('2s')
      mq.cmd('/autoinventory')
    end
  end

  if mq.TLO.FindItemCount(71980)() < 5 then
    if not mq.TLO.Me.Invis() and not mq.TLO.Me.Moving() and mq.TLO.Me.CombatState() ~= 'COMBAT' and mq.TLO.FindItem("Fresh Cookie Dispenser")() ~= nil and mq.TLO.FindItem("Fresh Cookie Dispenser").TimerReady() then
      mq.cmd.echo('\agSummoning Cookie\ap')
      mq.cmd('/useitem "Fresh Cookie Dispenser"')
      mq.delay('2s')
      mq.cmd('/autoinventory')
    end
  end

  mq.delay('8s')
end;
 
Last edited by a moderator:
Made suggested change.


Code:
-- SummonFood.lua - by PolDetson
-- Modified to Snacks.lua by Randyleo for more safety checks
--
-- This requires the Warm Milk Dispenser & Fresh Cookie Dispenser
--
-- version 1.2
local mq = require('mq')

while true do

  if mq.TLO.FindItemCount(52199)() < 5 then
        if not mq.TLO.Me.Invis() and not mq.TLO.Me.Moving() and mq.TLO.Me.CombatState() ~= 'COMBAT' and mq.TLO.FindItem("Warm Milk Dispenser")() ~= nil and mq.TLO.FindItem("Warm Milk Dispenser").TimerReady() then
      print('\agSummoning Milk\ap')
      mq.cmd('/useitem "Warm Milk Dispenser"')
      mq.delay('2s')
      mq.cmd('/autoinventory')
    end
  end

  if mq.TLO.FindItemCount(71980)() < 5 then
    if not mq.TLO.Me.Invis() and not mq.TLO.Me.Moving() and mq.TLO.Me.CombatState() ~= 'COMBAT' and mq.TLO.FindItem("Fresh Cookie Dispenser")() ~= nil and mq.TLO.FindItem("Fresh Cookie Dispenser").TimerReady() then
      print('\agSummoning Cookie\ap')
      mq.cmd('/useitem "Fresh Cookie Dispenser"')
      mq.delay('2s')
      mq.cmd('/autoinventory')
    end
  end

  mq.delay('8s')
end;
 
Question - Stacking arguments in Lua

Users who are viewing this thread

Back
Top
Cart