Thread Tools Display Modes
02-05-12, 09:49 AM   #1
cokedrivers
A Rage Talon Dragon Guard
 
cokedrivers's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 325
Help hiding Macro Names

Before 4.3 the below lua code worked now after 4.3 it does not.

listed below are the codes used and errors that follow...

With the code this way:
Code:
	hooksecurefunc('ActionButton_UpdateName', function(self)
		local macroname = _G[self:GetName()..'Name']
		if (not C['general'].buttons.showMacronames) then
			macroname:SetAlpha(0)
		end
	end)


I get this error:
Code:
Message: Interface\AddOns\BasicUI\Modules\General\Buttons.lua:10: hooksecurefunc(): ActionButton_UpdateName is not a function
Time: 02/05/12 07:18:11
Count: 1
Stack: [C]: in function `hooksecurefunc'
Interface\AddOns\BasicUI\Modules\General\Buttons.lua:10: in main chunk

Locals:



now when I change the 'ActionButton_UpdateName' to 'ActionButton_Update' I now get this error:
Code:
Message: Interface\AddOns\BasicUI\Modules\General\Buttons.lua:13: attempt to index local 'macroname' (a nil value)
Time: 02/05/12 07:22:21
Count: 1
Stack: Interface\AddOns\BasicUI\Modules\General\Buttons.lua:13: in function <Interface\AddOns\BasicUI\Modules\General\Buttons.lua:10>
[C]: in function `ActionButton_Update'
Interface\FrameXML\ActionButton.lua:484: in function `ActionButton_OnEvent'
Interface\FrameXML\ActionButton.lua:105: in function <Interface\FrameXML\ActionButton.lua:98>

Locals: self = ExtraActionButton1 {
 0 = <userdata>
 feedback_action = 121
 action = 121
 buttonType = "EXTRAACTIONBUTTON"
 flashing = 0
 style = <unnamed> {
 }
 flashtime = 0
 isExtra = true
 cooldown = ExtraActionButton1Cooldown {
 }
 icon = ExtraActionButton1Icon {
 }
}
macroname = nil
(*temporary) = false
(*temporary) = nil
(*temporary) = "ExtraActionButton1"
(*temporary) = "attempt to index local 'macroname' (a nil value)"
C = <table> {
 merchant = <table> {
 }
 general = <table> {
 }
 castbar = <table> {
 }
 powerbar = <table> {
 }
 tooltip = <table> {
 }
 datatext = <table> {
 }
 chat = <table> {
 }
 selfbuffs = <table> {
 }
 quest = <table> {
 }
 buff = <table> {
 }
}
So any help with this would be great.

Thanks
Coke


EDIT: got the answer for this a few min ago.. if a mod sees this they can delete it.

Thanks

Oh BTW here is the correct coding i was looking for:

Code:
	hooksecurefunc('ActionButton_Update', function(self)
		if self.buttonType == "EXTRAACTIONBUTTON" then return end
		local macroname = _G[self:GetName()..'Name']
		if (not C['general'].buttons.showMacronames) then
			macroname:SetAlpha(0)
		end
	end)

Last edited by cokedrivers : 02-05-12 at 10:11 AM.
  Reply With Quote
02-06-12, 07:35 AM   #2
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Another option would be to simply make sure the name object exists before proceeding:

Code:
	hooksecurefunc('ActionButton_Update', function(self)
		local macroname = _G[self:GetName()..'Name']
		if name and (not C['general'].buttons.showMacronames) then
			macroname:SetAlpha(0)
		end
	end)
This would catch the ExtraActionButton, as well as any other (future) buttons Blizzard uses ActionButton_Update on that don't have name objects.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » Macro Help » Help hiding Macro Names

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off