While I won't go into the juicy details of being enabled to do this (the post was deleted a bit ago), using secure functions in macros is an amazing benefit.
For example, the macro I use most frequently...
If the unit is casting something, interrupts the cast, otherwise saves the cooldown
Code:
/if UnitCastingInfo("target") or UnitChannelInfo("target")
/stopcasting
/cast Earth Shock(Rank 1)
/end
I would then expand this to cast max rank Earth Shock if it would kill them,
Code:
/if UnitCastingInfo("target") or UnitChannelInfo("target")
/stopcasting
/if UnitHealth("Target")<1000
/cast Earth Shock
/else
/cast Earth Shock(Rank 1)
/end
/end
For the mages out there raiding sunwell, this macro will steal Grand Warlock Alythess' Firedamage buff.
Then it checks if the target has 3 stacks of the scorch debuff
If it doesn't, you cast scorch, if it does, you cast fireball
Code:
/if unitHasSpellEFfect("target", 45230)
/cast Spellsteal
/end
/script local l=0; for i=1,40 do local n,_,_,_,_,_,t=UnitDebuff("target",i);if n=="Fire Vulnerability" and t then l=t;end;end
/if l < 3
/cast Scorch
/end
/cast Fireball
And here's your warlock bot. It's mostly readable. /ifaddtb means if the unit doesn't have the debuff or less than one second of it remaining.
Code:
/ifaddtb Unstable Affliction
/cast Unstable Affliction
/end
/ifaddtb Siphon Life
/cast Siphon Life
/end
/ifaddtb Curse of Agony
/cast Curse of Agony
/end
/ifaddtb Corruption
/cast Corruption
/end
/if UnitHealth("player")<80%
/cast Drain Life
/elseif UnitHealth("player")>80%
/cast Shadowbolt
/end
/if UnitMana("player")<25%
/if UnitHealth("player")>80%
/cast Life Tap
/end
/end
/if UnitMana("player")<25%
/if UnitHealth("player")<80%
/cast Dark Pact
/end
/end
Be warned, there is a 256 char limit on macros.