View Single Post
07-29-20, 07:39 AM   #28
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,917
Wow .. all I had to do was monitor for a couple of events and then do a secure execute snippet to update the buttons again .. I suppose it is all a learning curve

The first time round it doesn't need to do it as the initial state-page change has the same code. Any additional calls to update the bars just asks for the page as last set and updates all the buttons again.

Works flawlessly with Big Boom quest and doesn't affect stance bar changes rofl.

Lua Code:
  1. elseif event == "UPDATE_VEHICLE_ACTIONBAR" or event == "UPDATE_OVERRIDE_ACTIONBAR" then
  2.         nUI_ActionBar:Execute(([[
  3.             local page = self:GetAttribute('state-page')
  4.             if not page then return end
  5.             local pageOffset, hasAction = (page - 1) * NUM_ACTIONBAR_BUTTONS
  6.             for id = 1, #ActionButtons do
  7.                 if HasAction(id + pageOffset) then
  8.                     ActionButtons[id]:SetAttribute('actionpage', page)
  9.                     hasAction = true
  10.                 else
  11.                     ActionButtons[id]:SetAttribute('actionpage', nil)
  12.                 end
  13.             end
  14.  
  15.             if not hasAction then
  16.                 self:SetAttribute('state-page', nil)
  17.             end            
  18.         ]]):gsub('NUM_ACTIONBAR_BUTTONS', NUM_ACTIONBAR_BUTTONS))        
  19.     end
__________________
  Reply With Quote