WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Macro Help (https://www.wowinterface.com/forums/forumdisplay.php?f=140)
-   -   Help hiding Macro Names (https://www.wowinterface.com/forums/showthread.php?t=42540)

cokedrivers 02-05-12 09:49 AM

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)


Phanx 02-06-12 07:35 AM

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.


All times are GMT -6. The time now is 05:03 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI