Quantcast
Battle Pet revive / bandage macro - WoWInterface
Thread Tools Display Modes
01-23-16, 11:28 AM   #1
Voxxel
A Chromatic Dragonspawn
Join Date: Mar 2009
Posts: 191
Question Battle Pet revive / bandage macro

Hi, I'm looking for a macro to use "Revive battle pets" when it's up and use bandages while Revive is on cooldown.

So far I found this one at warcraftpets.com:
Code:
/castsequence [nomod] reset=480 Revive Battle Pets, Battle Pet Bandage
/use [mod] Battle Pet Bandage
but has a problem: It can use only 1 bandage while the Revive is on cooldown.

I need a macro without modifiers to use bandages over and over until the Revive becomes castable.
Is that possible somehow?

Last edited by Voxxel : 01-23-16 at 11:35 AM. Reason: "without modifiers"
  Reply With Quote
01-23-16, 12:56 PM   #2
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,215
The problem with /castsequence is the timer resets every time you run the macro. Adding more bandages at the end will cause it to wait 4 minutes since the last time you used a bandage too. At this point, you'd be better off using macro conditionals. I'm assuming this will be a click macro instead of a keybind.
Code:
/cast [btn:2] Battle Pet Bandage; Revive Battle Pets
This uses bandages when you right-click and revive when you left-click.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)

Last edited by SDPhantom : 01-23-16 at 01:01 PM.
  Reply With Quote
01-23-16, 01:24 PM   #3
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Other than the timer, mod usage, or right/left button clicks, there is no way for a macro to account for cooldowns. This is intentional by Blizzard. They want you to make the decision of what abilities to use.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
01-23-16, 01:33 PM   #4
Voxxel
A Chromatic Dragonspawn
Join Date: Mar 2009
Posts: 191
This uses bandages when you right-click and revive when you left-click.
I edited my post to include "without modifiers" because I need it without modifiers.

Anyway, I just took a look over GnomeSequencer addon. I'm pretty sure GS can do the trick but I have no idea how to change the code of StepFunction to let the addon execute steps like 1 2 3 instead of the stock 1 12 123.
  Reply With Quote
01-23-16, 03:29 PM   #5
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
Originally Posted by Seerah View Post
Other than the timer, mod usage, or right/left button clicks, there is no way for a macro to account for cooldowns. This is intentional by Blizzard. They want you to make the decision of what abilities to use.
This actually can be done outside of combat, which probably isn't a big deal for reviving battle pets, it's just that no existing addon is really designed to support doing something like this.

Originally Posted by Voxxel View Post
Anyway, I just took a look over GnomeSequencer addon. I'm pretty sure GS can do the trick but I have no idea how to change the code of StepFunction to let the addon execute steps like 1 2 3 instead of the stock 1 12 123.
By default GnomeSequencer executes macros in the order they're stored, all you have to do is not include a step function. It won't switch back to "Revive Battle Pets" automatically when its cooldown is finished, so I wouldn't recommend using GS for this.

Last edited by semlar : 01-23-16 at 03:39 PM.
  Reply With Quote
01-23-16, 06:03 PM   #6
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,215
Originally Posted by Voxxel View Post
I edited my post to include "without modifiers" because I need it without modifiers.
Switching based on what button you click with aren't modifiers. You don't hold down any key for it to work, you just click a different mouse button. It's really that simple and takes no extra effort.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote
01-23-16, 06:42 PM   #7
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
Paste this into addon.bool.no to create an addon:
Lua Code:
  1. local button, REVIVE_BATTLE_PETS = CreateFrame('button', 'SmartRez', nil, 'SecureActionButtonTemplate'), GetSpellInfo(125439)
  2. button:SetAttribute('type', 'macro')
  3. button:SetScript('PreClick', function(self)
  4.     if InCombatLockdown() then return end
  5.    
  6.     local injured = false
  7.     for i = 1, 3 do -- Determine whether any pet in our loadout is actually injured
  8.         local guid = C_PetJournal.GetPetLoadOutInfo(i)
  9.         if guid then
  10.             local health, maxHealth = C_PetJournal.GetPetStats(guid)
  11.             if health < maxHealth then
  12.                 injured = true
  13.                 break
  14.             end
  15.         end
  16.     end
  17.     if not injured then
  18.         DEFAULT_CHAT_FRAME:AddMessage('Pets are already at full health!', 1, 1, 0)
  19.         self:SetAttribute('macrotext', nil)
  20.         return
  21.     end
  22.    
  23.     if GetSpellCooldown(125439) == 0 then -- "Revive Battle Pets" is off cooldown, cast that
  24.         self:SetAttribute('macrotext', '/cast ' .. REVIVE_BATTLE_PETS)
  25.     else
  26.         self:SetAttribute('macrotext', '/use item:86143')
  27.     end
  28. end)

