View Single Post
02-21-24, 06:04 AM   #7
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,938
Okay, took a while, but managed to get it working on Wrath Classic 3.4.3 using the following code


Lua Code:
  1. local function UpdateHotKeys(self,buttonType)
  2.     local hotkey = self.HotKey;
  3.     hotkey:SetFont("Fonts\\FRIZQT__.ttf", 12, "THICKOUTLINE")
  4.     local binding = GetBindingText(GetBindingKey("ACTIONBUTTON"..self:GetID()), true);
  5.     hotkey:SetText("|cFF00FF00" .. binding or RANGE_INDICATOR .. "|r")
  6.     -- Green text on main action bars ( |cAARRGGBB text |r)
  7. end
  8.  
  9. for i=1, NUM_ACTIONBAR_BUTTONS, 1 do
  10.     local button = _G["ActionButton" .. i]
  11.     hooksecurefunc("ActionButton_UpdateHotkeys",UpdateHotKeys)
  12.     ActionButton_UpdateHotkeys(button)
  13. end
  14.  
  15.  
  16. local function SetHotKeys(self)
  17.     local hotkey = _G[self:GetName().."HotKey"];
  18.     hotkey:SetFont("Fonts\\FRIZQT__.ttf", 12, "THICKOUTLINE")
  19.     local binding = GetBindingText(GetBindingKey("BONUSACTIONBUTTON"..self:GetID()), true);
  20.     hotkey:SetText("|cFFFF0000" .. binding or RANGE_INDICATOR .. "|r")
  21.     -- Red text on pet action bars
  22. end
  23.  
  24. for i=1, NUM_PET_ACTION_SLOTS, 1 do
  25.     local button = _G["PetActionButton" .. i]
  26.     hooksecurefunc("PetActionButton_SetHotkeys",SetHotKeys)
  27.     PetActionButton_SetHotkeys(button)
  28. end

The call after the hook line triggers it straight away, otherwise it won't trigger until you change the hot key via the options. Not sure whether there will be in combat/secure issues but hopefully being done immediately on addon load rather than via event watching means it won't be a problem.

SetTextColor doesn't seem to make a difference at all regardless of where you put it in the code. But, inserting the |c and |r start and end color formatting code sequences seems to work as expected.
__________________


Characters:
Gwynedda - 70 - Demon Warlock
Galaviel - 65 - Resto Druid
Gamaliel - 61 - Disc Priest
Gwynytha - 60 - Survival Hunter
Lienae - 60 - Resto Shaman
Plus several others below level 60

Info Panel IDs : http://www.wowinterface.com/forums/s...818#post136818

Last edited by Xrystal : 02-21-24 at 06:09 AM.
  Reply With Quote