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

Joined
May 21, 2014
RedCents
994¢
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