Posted on: 03-20-2013 - Updated on: 03-20-2013 - viewed 6607 times
Written to avoid the annoyance of digging through menus to toggle keybinds going between battlegrounds and PVE content. Just click and it’ll bind tab to either target enemies in general or only players (avoiding accidental targeting of pets, etc) depending on whether you’re in a battleground or not, and prints a message to the chat log to let you know which it did.
/run if UnitInBattleground("player") then SetBinding("TAB","TARGETNEARESTENEMYPLAYER") DEFAULT_CHAT_FRAME:AddMessage("Targeting players.") else SetBinding("TAB","TARGETNEARESTENEMY") DEFAULT_CHAT_FRAME:AddMessage("Targeting enemy NPCs.")end