Once you've loaded that, make a macro like this to use it:
Lua Code:
  1. #showtooltip Revive Battle Pets
  2. /click [nocombat] SmartRez
  3. /cast [combat] Revive Battle Pets

It will use the spell if it's off cooldown or if you're in combat, otherwise it will use a bandage. I'm not going to bother including code to update the icon based on what it's going to cast since it's largely unnecessary and probably more useful to see the remaining cooldown of Revive Battle Pets instead.

Last edited by semlar : 01-23-16 at 07:00 PM.
  Reply With Quote
01-24-16, 01:23 AM   #8
Voxxel
A Chromatic Dragonspawn
Join Date: Mar 2009
Posts: 191
Originally Posted by SDPhantom View Post
Switching based on what button you click with aren't modifiers. You don't hold down any key for it to work, you just click a different mouse button. It's really that simple and takes no extra effort.
Sorry about that mate, I don't know the exact technical term to express what I need here, which is only just a one-button to heal my pets with Revive (or bandages if Revive is not up) without modifying the user method of casting/pressing input.

Thank you for your help anyway!
  Reply With Quote
01-24-16, 01:24 AM   #9
Voxxel
A Chromatic Dragonspawn
Join Date: Mar 2009
Posts: 191
Originally Posted by semlar View Post
It will use the spell if it's off cooldown or if you're in combat, otherwise it will use a bandage. I'm not going to bother including code to update the icon based on what it's going to cast since it's largely unnecessary and probably more useful to see the remaining cooldown of Revive Battle Pets instead.
Works perfectly, exactly what I needed! Thank you very much, Semlar!
  Reply With Quote
11-06-22, 12:00 PM   #10
Shadowlord
A Kobold Labourer
Join Date: Dec 2006
Posts: 1
Please Fix

Originally Posted by semlar View Post
Paste this into addon.bool.no to create an addon:
Lua Code:
  1. local button, REVIVE_BATTLE_PETS = CreateFrame('button', 'SmartRez', nil, 'SecureActionButtonTemplate'), GetSpellInfo(125439)
  2. button:SetAttribute('type', 'macro')
  3. button:SetScript('PreClick', function(self)
  4.     if InCombatLockdown() then return end
  5.    
  6.     local injured = false
  7.     for i = 1, 3 do -- Determine whether any pet in our loadout is actually injured
  8.         local guid = C_PetJournal.GetPetLoadOutInfo(i)
  9.         if guid then
  10.             local health, maxHealth = C_PetJournal.GetPetStats(guid)
  11.             if health < maxHealth then
  12.                 injured = true
  13.                 break
  14.             end
  15.         end
  16.     end
  17.     if not injured then
  18.         DEFAULT_CHAT_FRAME:AddMessage('Pets are already at full health!', 1, 1, 0)
  19.         self:SetAttribute('macrotext', nil)
  20.         return
  21.     end
  22.    
  23.     if GetSpellCooldown(125439) == 0 then -- "Revive Battle Pets" is off cooldown, cast that
  24.         self:SetAttribute('macrotext', '/cast ' .. REVIVE_BATTLE_PETS)
  25.     else
  26.         self:SetAttribute('macrotext', '/use item:86143')
  27.     end
  28. end)

Once you've loaded that, make a macro like this to use it:
Lua Code:
  1. #showtooltip Revive Battle Pets
  2. /click [nocombat] SmartRez
  3. /cast [combat] Revive Battle Pets

It will use the spell if it's off cooldown or if you're in combat, otherwise it will use a bandage. I'm not going to bother including code to update the icon based on what it's going to cast since it's largely unnecessary and probably more useful to see the remaining cooldown of Revive Battle Pets instead.

@semlar This worked for me until Dragon Flight Phase 1 Release. Can anyone provided the required fixes to make it function again ?
__________________
http://i.imgur.com/dZ0xMFx.png
  Reply With Quote
11-11-22, 09:10 PM   #11
whobdobub
A Kobold Labourer
Join Date: Oct 2020
Posts: 1
I Messaged hhim this is what he sent me. The only thing i needed to change to make it work agaion was this part - /click [nocombat] SmartRez LeftButtonDown


here ius what he said in case you need to change more.

Try changing this line in the macro from

Lua Code:
/click [nocombat] SmartRez

to

Lua Code:
/click [nocombat] SmartRez LeftButtonDown

You may also need to add this to the bottom of the lua file:

Lua Code:
button:RegisterForClicks("LeftButtonDown", "LeftButtonUp")
  Reply With Quote
11-27-22, 04:56 PM   #12
dashifen
A Kobold Labourer
Join Date: May 2009
Posts: 1
The above modifications didn't work (for me). It's entirely possible that I did something wrong, but maybe there's more tweaking to do? If anyone figures it out, I'd love to hear about it, too!
  Reply With Quote
01-27-23, 10:00 AM   #13
dreadking666
A Kobold Labourer
Join Date: Jan 2023
Posts: 1
same for me
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » Macro Help » Battle Pet revive / bandage macro

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off