I have this macro that takes care of my pet, and i tryed to add some stuff to it to make it do a little more, here's the original:

/run local c=CastSpellByName if UnitExists("pet") then if UnitHealth("pet")==0 then c("Revive Pet") elseif GetPetHappiness()~=nil and GetPetHappiness()~=3 then c("Feed Pet") PickupContainerItem(3, 14) else c("Dismiss Pet") end else c("Call Pet") end

Basically, it revives my pet if dead, feed if hungry and dismiss if fed and alive.