WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Macro Help (https://www.wowinterface.com/forums/forumdisplay.php?f=140)
-   -   Battle Pet revive / bandage macro (https://www.wowinterface.com/forums/showthread.php?t=53084)

Voxxel 01-23-16 11:28 AM

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?

SDPhantom 01-23-16 12:56 PM

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.

Seerah 01-23-16 01:24 PM

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.

Voxxel 01-23-16 01:33 PM

Quote:

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.

semlar 01-23-16 03:29 PM

Quote:

Originally Posted by Seerah (Post 312705)
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.

Quote:

Originally Posted by Voxxel (Post 312706)
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.

SDPhantom 01-23-16 06:03 PM

Quote:

Originally Posted by Voxxel (Post 312706)
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.

semlar 01-23-16 06:42 PM

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.

Voxxel 01-24-16 01:23 AM

Quote:

Originally Posted by SDPhantom (Post 312708)
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!

Voxxel 01-24-16 01:24 AM

Quote:

Originally Posted by semlar (Post 312709)
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! :banana:

Shadowlord 11-06-22 12:00 PM

Please Fix
 
Quote:

Originally Posted by semlar (Post 312709)
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 ?

whobdobub 11-11-22 09:10 PM

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.

Quote:

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")

dashifen 11-27-22 04:56 PM

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!

dreadking666 01-27-23 10:00 AM

same for me :(


All times are GMT -6. The time now is 12:01 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI