04-25-14, 01:09 PM | #41 |
I think I found another part of my UI that is a secure frame issue that causes the error:
Actionbars_Old there are secure hooks in here but I have learned that they need to have a if im in combat not to fire function. So I changed it to this (InCombat code from Phanx) Actionbars_New. Is this correct? Coke |
|
04-25-14, 06:31 PM | #42 |
http://pastebin.com/aJJqCHw9
Some of those copied action button functions were... really inefficient, creating new tables on every action button update, performing the same function call or global lookup 5 times in a row instead of storing the result in a variable, etc.
__________________
Retired author of too many addons. Message me if you're interested in taking over one of my addons. Don’t message me about addon bugs or programming questions. |
|
04-25-14, 07:12 PM | #43 | |
Code:
---------------------------------------------------------------------------------------- 78. local extraActionButtons = setmetatable({}, { __index = function(t, self) 79. local name = AddRegionKeys(self) 80. local v = not not strmatch(name, "ExtraActionButton") 81. t[f] = v 82. return v 83. end }) ---------------------------------------------------------------------------------------- 103. hooksecurefunc("ActionButton_UpdateUsable", function(self) 104. if extraActionButtons[self] then return end 105. ColorButton(self.__normalTexture) 106. end) ---------------------------------------------------------------------------------------- Here is the error: Code:
1200x BasicUI-5.4.7\Modules\Actionbars.lua:81: table index is nil BasicUI-5.4.7\Modules\Actionbars.lua:81: in function <BasicUI\Modules\Actionbars.lua:78> BasicUI-5.4.7\Modules\Actionbars.lua:104: in function <BasicUI\Modules\Actionbars.lua:103> <in C code> <in C code> FrameXML\ActionButton.lua:271: in function <FrameXML\ActionButton.lua:253> <in C code> FrameXML\ActionButton.lua:523: in function "ActionButton_OnEvent" FrameXML\ActionButton.lua:124: in function <FrameXML\ActionButton.lua:117> <in C code> Buffet\Buffet-5.2.0.42.lua:127: in function "Edit" Buffet\Buffet-5.2.0.42.lua:109: in function "Scan" Buffet\Buffet-5.2.0.42.lua:61: in function <Buffet\Buffet.lua:54> (tail call): ? Locals: self = MultiBarLeftButton6 { 0 = <userdata> action = 42 buttonType = "MULTIACTIONBAR4BUTTON" flashing = 0 __hotkey = MultiBarLeftButton6HotKey { } __checkedTexture = <unnamed> { } flashtime = 0 icon = MultiBarLeftButton6Icon { } __name = MultiBarLeftButton6Name { } feedback_action = 42 __pushedTexture = <unnamed> { } __highlightTexture = <unnamed> { } __flash = MultiBarLeftButton6Flash { } __normalTexture = MultiBarLeftButton6NormalTexture { } __border = MultiBarLeftButton6Border { } FlyoutBorderShadow = MultiBarLeftButton6FlyoutBorderShadow { } FlyoutBorder = MultiBarLeftButton6FlyoutBorder { } __count = MultiBarLeftButton6Count { } eventsRegistered = true FlyoutArrow = MultiBarLeftButton6FlyoutArrow { } cooldown = MultiBarLeftButton6Cooldown { } rangeTimer = -1 } (*temporary) = <table> { } (*temporary) = nil extraActionButtons = <table> { } ColorButton = <function> defined @Interface\AddOns\BasicUI\Modules\Actionbars.lua:69 EDIT: This error also: Code:
2x BasicUI-5.4.7\Modules\Actionbars.lua:118: attempt to index local "button" (a nil value) BasicUI-5.4.7\Modules\Actionbars.lua:118: in function <BasicUI\Modules\Actionbars.lua:114> <in C code> FrameXML\PetActionBarFrame.lua:52: in function <FrameXML\PetActionBarFrame.lua:40> Locals: (*temporary) = <function> defined =[C]:-1 = <function> defined @Interface\FrameXML\PetActionBarFrame.lua:106 = <function> defined @Interface\AddOns\BasicUI\Modules\Actionbars.lua:114 and the code is: Code:
113.local petButtons = { "PetActionButton", "PossessButton", "ShapeshiftButton" } 114. hooksecurefunc("PetActionBar_Update", function() 115. for i = 1, #petButtons do 116. for j = 1, 12 do 117. local button = _G[petButtons[i]..j] 118. button:SetNormalTexture("Interface\\BUTTONS\\UI-Quickslot2") 119. 120. AddRegionKeys(button) 121. 122. local icon = button.icon 123. icon:SetTexCoord(.05, .95, .05, .95) 124. icon:ClearAllPoints() 125. icon:SetPoint("TOPLEFT", -1, 1) 126. icon:SetPoint("BOTTOMRIGHT", 1, -1) 127. 128. local normalTexture = button.__normalTexture2 or button.__normalTexture 129. normalTexture:ClearAllPoints() 130. normalTexture:SetPoint("TOPLEFT", -15, 15) 131. normalTexture:SetPoint("BOTTOMRIGHT",15, -15) 132. 133. ColorButton(normalTexture) 134. end 135. end 136. end) Last edited by cokedrivers : 04-25-14 at 07:22 PM. |
||
04-26-14, 08:20 AM | #44 |
#1 - Change "t[f] = v" to "t[self] = v"
#2 - That means one of the bars you're modifying doesn't actually have 12 buttons. The whole section seems like it's probably not the best way to go about things, but I don't really feel like digging through the Blizzard actionbar code to rewrite it for you, so just do this to avoid the error: Code:
hooksecurefunc("PetActionBar_Update", function() for i = 1, #petButtons do for j = 1, 12 do local name = petButtons[i] .. j local button = _G[name] if button then button:SetNormalTexture("Interface\\BUTTONS\\UI-Quickslot2") -- all the stuff here is fine, just indent it by one more level ColorButton(normalTexture) else print(name, "doesn't exist") -- you can remove this later end end end end)
__________________
Retired author of too many addons. Message me if you're interested in taking over one of my addons. Don’t message me about addon bugs or programming questions. |
|
04-26-14, 08:41 AM | #45 | |
Coke |
||
04-26-14, 10:49 AM | #46 |
Got the error to stop.
Had to switch the code up a little. From this: Lua Code:
To this: Lua Code:
I'm sure its not as efficant as Phanx's code but this way I do not get errors (yet) also not sure why but the petstancebutton needs for i=1, NUM_SLOTS, 1 do which the other 2 do not, and the ShapeshiftButton needed to be switched to StanceButton. Coke |
|
04-26-14, 10:20 PM | #47 | |
Also: While it doesn't really matter, you should use variable names that make sense. A variable like "buttonName" should logically contain the name of a button, not the button object itself. Rather than doing more string concatenations and global lookups )eg. _["ThisBarButton"..i.."Icon"]) you should use the keys on the button that already point to those things (eg. button.icon). Don't forget to call ClearAllPoints before you start calling SetPoint -- otherwise you may end up with unexpected results if the original region was positioned with points other than the ones you're setting. Avoid duplicating code. If you're going to use the same chunk of code in 5 different places, factor it out into a function, and just call the function from those 5 places. http://pastebin.com/WEGEz70y
__________________
Retired author of too many addons. Message me if you're interested in taking over one of my addons. Don’t message me about addon bugs or programming questions. |
||
04-30-14, 10:31 PM | #48 | |
Thank You Coke |
||
WoWInterface » Developer Discussions » Lua/XML Help » Addon_action_blocked |
«
Previous Thread
|
Next Thread
»
|
Display Modes |
Linear Mode |
Switch to Hybrid Mode |
Switch to Threaded Mode |
|
|