Thread Tools Display Modes
08-16-16, 07:58 PM   #1
Noxious1899
A Murloc Raider
Join Date: Aug 2016
Posts: 9
Need help please!

Hey, so I found this script online, it basically does like a little shine animation to when you press a key on your actionbar.

It won't work on prepatch idk why, can someone help me fix it and if you managed to fix it put the full code as a reply please? Thanks alot !!


Code:
local animationsCount, animations = 5, {}
local animationNum = 1
local frame, texture, alpha1, scale1, scale2, rotation2 
for i = 1, animationsCount do
    frame = CreateFrame("Frame")
    texture = frame:CreateTexture() texture:SetTexture('Interface\\Cooldown\\star4') texture:SetAlpha(0) texture:SetAllPoints() texture:SetBlendMode("ADD")
    animationGroup = texture:CreateAnimationGroup()
    alpha1 = animationGroup:CreateAnimation("Alpha") alpha1:SetChange(1) alpha1:SetDuration(0) alpha1:SetOrder(1)
    scale1 = animationGroup:CreateAnimation("Scale") scale1:SetScale(1.5, 1.5) scale1:SetDuration(0) scale1:SetOrder(1)
    scale2 = animationGroup:CreateAnimation("Scale") scale2:SetScale(0, 0) scale2:SetDuration(0.3) scale2:SetOrder(2)
    rotation2 = animationGroup:CreateAnimation("Rotation") rotation2:SetDegrees(90) rotation2:SetDuration(0.3) rotation2:SetOrder(2)
    animations[i] = {frame = frame, animationGroup = animationGroup}
end 
local AnimateButton = function(self)
    if not self:IsVisible() then return true end
    local animation = animations[animationNum]
    local frame = animation.frame
    local animationGroup = animation.animationGroup
    frame:SetFrameStrata(self:GetFrameStrata())
    frame:SetFrameLevel(self:GetFrameLevel() + 10)
    frame:SetAllPoints(self)
    animationGroup:Stop()
    animationGroup:Play()
    animationNum = (animationNum % animationsCount) + 1
    return true
end 
hooksecurefunc('MultiActionButtonDown', function(bname, id) AnimateButton(_G[bname..'Button'..id]) end) 
hooksecurefunc('ActionButtonDown', function(id)
     local button
     if C_PetBattles.IsInBattle() then
          if PetBattleFrame then
               if id > NUM_BATTLE_PET_HOTKEYS then return end
               button = PetBattleFrame.BottomFrame.abilityButtons[id]
               if id == BATTLE_PET_ABILITY_SWITCH then
                    button = PetBattleFrame.BottomFrame.SwitchPetButton;
               elseif id == BATTLE_PET_ABILITY_CATCH then
                    button = PetBattleFrame.BottomFrame.CatchButton;
               end
               if not button then return end
          end
          return
     end 
     if OverrideActionBar and OverrideActionBar:IsShown() then
          if id > NUM_OVERRIDE_BUTTONS then return end
          button = _G["OverrideActionBarButton"..id]
     else
          button = _G["ActionButton"..id]
     end
     if not button then return end 
     AnimateButton(button)
end)

Last edited by Noxious1899 : 08-16-16 at 08:00 PM.
  Reply With Quote
08-18-16, 05:11 AM   #2
thomasjohnshannon
A Theradrim Guardian
 
thomasjohnshannon's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 68
I don't know enough to spot all the potential problems but SetChange() was removed and replaced with SetToAlpha() and SetFromAlpha().
__________________
Thomas aka Urnn
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Need help please!


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