Thread Tools Display Modes
04-13-14, 08:50 AM   #1
cokedrivers
A Rage Talon Dragon Guard
 
cokedrivers's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 325
Addon_action_blocked

I keep getting this error when out on the Timeless Isle:
Code:
26x [ADDON_ACTION_BLOCKED] AddOn "BasicUI" tried to call the protected function "OverrideActionBarButton1:Show()".
!BugGrabber-r198-release\BugGrabber.lua:552: in function <!BugGrabber\BugGrabber.lua:552>
<in C code>
FrameXML\ActionButton.lua:268: 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>

Locals:
nil
The only OverrideActionBar code I have in my addon is to move the vehicle bar above my datapanel.

Treeston from MMO Champions help me figure out a way to move it maybe it isn't correct.

So here is the code im currently using...
Lua Code:
  1. local bottom = function() end
  2.            
  3.             -- Main Menu Bar
  4.             MainMenuBar:ClearAllPoints()
  5.             MainMenuBar:SetPoint("BOTTOM", DataPanel, "TOP", 0, -3)
  6.             MainMenuBar.ClearAllPoints = bottom
  7.             MainMenuBar.SetPoint = bottom
  8.            
  9.             -- Vehicle Bar
  10.             OverrideActionBar:ClearAllPoints()
  11.             OverrideActionBar:SetPoint("BOTTOM", DataPanel, "TOP", 0, -3)
  12.             OverrideActionBar.ClearAllPoints = bottom
  13.             OverrideActionBar.SetPoint = bottom
  14.            
  15.             -- Pet Battle Bar
  16.             PetBattleFrame.BottomFrame:ClearAllPoints()
  17.             PetBattleFrame.BottomFrame:SetPoint("BOTTOM", DataPanel, "TOP", 0, -3)
  18.             PetBattleFrame.BottomFrame.ClearAllPoints = bottom
  19.             PetBattleFrame.BottomFrame.SetPoint = bottom

I'm wondering if it might need to be a secure hook or maybe I could hide my datapanel when any vehicle UI shows up.

