Page 1 of 2

Macro request: Shaman weaponswap + weapon imbue

PostPosted: Tue Dec 15, 2015 8:39 pm
by Venaitre
Is it possible to make a macro that does the following:
Go from 1h+shield to 2h
If 2h have no weapon imbue on it, cast weapon imbue
else simply swap weapons.
Visa versa for 2h to 1h+shield.

Re: Macro request: Shaman weaponswap + weapon imbue

PostPosted: Tue Dec 15, 2015 11:53 pm
by euronmisc
with weapon imbue you mean like rockbiter weapon or whatever?

shouldn't be too hard if you get the Weaponswap addon.

Re: Macro request: Shaman weaponswap + weapon imbue

PostPosted: Wed Dec 16, 2015 1:19 pm
by Venaitre
Problem is that the CastSpellByName seems to happen prior to the weapon swap, buffing your previously equipped weapon, then making the weapon swap.

Re: Macro request: Shaman weaponswap + weapon imbue

PostPosted: Wed Dec 16, 2015 1:27 pm
by LYQ
Venaitre wrote:Problem is that the CastSpellByName seems to happen prior to the weapon swap, buffing your previously equipped weapon, then making the weapon swap.


makes sense, the only workaround would be a macro which is checking if it has already equiped the other weapon by using either of those
http://wowwiki.wikia.com/wiki/API_GetIn ... temTexture
http://wowwiki.wikia.com/wiki/API_GetInventoryItemLink

but that would only work if you switch between different weapons, if you'd want to switch between 2 weapons of the same kind just with another weapon enchant on it it wouldn't work.

nonetheless someone would need more information about the weapon you want to switch to, to create such a macro for you

Re: Macro request: Shaman weaponswap + weapon imbue

PostPosted: Wed Dec 16, 2015 2:07 pm
by Venaitre
The thought was to have a macro that switches between 1h + shield with Flametongue, as it gives a better constant damage (PvE leveling) to a 2h with Windfury for PvP encounters.

Re: Macro request: Shaman weaponswap + weapon imbue

PostPosted: Wed Dec 16, 2015 3:10 pm
by LYQ
Venaitre wrote:The thought was to have a macro that switches between 1h + shield with Flametongue, as it gives a better constant damage (PvE leveling) to a 2h with Windfury for PvP encounters.


yeah but the only solution I can think of at the moment would be specific to the weapon you're switching to

eg, if you switch to the 2handed "The Stoppable Force" the macro should look like

/yourweaponswapaddonmacro
/run if string.find(GetInventoryItemLink(16), "The Stoppable Force") then CastSpellByName("Windfury") end

so you'd probably want a similar extra macro to switch back to 1h and shield + buff the 1h.
But this way you would need to adjust the macro every time you're getting a new 2h or 1h weapon. (replace the name of the weapon "The Stoppable Force" to the name of your new 2h and so on)

to clarify the macro
GetInventoryItemLink(16) - this returns the itemLink which would look something like
|cff9d9d9d|Hitem:7073:0:0:0:0:0:0:0:80:0:0:0:0|h[Broken Fang]|h|r

the (16) means it scans the mainhand slot of your equipped items, which is in both cases (1h and 2h weapon) the slot in which your weapon is. - if you make a 2nd macro to switch to 1h+shield you don't have to check the shieldslot.

so it gets the string as seen in the example and string.find is comparing if it can find "The Stoppable Force" in the string, if it's true then the weaponswitch was already completed when the code fires.

meaning you would have to use this macro at least twice to get it buffing the weapon,
the first press will force your weaponswitch addon to do the switch
the second press would start buffing it

Re: Macro request: Shaman weaponswap + weapon imbue

PostPosted: Wed Dec 16, 2015 4:53 pm
by Venaitre
Thanks for your help.
However, I get the following error:
Error: [string "if string.find(GetInventoryItemLink(16), "s..."]:1:
Invalid Inventory slot in getInventoryItemLink

Which makes no sense, cuz I understand the syntax of the macro.
Rly interesting and fun to play around with once you know the different commands. Where did you find them?

Macro currently look like
/equip Staff of Orgrimmar
/run if string.find(GetInventoryItemLink(16), "Staff of Orgrimmar") then CastSpellByName("Rockbiter Weapon") end

Re: Macro request: Shaman weaponswap + weapon imbue

PostPosted: Wed Dec 16, 2015 5:32 pm
by LYQ
Venaitre wrote:Thanks for your help.
However, I get the following error:
Error: [string "if string.find(GetInventoryItemLink(16), "s..."]:1:
Invalid Inventory slot in getInventoryItemLink

Which makes no sense, cuz I understand the syntax of the macro.
Rly interesting and fun to play around with once you know the different commands. Where did you find them?

Macro currently look like
/equip Staff of Orgrimmar
/run if string.find(GetInventoryItemLink(16), "Staff of Orgrimmar") then CastSpellByName("Rockbiter Weapon") end


oh yeah I found the error

/equip Staff of Orgrimmar
/run if string.find(GetInventoryItemLink("player",16), "Staff of Orgrimmar") then CastSpellByName("Rockbiter Weapon") end

this should work

GetInventoryItemLink("player",16) is the correct syntax

Re: Macro request: Shaman weaponswap + weapon imbue

PostPosted: Wed Dec 16, 2015 10:14 pm
by Venaitre
Thanks alot! Was just what I needed.

Where did you learn these commands and syntax? I would love to learn it myself.

Re: Macro request: Shaman weaponswap + weapon imbue

PostPosted: Wed Dec 16, 2015 10:19 pm
by LYQ
Venaitre wrote:Thanks alot! Was just what I needed.

Where did you learn these commands and syntax? I would love to learn it myself.


started by studying addon code of small and simple addons because I was interested in coding