Page 1 of 1

Need help to script a few macros.

PostPosted: Sun Aug 16, 2015 1:29 pm
by AG007
Hello everyone. As the title says, I could really use some help to make the following macros works.

The first one is:
Code: Select all
/script texture,name,isActive,isCastable = GetShapeshiftFormInfo(1); if isActive then CastSpellByName("Overpower(Rank 1)"); else texture,name,isActive,isCastable = GetShapeshiftFormInfo(2); if isActive then CastSpellByName("Revenge(Rank 1)"); end end;


So what I want it to do is, whenever i'm in Battle Stance it should cast Overpower, and whenever i'm in Defensive Stance it should cast Revenge. It seems to ALMOST work. It does what I want it to do, however when i'm in defensive stance and Revenge become useable, the macro wont "light up". It just stay in this grey color like it isnt active even though Revenge is active/useable. (Hope that make sense).

For the next macro, I have tried to experiment with the
Code: Select all
IsEquippedAction(slotID)

I want a macro that cast Shield Bash whenever I have a shield equipped (slotID = 17), otherwise it should cast Pummel. And if it is possible, I would like it to cast Berserker Stance, then Pummel if i'm in Battle Stance with NO shield equipped.

As for the third and last macro, I have tried to experiment with the
Code: Select all
UnitBuff("player")

I want this macro to FIRST cast Berserker Rage, then check the player (myself) for the Berserker Rage buff, and then it should cast Will of the Forsaken, but only if the Bersker Rage buff is NOT found.
Basically I want to make a vanilla version of /castsequence.
I found a macro that works very similar to this.:
Code: Select all
/run local i,x=1,0 while UnitBuff("player",i) do if string.find(UnitBuff("player",i),"BattleShout")then x=1 end i=i+1 end if x==0 then CastSpellByName("Battle Shout")end

What it does is, it cast Battle Shout, but if Battle Shout is already active, the macro wont do anything. I tried to switch the "Battle Shout" in the macro with Berserker Rage and WotF, but it doesn't seem to work properly.

I hope someone can help me, I would really appreciate it if I could get these macros to work.

Thanks in advance!

Re: Need help to script a few macros.

PostPosted: Sun Aug 16, 2015 8:04 pm
by LYQ
I doubt there is a way to make the first macro work like you want it to.

regarding the last macro with Berserker Rage - I don't know where you copied the Battle Shout one but it only works because UnitBuff(...) returns the texture of the buff, "BattleShout" is part of the name of the texture of Battle Shout. which means you have to replace it with the name of Berserker Rage's texturename. looking up on wowhead it must be "spell_nature_ancestralguardian", therefore you could replace "BattleShout" with "AncestralGuardian" and it should work, at least this check would work and you can try further.

Re: Need help to script a few macros.

PostPosted: Sun Aug 16, 2015 8:57 pm
by AG007
Hey LYQ, thanks for your reply.
I've already tried to do what you said, even though I didn't know about the texturename. However I tried to do it with bloodrage instead, as I don't have berserker rage yet due to my low level.
Anyway, it turns out that the texturename must be spelled like this: BloodRage instead of bloodrage even though the texturename is "bloodrage" with no capital letters.

So now it actually works the way I want. I assume the final macro with beserker rage will look like this:
Code: Select all
/cast Berserker Rage
/run local i,x=1,0 while UnitBuff("player",i) do if string.find(UnitBuff("player",i),"AncestralGuardian") then x=1 end i=i+1 end if x==0 then CastSpellByName("Will of the Forsaken")end
:mrgreen: :mrgreen:

About the first macro, that's just a shame.. Still hope there is a way to fix it, because it's kinda annoying that i have to guess if my Revenge is useable every time I want to use it. Maybe I can find an addon to fix the problem..

Anyway, hope there's someone who can help me solve the second script with shield bash and pummel. :mrgreen:

Re: Need help to script a few macros.

PostPosted: Mon Aug 17, 2015 2:09 am
by AG007
So I managed to make the Shield Bash / Pummel macro myself. Turns out I had misunderstood the way
Code: Select all
IsEquippedAction(slotID)
works. Apparently slotID is the number on the actionbar slots and not character slots.
Image

Anyway, here is what I ended up with, if anyone wants to use it:
Code: Select all
/run local c,ab1=CastSpellByName,"Berserker Stance" if IsEquippedAction(24) then c("Shield Bash") else c(ab1)c("Pummel")end

The only issue with this macro is that you can't tell if your shield bash or pummel is ready to use, so for that you'll have to find another way. (Let me know if there is an addon to fix this.)
Anyway, in order to make this macro use Shield Bash, you have to place an equipped item (which would be a shield in this case) anywhere on your action bar. I set it to Slot 24, but you can change the slot from 1 - 72.
Picture related:
http://i52.tinypic.com/2w3oyfm.jpg