Quantcast
Autocast animated overlay trouble - WoWInterface
 
Thread Tools Display Modes
09-04-14, 12:04 AM   #1
kez717
A Murloc Raider
Join Date: Oct 2008
Posts: 5
Autocast animated overlay trouble

I am in need of a way to use or mimic the default autocast animated overlay (like on pet buttons). My code is in only lua, no xml. I don't have anything related to autocast in my code at the moment, every attempt resulted in various errors (over 40 attempts (with lfg "eye", autocast shine, autocast sparkles, both the bits to get them to work on my buttons and the animation parts themselves modified to directly take a button)so a lot of errors) and I ended up removing it so get on with the rest of the addon. Either a script that copies the look of the animation that I can plug my buttons into (and how to use is) or info on what I data I need (and what format to put it in) so that my buttons will play nice with blizzards default animation would be appreciated. I've puzzled out the rest of the addon I'm working on (new to lua, only started about 2-3 weeks ago), but this just doesn't seem to want to work.
  Reply With Quote
09-04-14, 01:09 AM   #2
suicidalkatt
A Rage Talon Dragon Guard
 
suicidalkatt's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 331
Originally Posted by kez717 View Post
I am in need of a way to use or mimic the default autocast animated overlay (like on pet buttons). My code is in only lua, no xml. I don't have anything related to autocast in my code at the moment, every attempt resulted in various errors (over 40 attempts (with lfg "eye", autocast shine, autocast sparkles, both the bits to get them to work on my buttons and the animation parts themselves modified to directly take a button)so a lot of errors) and I ended up removing it so get on with the rest of the addon. Either a script that copies the look of the animation that I can plug my buttons into (and how to use is) or info on what I data I need (and what format to put it in) so that my buttons will play nice with blizzards default animation would be appreciated. I've puzzled out the rest of the addon I'm working on (new to lua, only started about 2-3 weeks ago), but this just doesn't seem to want to work.
Take a look at InlineAura. I'm sure there might be some useful tidbits in there for you.
  Reply With Quote
09-04-14, 03:36 AM   #3
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
Hm, autocast? The "ants"?
  Reply With Quote
09-04-14, 10:00 AM   #4
kez717
A Murloc Raider
Join Date: Oct 2008
Posts: 5
I'll take a look at inline aura. And yes, the "ants" is what I'm trying to get working.
  Reply With Quote
09-04-14, 10:22 AM   #5
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
I've implemented the 'ants' animation and the glow via single textures in http://www.wowinterface.com/download...4-BABBars.html as using an animation was not possible.

Don't know if it helps, but it looks like this: (the textures are attached to this post)

Lua Code:
  1. --adding textures for ants/glow
  2. local tGlow = _G[Button:GetName().."Glow"] or Button:CreateTexture(Button:GetName().."Glow","OVERLAY")
  3. tGlow:SetTexture("Interface\\AddOns\\BAB\\textures\\IconAlertGlow.tga")
  4. tGlow:ClearAllPoints()
  5. tGlow:SetPoint("TOPLEFT", Button, "TOPLEFT")
  6. tGlow:SetPoint("BOTTOMRIGHT", Button, "BOTTOMRIGHT")
  7. tGlow:SetDrawLayer("OVERLAY", 2)
  8. tGlow:Hide()
  9.  
  10. local tAnts = _G[Button:GetName().."Ants"] or Button:CreateTexture(Button:GetName().."Ants","OVERLAY")
  11. tAnts:SetTexture("Interface\\AddOns\\BAB\\textures\\IconAlertAnts1.tga")
  12. tAnts:ClearAllPoints()
  13. tAnts:SetPoint("TOPLEFT", Button, "TOPLEFT")
  14. tAnts:SetPoint("BOTTOMRIGHT", Button, "BOTTOMRIGHT")
  15. tAnts:SetDrawLayer("OVERLAY", 2)
  16. tAnts:Hide()
  17.  
  18.  
  19. --updating the ants if _G[Button:GetName().."Ants"] is visible
  20. do
  21.     local f = CreateFrame("Frame", "BABMain", UIParent)
  22.     f:SetScript("OnUpdate", function(...)
  23.       for btni, btnv in pairs(Buttons) do
  24.         if _G[btnv:GetName().."Ants"] then
  25.             local tAnts = _G[btnv:GetName().."Ants"]
  26.             if tAnts:IsVisible() then
  27.                 if not tAnts.Step then
  28.                     tAnts.Step = 1
  29.                     tAnts.StepTime = GetTime()
  30.                 end
  31.                 if GetTime() - tAnts.StepTime > 0.025 then
  32.                      tAnts.Step = tAnts.Step + 1
  33.                      if tAnts.Step > 22 then
  34.                          tAnts.Step = 1
  35.                      end
  36.                      tAnts:SetTexture("Interface\\AddOns\\BAB\\textures\\IconAlertAnts"..tAnts.Step..".tga")
  37.                      tAnts.StepTime = GetTime()
  38.                 end
  39.             end
  40.         end            
  41.       end
  42.     end)
  43. end
Attached Files
File Type: zip IconAlertAnts.zip (103.7 KB, 88 views)

Last edited by Duugu : 09-04-14 at 10:25 AM.
  Reply With Quote
09-04-14, 11:48 AM   #6
kez717
A Murloc Raider
Join Date: Oct 2008
Posts: 5
Thanks Duugu, one question though. How do I get it to work? I tried adding it, but its giving me the one of the same errors (so far, if I keep pushing I could probably get a lot more errors from it) as the blizz animation does "bad argument #1 to 'pairs" (table expected, got nil)" for this line "for btni, btnv in pairs(buttons) do". I don't have a clue what I'm missing except that apparently the code is wanting data I'm not giving it. For some reason I can't even get generalized code to work and have to hard code everything for every button, so a simple 9 button bar is almost 2k lines long and fairly messy.
  Reply With Quote
09-04-14, 12:13 PM   #7
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
You need to provide the right data to the code.

For the first two snippets the variable 'Button' has to be a reference to the button frame object you would like to act on. Like
Lua Code:
  1. local Button = _G["ActionButton1"] --just an example ... use your actual button frame(s)
before them.

The last snippet expects a table 'Buttons' containing references to all of your button frames. Like
Lua Code:
  1. local Buttons =
  2. {
  3. _G["ActionButton1"], _G["ActionButton2"], _G["ActionButton3"] -- again, just an example
  4. }

Please keep in mind, that these code parts are generalized quick and dirty copies from of my addons code. Do not expect them to work out of the box.

If you need help with your code, then the best way would be to show what you've done so far.

Last edited by Duugu : 09-04-14 at 12:18 PM.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Autocast animated overlay trouble

Thread Tools
Display Modes

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