WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Cataclysm Beta (https://www.wowinterface.com/forums/forumdisplay.php?f=82)
-   -   Blizzard Actionbars (https://www.wowinterface.com/forums/showthread.php?t=35600)

zork 10-15-10 01:56 AM

Blizzard Actionbars
 
I'm currently updating my actionbar mod and had a pretty frustrating time trying to adpet the first actionbar/bonusactionbar. It just didn't work out when it comes to combat. So I searched around and tukz already had something to work with.

I tried it yesterday and what you need is this pretty much this. This will handle the complete first bar.

Source: http://github.com/tukz/Tukui/blob/ma...nbars/Bar1.lua

But I need a little help here trying to understand what he did. As far as I understand it here is using SecureStateDrivers and onstate changed he is applying a new bar based on the page state.

But how is the reference between the default buttons and the new bar being made? I see "SetFrameRef", "Execute" and "SetAttribute("_onstate-page"," but actually I don't understand what they do.

d87 10-15-10 03:08 AM

Quote:

But how is the reference between the default buttons and the new bar being made? I see "SetFrameRef", "Execute" and "SetAttribute("_onstate-page"," but actually I don't understand what they do.
Code:

local button
                for i = 1, NUM_ACTIONBAR_BUTTONS do
                        button = _G["ActionButton"..i]
                        self:SetFrameRef("ActionButton"..i, button) -- creates frame "ActionButtonX" reference in secure environment
                end       

                self:Execute([[ -- executes the snippet in the secure env
                        buttons = table.new()
                        for i = 1, 12 do
                                table.insert(buttons, self:GetFrameRef("ActionButton"..i))
                        end  -- creates new table in secure environment and fills it with action button frames retrieving them by frame reference


                ]])

                self:SetAttribute("_onstate-page", [[
                        for i, button in ipairs(buttons) do
                                button:SetAttribute("actionpage", tonumber(newstate))
                        end -- State driver updates "page" attribute based on macro conditionals.  "_onstate-page" is called and newstate contains new actionbar page number.
                ]])

what i fail to understand is why would you do something like that to default action bars. they're already doing this... Because of damn taint probably

Vrul 10-15-10 03:50 PM

Quote:

Originally Posted by d87 (Post 210463)
what i fail to understand is why would you do something like that to default action bars. they're already doing this... Because of damn taint probably

It is for overriding Blizzard's default paging with some custom paging. Example: A priest has offensive spells on page 1 and heals on page 2. Custom paging is implemented so that ALT changes page 1 to page 2 and page 2 to page 1. If the ALT key was down without those SetAttribute calls while on page 1, all of the priest's spells would now be the heals from page 2 but still show the icons for the offensive spells from page 1.

Now the reason why Blizzard's code doesn't need to do that is because it updates the button visually via OnEvent in response to registered events while SecureStateDriver updates during OnUpdate. Since OnEvent is processed before OnUpdate, any state change made will not be picked up so you must force the update manually via a SetAttribute call in the secure environment since the OnAttributeChanged script also triggers a visual update.


All times are GMT -6. The time now is 10:19 PM.

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