--[[
quick and dirty "companion" lua for EverQuest02 to cycle Aegis, Fort, and petdivine aura by Sic
thx for the assist from Aquietone
this is not intended to be a lesson or best practices
there is room for improvement
- checking that you're in combat
- checking you're not already casting a spell
- checking you're not moving
- checking you're not dead etc
]]
-- we need to include using "mq" to do "mq" stuff
local mq = require 'mq'
-- let's keep this going
local terminate = false
-- there are other ways to do this, but this works
-- we want info for the 3 AAs we want to cycle
local aegis = 'companion\'s aegis'
local aegisID = 441
local fort = 'companion\'s fortification'
local fortID = 3707
local petdivineaura = 'companion\'s intervening divine aura'
local petdivineauraID = 1580
-- this is a really quick and lazy way to see if an alt ability was ready
local function altabilitycheck(ability)
return mq.TLO.Me.AltAbilityReady(ability)()
end
-- this is a really quick and lazy way to use an aa by ID, and then print out that we're using it
local function useAltAbility(id)
-- this uses the aa
mq.cmdf('/alt act %i', id)
-- this formats stuff into a string so we can print it out
print(string.format('Companion.lua using alt ability %i', id))
-- we want a small delay (again very quick and simple)
mq.delay(1000)
end
-- we want to check that our pet doesn't have ANY of the 3 buffs
local function petBuffCheck(name1, name2, name3)
return not mq.TLO.Me.Pet.Buff(name1)() and not mq.TLO.Me.Pet.Buff(name2)() and not mq.TLO.Me.Pet.Buff(name3)()
end
-- this is our "main" function we're going to cycle through
local function main()
-- we're going to make sure our pet doesn't have any of the buffs before using an aa
if petBuffCheck(aegis, fort, petdivineaura) then
if altabilitycheck(aegis) then
useAltAbility(aegisID)
elseif altabilitycheck(fort) then
useAltAbility(fortID)
elseif altabilitycheck(petdivineaura)then
useAltAbility(petdivineauraID)
end
end
end
-- this will keep us cycling the main function with a small delay
while not terminate do
mq.delay(1000)
main()
end