Macro Problem

Macro Problem

by Bluedoc » Tue Feb 23, 2016 1:16 am

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.

/run local c=CastSpellByName if UnitExists("pet") then UnitAffectingCombat("player")=1 c("Mend Pet") elsethen 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

Here's what i came up with to if in combat, cast mend pet, but it doesn't work and i'm not very experienced with this, so i don't know how to fix, or if it's supposed to work...
Bluedoc
Private
Private
 

Re: Macro Problem

by rexxie » Tue Feb 23, 2016 2:06 pm

First at all, you macro is more then 255 characters so you cant use it as "normal" macro, you maybe need to use SuperMacro or similar but it does not work for me anyways.

Here is you Macro shortened to 291 characters
but it dont work for me not even in Supermacro:
Code: Select all
/run local c=CastSpellByName;if UnitExists("pet")then if GetPetHappiness()and GetPetHappiness()~=3 then c("Feed Pet");PickupContainerItem(3,14)elseif UnitHealth("pet")==0 then c("Revive Pet")elseif UnitAffectingCombat("player")then c("Mend Pet")else c("Dismiss Pet")end;else c("Call Pet")end


Macro without feed pet, just 198 characters:
Code: Select all
/run local c=CastSpellByName;if UnitExists("pet")then if UnitHealth("pet")==0 then c("Revive Pet")elseif UnitAffectingCombat("player")then c("Mend Pet")else c("Dismiss Pet")end else c("Call Pet")end

maybe you can make an extra feed pet macro :)
rexxie
Tester
 

Re: Macro Problem

by Bluedoc » Tue Feb 23, 2016 7:26 pm

The original macro works without Supermacro and is 250 characters, the other one with Mend pet, doesn't work, and do require Supermacro because it's over 255, but i can't get it to work...
Bluedoc
Private
Private
 

Re: Macro Problem

by Payoff » Sat Feb 27, 2016 5:52 pm

try this if you have supermacro:

left (macro) section
Code: Select all
/run petMacro()


right (extended lua) section
Code: Select all
function petMacro()
   if UnitExists("pet") then
      if UnitHealth("pet")==0 then
         cast("Revive Pet")
      elseif UnitHealth("pet")~=UnitHealthMax("pet") then
         cast("Mend Pet")
      elseif GetPetHappiness()~=nil and GetPetHappiness()~=3 then
         cast("Feed Pet");PickupContainerItem(3,14)
      else
         cast("Dismiss Pet")
      end
   else
      cast("Call Pet")
   end
end


otherwise just split it into two macros:

call/dismiss
Code: Select all
/run local c=CastSpellByName;if UnitExists("pet") then c("Dismiss Pet") else c("Call Pet") end


revive/heal/feed
Code: Select all
/run local c=CastSpellByName;if UnitHealth("pet")==0 then c("Revive Pet") elseif UnitHealth("pet")~=UnitHealthMax("pet") then c("Mend Pet") elseif GetPetHappiness()~=nil and GetPetHappiness()~=3 then c("Feed Pet");PickupContainerItem(3,14) end
Payoff
Private
Private
 

Re: Macro Problem

by Hoodai » Thu Jan 11, 2018 8:41 am

Hey, I know this is super delayed and may be considered necro but I was hoping to provide anyone who found this post a solution that did not require two macros or an addon.

Code: Select all
/run c=CastSpellByName p="pet" h=UnitHealth(p)if not UnitExists(p)then c("Call Pet")elseif h<1 then c("Revive Pet")elseif GetPetHappiness()<3 then c("Feed Pet")PickupContainerItem(3, 12)elseif h<UnitHealthMax(p)then c("Mend Pet")else c("Dismiss Pet")end


Thanks, you may resume.
Hoodai
Tester
 


Return to Hunter