Ok I need some help.
This is the code for my actionbar 1
Lua Code:
-----------------------------
-- ACTION BUTTON CONTROLLER
-----------------------------
local function getBarPage()
print("getting pages")
if ( HasBonusActionBar() or HasOverrideActionBar() or HasVehicleActionBar() or HasTempShapeshiftActionBar() ) then
if (HasVehicleActionBar()) then
return GetVehicleBarIndex()
elseif (HasOverrideActionBar()) then
return GetOverrideBarIndex()
elseif (HasTempShapeshiftActionBar()) then
return GetTempShapeshiftBarIndex()
elseif (HasBonusActionBar() and GetActionBarPage() == 1) then
return GetBonusBarIndex()
else
return GetActionBarPage()
end
else
return GetActionBarPage()
end
end
for id = 1, NUM_ACTIONBAR_BUTTONS do
local button = _G["ActionButton"..id]
frame:SetFrameRef(button:GetName(), button)
end
frame:Execute(([[
buttons = table.new()
for id = 1, %s do
buttons[id] = self:GetFrameRef("ActionButton"..id)
end
]]):format(NUM_ACTIONBAR_BUTTONS))
frame:SetAttribute('_onstate-page', ([[
if not newstate then return end
newstate = tonumber(newstate)
for id = 1, %s do
buttons[id]:SetAttribute("actionpage", newstate)
end
]]):format(NUM_ACTIONBAR_BUTTONS))
RegisterStateDriver(frame, "page", getBarPage())
The problem is that the stateid is wrong. It is set to "page" but there is no more page-swapping, thus the statedriver does not get called as often as I need it.
If I do a /reload the correct bar will be loaded on the given value from getBarPage().
Question: Are there any other stateids that I could use?
I need to call the state driver on the following events. But how does an event correlate to a state-id?
Lua Code:
event == "PLAYER_ENTERING_WORLD"
event == "UPDATE_BONUS_ACTIONBAR"
event == "UPDATE_VEHICLE_ACTIONBAR"
event == "UPDATE_OVERRIDE_ACTIONBAR"
event == "ACTIONBAR_PAGE_CHANGED"
The best solution I came up with is:
Lua Code:
local function getPage()
print("getting pages")
if ( HasBonusActionBar() or HasOverrideActionBar() or HasVehicleActionBar() or HasTempShapeshiftActionBar() ) then
if (HasVehicleActionBar()) then
return GetVehicleBarIndex()
elseif (HasOverrideActionBar()) then
return GetOverrideBarIndex()
elseif (HasTempShapeshiftActionBar()) then
return GetTempShapeshiftBarIndex()
elseif (HasBonusActionBar() and GetActionBarPage() == 1) then
return GetBonusBarIndex()
else
return GetActionBarPage()
end
else
return GetActionBarPage()
end
end
for id = 1, NUM_ACTIONBAR_BUTTONS do
local button = _G["ActionButton"..id]
frame:SetFrameRef(button:GetName(), button)
end
frame:SetScript("OnEvent", function(self, event)
frame:Execute(([[
buttons = table.new()
for id = 1, %s do
buttons[id] = self:GetFrameRef("ActionButton"..id)
buttons[id]:SetAttribute("actionpage", %s)
end
]]):format(NUM_ACTIONBAR_BUTTONS, getPage()))
end)
frame:RegisterEvent("PLAYER_ENTERING_WORLD")
frame:RegisterEvent("UPDATE_BONUS_ACTIONBAR")
frame:RegisterEvent("UPDATE_VEHICLE_ACTIONBAR")
frame:RegisterEvent("UPDATE_OVERRIDE_ACTIONBAR")
frame:RegisterEvent("ACTIONBAR_PAGE_CHANGED")
That actually works. But as soon as I exit the vehicle in combat I get a totally wierd taint.
Code:
7/5 00:54:45.243 Global variable rGetPoint tainted by rLib - Interface\AddOns\rLib\core\dragframe.lua:12
7/5 00:54:45.243 Global variable rResetToDefaultPoint tainted by rLib - Interface\AddOns\rLib\core\dragframe.lua:23
7/5 00:54:45.243 Global variable rResetToPoint tainted by rLib - Interface\AddOns\rLib\core\dragframe.lua:30
7/5 00:54:45.243 Global variable rUnlockFrame tainted by rLib - Interface\AddOns\rLib\core\dragframe.lua:43
7/5 00:54:45.243 Global variable rLockFrame tainted by rLib - Interface\AddOns\rLib\core\dragframe.lua:58
7/5 00:54:45.243 Global variable rUnlockAllFrames tainted by rLib - Interface\AddOns\rLib\core\dragframe.lua:71
7/5 00:54:45.243 Global variable rLockAllFrames tainted by rLib - Interface\AddOns\rLib\core\dragframe.lua:80
7/5 00:54:45.243 Global variable rResetAllFramesToDefault tainted by rLib - Interface\AddOns\rLib\core\dragframe.lua:89
7/5 00:54:45.243 Global variable rCreateDragFrame tainted by rLib - Interface\AddOns\rLib\core\dragframe.lua:98
7/5 00:54:45.243 Global variable rCreateSlashCmdFunction tainted by rLib - Interface\AddOns\rLib\core\slashcmd.lua:14
7/5 00:54:45.243 Global variable rButtonBarFader tainted by rLib - Interface\AddOns\rLib\core\fader.lua:15
7/5 00:54:45.243 Global variable rFrameFader tainted by rLib - Interface\AddOns\rLib\core\fader.lua:32
7/5 00:54:45.243 Global variable SLASH_rabs1 tainted by rActionBarStyler - Interface\AddOns\rActionBarStyler\core\slashcmd.lua:24
7/5 00:54:45.321 Global variable ACTIVE_CHAT_EDIT_BOX tainted by rActionBarStyler - Interface\FrameXML\ChatFrame.lua:3782 ChatEdit_DeactivateChat()
7/5 00:54:45.321 Interface\FrameXML\InterfaceOptionsPanels.lua:981 InterfaceOptionsSocialPanelChatStyle_SetChatStyle()
7/5 00:54:45.321 Interface\FrameXML\InterfaceOptionsPanels.lua:907
7/5 00:54:45.321 Execution tainted by rActionBarStyler while reading ACTIVE_CHAT_EDIT_BOX - Interface\FrameXML\ChatFrame.lua:3781 ChatEdit_DeactivateChat()
7/5 00:54:45.321 Interface\FrameXML\ChatFrame.lua:3727 ChatEdit_OnEditFocusLost()
7/5 00:54:45.321 ChatFrame1EditBox:OnEditFocusLost()
7/5 00:54:45.321 ChatFrame1EditBox:ClearFocus()
7/5 00:54:45.321 Interface\FrameXML\ChatFrame.lua:3769 ChatEdit_SetDeactivated()
7/5 00:54:45.321 Interface\FrameXML\ChatFrame.lua:3785 ChatEdit_DeactivateChat()
7/5 00:54:45.321 Interface\FrameXML\InterfaceOptionsPanels.lua:981 InterfaceOptionsSocialPanelChatStyle_SetChatStyle()
7/5 00:54:45.321 Interface\FrameXML\InterfaceOptionsPanels.lua:907
How can I get a taint from my own lib?
The only thing that I could think of that nets me the taint is calling SetAttribute on the button inside EXECUTE...but how should I do it otherwise?