Thread: Keybindissue
View Single Post
08-17-14, 03:39 PM   #1
liquidbase
A Warpwood Thunder Caller
 
liquidbase's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2010
Posts: 97
Keybindissue

Hey @ all!

I try to alter the keybind text with this small function:

Lua Code:
  1. local replace = string.gsub
  2. D.Keybind = function(self, actionButtonType)
  3.     local HotKey = _G[self:GetName().."HotKey"]
  4.     local Text = HotKey:GetText()
  5.  
  6.     Text = replace(Text, "(s%-)", "S")
  7.     Text = replace(Text, "(a%-)", "A")
  8.     Text = replace(Text, "(c%-)", "C")
  9.     Text = replace(Text, "(Mouse Button )", "M")
  10.     Text = replace(Text, KEY_BUTTON3, "M3")
  11.     Text = replace(Text, KEY_PAGEUP, "PU")
  12.     Text = replace(Text, KEY_PAGEDOWN, "PD")
  13.     Text = replace(Text, KEY_SPACE, "SpB")
  14.     Text = replace(Text, KEY_INSERT, "Ins")
  15.     Text = replace(Text, KEY_HOME, "Hm")
  16.     Text = replace(Text, KEY_DELETE, "Del")
  17.     Text = replace(Text, KEY_NUMPADDECIMAL, "Nu.")
  18.     Text = replace(Text, KEY_NUMPADDIVIDE, "Nu/")
  19.     Text = replace(Text, KEY_NUMPADMINUS, "Nu-")
  20.     Text = replace(Text, KEY_NUMPADMULTIPLY, "Nu*")
  21.     Text = replace(Text, KEY_NUMPADPLUS, "Nu+")
  22.     Text = replace(Text, KEY_NUMLOCK, "NuL")
  23.     Text = replace(Text, KEY_MOUSEWHEELDOWN, "MWD")
  24.     Text = replace(Text, KEY_MOUSEWHEELUP, "MWU")
  25.    
  26.     if HotKey:GetText() == _G["RANGE_INDICATOR"] then
  27.         HotKey:SetText("")
  28.     else
  29.         HotKey:SetText(Text)
  30.     end
  31. end
  32. hooksecurefunc("ActionButton_UpdateHotkeys", D.Keybind)

I know I had the correct update-function from the blizzardcode but the hotkeys won't change. I had already Mouse Button 4, a-Mouse Button 4 and so on. Is there a possibly an error I overlooked? A friend of mine used the same code and there it works fine. Currently I am a little perplexed