Maybe something like:
Lua Code:
  1. hooksecurefunc('OverrideActionBar_SetDefaultAnchor', function(self)
  2.                 self:SetPoint(("BOTTOM", DataPanel, "TOP", 0, -3)
  3.             end)

Still learning so any help would be great.

Thanks
Coke
  Reply With Quote
04-13-14, 10:38 AM   #2
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
Well, what did you expect? You're overiding functions of protected frames.

Secure hook or not ... if you try to move protected frames from unsecure code in combat this action would be blocked.

Why don't you move the frames once if the addon loads? Are they re-anchored on the fly during normal gameplay?
  Reply With Quote
04-13-14, 03:16 PM   #3
cokedrivers
A Rage Talon Dragon Guard
 
cokedrivers's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 325
Originally Posted by Duugu View Post
Well, what did you expect? You're overiding functions of protected frames.

Secure hook or not ... if you try to move protected frames from unsecure code in combat this action would be blocked.

Why don't you move the frames once if the addon loads? Are they re-anchored on the fly during normal gameplay?
Not 100% sure about them moving, but I believe its like the trade skill window and arena frames the OverrideActionBar aka Vehicle Frame only activates when in a vehicle.

But when im not ins a vehicle and just in combat that is when the error pops up, like you said its a protected frame, maybe ill just have to move the datapanel to always show on the top although I really like it at the bottom of the screen.
  Reply With Quote
04-13-14, 07:29 PM   #4
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
All of these lines will break the default UI and spam you with "action blocked" errors:

Code:
MainMenuBar.ClearAllPoints = bottom 
MainMenuBar.SetPoint = bottom

OverrideActionBar.ClearAllPoints = bottom 
OverrideActionBar.SetPoint = bottom

PetBattleFrame.BottomFrame.ClearAllPoints = bottom 
PetBattleFrame.BottomFrame.SetPoint = bottom
You can't override methods on secure frames this way. Even your other idea:

Code:
hooksecurefunc('OverrideActionBar_SetDefaultAnchor', function(self)
	self:SetPoint(("BOTTOM", DataPanel, "TOP", 0, -3)
end)
... will throw errors because -- aside from having an extra parenthesis -- you can't move a secure frame in combat either. You are on the right track, however. You just need to add a combat check to your secure hook:

Code:
hooksecurefunc("OverrideActionBar_SetDefaultAnchor", function(self)
	if not InCombatLockdown() then
		self:SetPoint("BOTTOM", DataPanel, "TOP", 0, -3)
	end
end)
You may also want to add a "queue" so that any frames that were moved during combat (when you can't move them) can be moved after combat ends:

Code:
local queue = {}

local queueHandler = CreateFrame("Frame")
queueHandler:RegisterEvent("PLAYER_REGEN_ENABLED")
queueHandler:SetScript("OnEvent", function(self, event)
	for i = 1, #queue do
		local frame, pointA, anchor, pointB, x, y = unpack(queue[i])
		frame:SetPoint(pointA, anchor, pointB, x, y)
	end
end)

hooksecurefunc("OverrideActionBar_SetDefaultAnchor", function(self)
	if not InCombatLockdown() then
		self:SetPoint("BOTTOM", DataPanel, "TOP", 0, -3)
	else
		tinsert(queue, { self, "BOTTOM", DataPanel, "TOP", 0, -3 })
	end
end)
Your other option, as you said, would be to hide your data panel while in a vehicle:

Code:
DataPanel:RegisterUnitEvent("UNIT_ENTERING_VEHICLE", "player")
DataPanel:RegisterUnitEvent("UNIT_EXITED_VEHICLE", "player")

DataPanel:SetScript("OnEvent", function(self, event, ...)
	if event == "UNIT_ENTERING_VEHICLE" then
		self:Hide()
	elseif event == "UNIT_EXITED_VEHICLE" then
		self:Show()
	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.
  Reply With Quote
04-14-14, 09:00 AM   #5
cokedrivers
A Rage Talon Dragon Guard
 
cokedrivers's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 325
Originally Posted by Phanx View Post
All of these lines will break the default UI and spam you with "action blocked" errors:

Code:
MainMenuBar.ClearAllPoints = bottom 
MainMenuBar.SetPoint = bottom

OverrideActionBar.ClearAllPoints = bottom 
OverrideActionBar.SetPoint = bottom

PetBattleFrame.BottomFrame.ClearAllPoints = bottom 
PetBattleFrame.BottomFrame.SetPoint = bottom
You can't override methods on secure frames this way. Even your other idea:

Code:
hooksecurefunc('OverrideActionBar_SetDefaultAnchor', function(self)
	self:SetPoint(("BOTTOM", DataPanel, "TOP", 0, -3)
end)
... will throw errors because -- aside from having an extra parenthesis -- you can't move a secure frame in combat either. You are on the right track, however. You just need to add a combat check to your secure hook:

Code:
hooksecurefunc("OverrideActionBar_SetDefaultAnchor", function(self)
	if not InCombatLockdown() then
		self:SetPoint("BOTTOM", DataPanel, "TOP", 0, -3)
	end
end)
You may also want to add a "queue" so that any frames that were moved during combat (when you can't move them) can be moved after combat ends:

Code:
local queue = {}

local queueHandler = CreateFrame("Frame")
queueHandler:RegisterEvent("PLAYER_REGEN_ENABLED")
queueHandler:SetScript("OnEvent", function(self, event)
	for i = 1, #queue do
		local frame, pointA, anchor, pointB, x, y = unpack(queue[i])
		frame:SetPoint(pointA, anchor, pointB, x, y)
	end
end)

hooksecurefunc("OverrideActionBar_SetDefaultAnchor", function(self)
	if not InCombatLockdown() then
		self:SetPoint("BOTTOM", DataPanel, "TOP", 0, -3)
	else
		tinsert(queue, { self, "BOTTOM", DataPanel, "TOP", 0, -3 })
	end
end)
Your other option, as you said, would be to hide your data panel while in a vehicle:

Code:
DataPanel:RegisterUnitEvent("UNIT_ENTERING_VEHICLE", "player")
DataPanel:RegisterUnitEvent("UNIT_EXITED_VEHICLE", "player")

DataPanel:SetScript("OnEvent", function(self, event, ...)
	if event == "UNIT_ENTERING_VEHICLE" then
		self:Hide()
	elseif event == "UNIT_EXITED_VEHICLE" then
		self:Show()
	end
end)
Again Thank You for the help,

Beings that Vehicles and Pet Battle both hide the mainbar I went with the hide option so I had to modify the code a little.

Code:
			-- Hide Panels When in a Vehicle or Pet Battle
			MainPanel:RegisterUnitEvent("UNIT_ENTERING_VEHICLE", "player")
			MainPanel:RegisterUnitEvent("UNIT_EXITED_VEHICLE", "player")
			MainPanel:RegisterUnitEvent("PET_BATTLE_OPENING_START")
			MainPanel:RegisterUnitEvent("PET_BATTLE_CLOSE")

			MainPanel:SetScript("OnEvent", function(self, event, ...)
				if event == "UNIT_ENTERING_VEHICLE" or event == "PET_BATTLE_OPENING_START" then
					self:Hide()
				elseif event == "UNIT_EXITED_VEHICLE" or event == "PET_BATTLE_CLOSE" then
					self:Show()
				end
			end)
It hides the panel in both vehicle and pet battles, although the tooltips still show for each stat when moused over. Would I have to goto the tooltip part of each stat and add a event=="" to those to stop them from showing?

I currently have "if not InCombatLockdown() then" to stop tooltips in combat. Is there a "if not InVehicle" or "if not InPetBattle"

Thanks again Phanx.

Coke
  Reply With Quote
04-14-14, 08:07 PM   #6
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by cokedrivers View Post
It hides the panel in both vehicle and pet battles, although the tooltips still show for each stat when moused over. Would I have to goto the tooltip part of each stat and add a event=="" to those to stop them from showing?
That would indicate that your stat frames are not properly parented to the main panel, since when you hide a frame, all of its children are also hidden. Make sure your stat frames are parented to the panel (or parented to something else that's parented to the panel, etc.) or post your code if you need help figuring it out.
__________________
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.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Addon_action_blocked


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