Quantcast WoWInterface - View Single Post - Cycling nameplates
View Single Post
02-29-16, 06:41 PM   #1
MunkDev
A Scalebane Royal Guard
 
MunkDev's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2015
Posts: 427
Cycling nameplates

This is something really simple that I think should be part of the base UI, but instead, we have 3 bindings pertaining to nameplates that I think could be turned into one. Or at least be added as an extra binding. Just thought I'd share it in case anyone wanted to turn it into an addon or include it in their UI compilations or w/e.

This works in combat unlike the /run macros that are passed around as an answer to this fairly common question.

Lua Code:
  1. local PlateCycle = CreateFrame("Button", "NameplateCycle", nil, "SecureActionButtonTemplate, SecureHandlerBaseTemplate")
  2.  
  3. PlateCycle:SetAttribute("type", "macro")
  4.  
  5. PlateCycle:Execute([[
  6.     Scripts = newtable()
  7.  
  8.     Scripts[1] = "/click InterfaceOptionsNamesPanelUnitNameplatesEnemies"
  9.     Scripts[2] = "/click InterfaceOptionsNamesPanelUnitNameplatesFriends"
  10. ]])
  11.  
  12. PlateCycle:WrapScript(PlateCycle, "PreClick", [[
  13.     Index = Index == 1 and 2 or 1
  14.     self:SetAttribute("macrotext", Scripts[Index])
  15. ]])

Lua Code:
  1. /click NameplateCycle

Code:
<Binding name="CLICK NameplateCycle:LeftButton" category="Your addon" />
__________________

Last edited by MunkDev : 02-29-16 at 07:02 PM.
  Reply With Quote