Macro for casting on focus target/current target

85 Human Paladin
2965
Hello, I want a macro that cast a specific spell on focus target if there is a focus target otherwise it should cast the same spell on my current target.

I have tried:

#1
/cast [target=focus] SpellName
/cast Spellname

Result:
Only works on focus target

#2
/cast [target=focus] SpellName
/cast [target=target] Spellname

Result:
Same as #1

#3
/cast [target=focus] SpellName else
/cast [target=target] Spellname

Result:
Only works on current target

I'm guessing this is very simple but I cant find a solution.

Thanks in advance!
Reply Quote
85 Worgen Death Knight
6430
/cast [target=focus]SpellName; SpellName

OR

/cast [target=focus,mod:shift]SpellName; SpellName

OR if same spellname

/cast [target=focus,mod:shift][]SpellName
Reply Quote
85 Human Paladin
2965
Thnx but that does not work, the macro is already bound to SHIFT+MB3.
I would think that the macro would have to have a check to see if a focus target is set and if it is, then cast on the focus target otherwise cast on current target.
Reply Quote
85 Draenei Shaman
3850
The problem is the conditional [@focus] which will make it try to cast on your focus-target no matter what (even if you don't have one). Try:
#showtooltip
/use [@focus,exists,nodead][]SpellName

Exists will check if the focus exists and Nodead will make sure you're not trying to cast on a dead focus.
You can use Help or Harm instead of Exists if you want (depending on if it's a helpful or harmful spell).
Reply Quote
85 Human Paladin
2965
It works! Thank you Jojk!!
Reply Quote
85 Goblin Hunter
3025
Thanks Jojk
Reply Quote
20 Troll Mage
0
Thx Jojk, what language is the code wrote in wow? C++?
Edited by Gladalaxen on 11/03/2013 00:23 GMT
Reply Quote
90 Orc Death Knight
8600
What is this I don't even
Reply Quote
90 Blood Elf Rogue
7150
Thank you for great macro!

Could be someone explain me how it works?

#showtooltip
/use [@focus,exists,nodead][]SpellName
Reply Quote
90 Orc Death Knight
8600
The /use line has two pairs of brackets with conditions inside, either of which must fully be met for the spell to cast.

It always starts with the first set of brackets:
'@focus' sets the target of that spell to your focus, this is unconditional.
'exists' and 'nodead' check both that your focus (the new target of your spell) exists and is alive: If either are false, the first conditional (set of brackets) will fail and be ignored.
If both are true then the conditional will succeed and the spell will be used, at your focus.
So you can read it as "If my focus exists and is alive, cast at them; if not,"

Now, if the first set of brackets fails, it moves to the next pair.

The second pair are empty, meaning they will always be true unconditionally so the spell is used at your normal target.
The conditioned target will be your default target: It's thus equivalent to [@target].
You can simply read it as "cast at my normal target".

Putting the two meanings together:
If my focus exists and is alive, cast at them; if not, cast at my normal target.

Finally, SpellName is the spell that will be cast.
You can put multiple spells onto a single line by seperating them by semicolons, an example is here:
/use [help]Heavy Windwool Bandage;[@focus,harm][harm]ThrowIf I can help my target, use a bandage on them, else; if I can harm my focus, throw a knife at them, else; if I can harm my target, throw a knife at them.

One final example is modifiers: You can change which conditionals succeed by holding any modifier, the most convenient of which are shift, control and alt.

/use [mod]Kick;GougeIf I'm holding a modifier (shift, control or alt) then kick my target, else; gouge them.

/use [mod:shift]Kick;[mod:alt]Gouge;ThrowIf holding shift, cast kick; if holding alt, cast gauge; else cast throw.
Edited by Unðedrtelðús on 20/03/2013 16:07 GMT
Reply Quote
90 Night Elf Rogue
11785
Thx Jojk, what language is the code wrote in wow? C++?
Likely C++, but macro code is LUA.

The database is Oracle.
Reply Quote
90 Blood Elf Rogue
7150
DK Thank you so much for this imba guiding!

But let me to ask u something more...

i have tricks of the trade skill wich is should to have a friendly target to cast,same as blind wich is should to have a harm target to cast.
both of these skill cant take target like other skills such as mutilate and many others.

this macro does not want to work

/cast [@party, nodead] Tricks of the trade
Reply Quote
90 Dwarf Death Knight
12805
20/03/2013 16:05Posted by Røøted
Thx Jojk, what language is the code wrote in wow? C++?
Likely C++, but macro code is LUA.

The database is Oracle.

Macros (except for scripts) isn't in any real coding language just blizzards own API, addons on the other hand is made in lua/XML

DK Thank you so much for this imba guiding!

But let me to ask u something more...

i have tricks of the trade skill wich is should to have a friendly target to cast,same as blind wich is should to have a harm target to cast.
both of these skill cant take target like other skills such as mutilate and many others.

this macro does not want to work

/cast [@party, nodead] Tricks of the trade

You can't use @party, @party1 works (and 2, 3 and so on) but there's no guarantee that it will be a tank or any other member since I believe it's just based on who joined first. What you can do is:
#showtooltip
/use [help, nodead]Tricks of the trade;Blind

That will cast ToT if you target is friendly and alive else it will try to cast Blind
Reply Quote
90 Blood Elf Rogue
7150
since u should to have a party member or raid member to cast, i find this one wich is works,well done.
/cast [@party1, nodead] Tricks of the Trade
Reply Quote
90 Human Rogue
0
Jojk you're my god ty so much :D!!!
Reply Quote

Please report any Code of Conduct violations, including:

Threats of violence. We take these seriously and will alert the proper authorities.

Posts containing personal information about other players. This includes physical addresses, e-mail addresses, phone numbers, and inappropriate photos and/or videos.

Harassing or discriminatory language. This will not be tolerated.

Forums Code of Conduct

Report Post # written by

Reason
Explain (256 characters max)
Submit Cancel

Reported!

[Close]