• 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

Lua - Trade Summoned Item to Raid Pets

Joined
Nov 5, 2018
RedCents
2,501¢
This might be a niche situation so just posting as a script to share. I use this to summon 14x Hammer of Souls and give them to my 14 mag pets in the raid. Spell name, summoned item name and number of pets can be adjusted with variables at the top of the script

[CODE lang="Lua" title="hammerpets.Lua"]local mq = require('mq')

--Trade code from GiveToMe by TheDroidUrLookingFor https://www.redguides.com/community/resources/give-to-me.2876/


local spellName = 'Hammer of Souls'
local summonedItemName = 'Hammer of Souls'
local numberOfPets = 14

local WaitTime = 750

local function InventoryOpen()
if mq.TLO.Window('InventoryWindow').Open() then return true else return false end
end
local function CheckCursor()
if mq.TLO.Cursor.ID() == 0 then return false else return true end
end
local function CursorEmpty()
if mq.TLO.Cursor.ID() == 0 then return true else return false end
end
local function HaveTarget()
if mq.TLO.Target.ID() ~= nil then return true else return false end
end

local function NavToTrade(navTarget)
mq.cmd('/nav target')
while mq.TLO.Navigation.Active() do
if (mq.TLO.Spawn(navTarget).Distance3D() < 20) then
mq.cmd('/nav stop')
end
mq.delay(50)
end
end

local function NavTarget(name, spawntype)
mq.cmd('/target "' .. name .. '" ' .. spawntype)
mq.delay(2000, HaveTarget)
mq.cmd('/face')

if mq.TLO.Spawn(name).Distance3D() > 20 then
NavToTrade(name)
end
end

local function ClickTrade()
mq.delay(WaitTime)
mq.cmd('/notify TradeWnd TRDW_Trade_Button leftmouseup')
mq.delay(WaitTime)
end

local function Give(itemName, qty)
if mq.TLO.FindItem(itemName).ID() ~= nil then
local itemSlot = mq.TLO.FindItem('='..itemName).ItemSlot()
local itemSlot2 = mq.TLO.FindItem('='..itemName).ItemSlot2()
local pickup1 = itemSlot - 22
local pickup2 = itemSlot2 + 1
--grab the whole stack, or specific amount
if qty ~= 'all' and mq.TLO.FindItem('='..itemName).StackCount() >= 1 then
qty = tonumber(qty)
mq.cmd('/itemnotify in pack' .. pickup1 .. ' ' .. pickup2 .. ' leftmouseup')
mq.delay(WaitTime)
mq.cmd('/notify QuantityWnd QTYW_Slider newvalue ' .. qty)
mq.delay(WaitTime)
mq.cmd('/notify QuantityWnd QTYW_Accept_Button leftmouseup')
else
mq.cmd('/shift /itemnotify in pack' .. pickup1 .. ' ' .. pickup2 .. ' leftmouseup')
end
--Give it
mq.delay(WaitTime, CheckCursor)
mq.cmd('/click left target')
mq.delay(WaitTime, CursorEmpty)
end
end

if mq.TLO.MacroQuest.GameState() == 'INGAME' then
--Summon 14 hammers if we don't have any in inventory
if mq.TLO.FindItem(summonedItemName).ID() == nil then
for i=1,numberOfPets do
--cast Hammer of souls
mq.cmdf('/cast %s', spellName)
while mq.TLO.Me.Casting() or not mq.TLO.Me.SpellReady(spellName)() do
mq.delay(1000)
end
mq.delay(100)
mq.cmdf('/autoinventory')
end
end

--Give them to all the mage pets
--For each raid member
local raidMemberCount = mq.TLO.Raid.Members()
InventoryOpen()
for i=1,raidMemberCount do
if mq.TLO.Me.CleanName() ~= mq.TLO.Raid.Member(i).CleanName() and mq.TLO.Raid.Member(i).Pet() ~= 'NO PET' then
local spawntype = 'pet'
NavTarget(mq.TLO.Raid.Member(i).Pet(), spawntype)

Give(summonedItemName, 1)

ClickTrade()

end
end
end[/CODE]
 
Lua - Trade Summoned Item to Raid Pets

Users who are viewing this thread

Back
Top
Cart