Thread Tools Display Modes
03-12-14, 11:04 AM   #1
cokedrivers
A Rage Talon Dragon Guard
 
cokedrivers's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 325
Errors when doing the Chen Stormstrout Quest

As the title states I get these 2 errors:

Error #1
Code:
14x [ADDON_ACTION_BLOCKED] AddOn "BasicUI" tried to call the protected function "ArenaEnemyFrames:ClearAllPoints()".
!BugGrabber-r198-release\BugGrabber.lua:552: in function <!BugGrabber\BugGrabber.lua:552>
<in C code>
FrameXML\UIParent.lua:2224: in function "UIParentManageFramePositions"
FrameXML\UIParent.lua:1578: in function <FrameXML\UIParent.lua:1565>
<in C code>
FrameXML\UIParent.lua:2263: in function "UIParent_ManageFramePositions"
FrameXML\BuffFrame.lua:369: in function "BuffFrame_UpdateAllBuffAnchors"
FrameXML\BuffFrame.lua:112: in function "BuffFrame_Update"
FrameXML\BuffFrame.lua:52: in function <FrameXML\BuffFrame.lua:48>

Locals:
nil
Error #2
Code:
14x [ADDON_ACTION_BLOCKED] AddOn "BasicUI" tried to call the protected function "ArenaEnemyFrames:SetPoint()".
!BugGrabber-r198-release\BugGrabber.lua:552: in function <!BugGrabber\BugGrabber.lua:552>
<in C code>
FrameXML\UIParent.lua:2225: in function "UIParentManageFramePositions"
FrameXML\UIParent.lua:1578: in function <FrameXML\UIParent.lua:1565>
<in C code>
FrameXML\UIParent.lua:2263: in function "UIParent_ManageFramePositions"
FrameXML\BuffFrame.lua:369: in function "BuffFrame_UpdateAllBuffAnchors"
FrameXML\BuffFrame.lua:112: in function "BuffFrame_Update"
FrameXML\BuffFrame.lua:52: in function <FrameXML\BuffFrame.lua:48>

Locals:
nil
Error #3
Code:
14x [ADDON_ACTION_BLOCKED] AddOn "BasicUI" tried to call the protected function "ArenaPrepFrames:SetPoint()".
!BugGrabber-r198-release\BugGrabber.lua:552: in function <!BugGrabber\BugGrabber.lua:552>
<in C code>
FrameXML\UIParent.lua:2230: in function "UIParentManageFramePositions"
FrameXML\UIParent.lua:1578: in function <FrameXML\UIParent.lua:1565>
<in C code>
FrameXML\UIParent.lua:2263: in function "UIParent_ManageFramePositions"
FrameXML\BuffFrame.lua:369: in function "BuffFrame_UpdateAllBuffAnchors"
FrameXML\BuffFrame.lua:112: in function "BuffFrame_Update"
FrameXML\BuffFrame.lua:52: in function <FrameXML\BuffFrame.lua:48>

Locals:
nil
Error #4
Code:
14x [ADDON_ACTION_BLOCKED] AddOn "BasicUI" tried to call the protected function "ArenaPrepFrames:ClearAllPoints()".
!BugGrabber-r198-release\BugGrabber.lua:552: in function <!BugGrabber\BugGrabber.lua:552>
<in C code>
FrameXML\UIParent.lua:2229: in function "UIParentManageFramePositions"
FrameXML\UIParent.lua:1578: in function <FrameXML\UIParent.lua:1565>
<in C code>
FrameXML\UIParent.lua:2263: in function "UIParent_ManageFramePositions"
FrameXML\BuffFrame.lua:369: in function "BuffFrame_UpdateAllBuffAnchors"
FrameXML\BuffFrame.lua:112: in function "BuffFrame_Update"
FrameXML\BuffFrame.lua:52: in function <FrameXML\BuffFrame.lua:48>

Locals:
nil
Here is my Unitframes.lua:
Lua Code:
  1. local B, C, DB = unpack(select(2, ...)) -- Import:  B - function; C - config; DB - Database
  2.  
  3. if C["unitframes"].enable ~= true then return end
  4.  
  5.  
  6. -- Special Thanks to the guys over at Arena Junkies for most of these scripts
  7. -- [url]http://www.arenajunkies.com/topic/222642-default-ui-scripts/[/url]
  8.  
  9. local _G = _G
  10.  
  11.  
  12. -- Player Frame
  13. if C["unitframes"].player.enable then
  14.  
  15.     -- Frame Scale
  16.     _G["PlayerFrame"]:SetScale(C["unitframes"].player.scale);  
  17.     PlayerFrameHealthBarText:SetFont(C['media'].fontNormal, C["unitframes"].player.fontSize,"THINOUTLINE");
  18.     PlayerFrameManaBarText:SetFont(C['media'].fontNormal, C["unitframes"].player.fontSize, "THINOUTLINE");
  19.     PlayerFrameAlternateManaBarText:SetFont(C['media'].fontNormal, C["unitframes"].player.fontSize, "THINOUTLINE");
  20.     PetFrameHealthBarText:SetFont(C['media'].fontNormal, C["unitframes"].player.fontSizepet,"THINOUTLINE");
  21.     PetFrameManaBarText:SetFont(C['media'].fontNormal, C["unitframes"].player.fontSizepet, "THINOUTLINE");
  22.  
  23. end
  24.  
  25. -- Target Frame
  26. if C["unitframes"].target.enable then
  27.  
  28.     -- Frame Scale
  29.      _G["TargetFrame"]:SetScale(C["unitframes"].target.scale);
  30.     TargetFrameTextureFrameHealthBarText:SetFont(C['media'].fontNormal, C["unitframes"].target.fontSize, "THINOUTLINE");
  31.     TargetFrameTextureFrameManaBarText:SetFont(C['media'].fontNormal, C["unitframes"].target.fontSize, "THINOUTLINE");
  32.  
  33. end;
  34.  
  35. -- Focus Frame
  36. if C["unitframes"].focus.enable then
  37.  
  38.     -- Frame Scale
  39.      _G["FocusFrame"]:SetScale(C["unitframes"].focus.scale)
  40.     FocusFrameTextureFrameHealthBarText:SetFont(C['media'].fontNormal, C["unitframes"].focus.fontSize,"THINOUTLINE")
  41.     FocusFrameTextureFrameManaBarText:SetFont(C['media'].fontNormal, C["unitframes"].focus.fontSize,"THINOUTLINE")
  42.  
  43. end;
  44.  
  45.  
  46. -- Party Frames --
  47. if C["unitframes"].party.enable then
  48.  
  49.     -- Clear all old settings
  50.     PartyMemberFrame1:ClearAllPoints();
  51.     PartyMemberFrame2:ClearAllPoints();
  52.     PartyMemberFrame3:ClearAllPoints();
  53.     PartyMemberFrame4:ClearAllPoints();
  54.  
  55.     -- Create new locations
  56.     PartyMemberFrame1:SetPoint(C['unitframes'].party.position.relAnchor, UIParent, C['unitframes'].party.position.offSetX, C['unitframes'].party.position.offSetY);
  57.     PartyMemberFrame2:SetPoint("TOPLEFT", PartyMemberFrame1, 0, -75);
  58.     PartyMemberFrame3:SetPoint("TOPLEFT", PartyMemberFrame2, 0, -75);
  59.     PartyMemberFrame4:SetPoint("TOPLEFT", PartyMemberFrame3, 0, -75);
  60.  
  61.     -- Make the new locations stay
  62.     PartyMemberFrame1.SetPoint = function() end;
  63.     PartyMemberFrame2.SetPoint = function() end;
  64.     PartyMemberFrame3.SetPoint = function() end;
  65.     PartyMemberFrame4.SetPoint = function() end;
  66.  
  67.     -- Set the scale of all the frames
  68.     PartyMemberFrame1:SetScale(C["unitframes"].party.scale);
  69.     PartyMemberFrame2:SetScale(C["unitframes"].party.scale);
  70.     PartyMemberFrame3:SetScale(C["unitframes"].party.scale);
  71.     PartyMemberFrame4:SetScale(C["unitframes"].party.scale);
  72.    
  73.     -- Set Font Size
  74.     PartyMemberFrame1HealthBarText:SetFont(C['media'].fontNormal, C["unitframes"].party.fontSize, "THINOUTLINE")
  75.     PartyMemberFrame1ManaBarText:SetFont(C['media'].fontNormal, C["unitframes"].party.fontSize, "THINOUTLINE")
  76.     PartyMemberFrame2HealthBarText:SetFont(C['media'].fontNormal, C["unitframes"].party.fontSize, "THINOUTLINE")
  77.     PartyMemberFrame2ManaBarText:SetFont(C['media'].fontNormal, C["unitframes"].party.fontSize, "THINOUTLINE")
  78.     PartyMemberFrame3HealthBarText:SetFont(C['media'].fontNormal, C["unitframes"].party.fontSize, "THINOUTLINE")
  79.     PartyMemberFrame3ManaBarText:SetFont(C['media'].fontNormal, C["unitframes"].party.fontSize, "THINOUTLINE")
  80.     PartyMemberFrame4HealthBarText:SetFont(C['media'].fontNormal, C["unitframes"].party.fontSize, "THINOUTLINE")
  81.     PartyMemberFrame4ManaBarText:SetFont(C['media'].fontNormal, C["unitframes"].party.fontSize, "THINOUTLINE")
  82. end;
  83.  
  84.  -- Arena Frames
  85. if C["unitframes"].arena.enable then
  86.     LoadAddOn("Blizzard_ArenaUI"); -- You only need to run this once. You can safely delete any copies of this line.
  87.      
  88.     ArenaEnemyFrames:SetScale(C["unitframes"].arena.scale);
  89.    
  90.     ArenaEnemyFrame1HealthBarText:SetFont(C['media'].fontNormal, C["unitframes"].arena.fontSize,"THINOUTLINE");
  91.     ArenaEnemyFrame1ManaBarText:SetFont(C['media'].fontNormal, C["unitframes"].arena.fontSize, "THINOUTLINE");
  92.     ArenaEnemyFrame2HealthBarText:SetFont(C['media'].fontNormal, C["unitframes"].arena.fontSize,"THINOUTLINE");
  93.     ArenaEnemyFrame2ManaBarText:SetFont(C['media'].fontNormal, C["unitframes"].arena.fontSize, "THINOUTLINE");
  94.     ArenaEnemyFrame3HealthBarText:SetFont(C['media'].fontNormal, C["unitframes"].arena.fontSize,"THINOUTLINE");
  95.     ArenaEnemyFrame3ManaBarText:SetFont(C['media'].fontNormal, C["unitframes"].arena.fontSize, "THINOUTLINE");
  96.     ArenaEnemyFrame4HealthBarText:SetFont(C['media'].fontNormal, C["unitframes"].arena.fontSize,"THINOUTLINE");
  97.     ArenaEnemyFrame4ManaBarText:SetFont(C['media'].fontNormal, C["unitframes"].arena.fontSize, "THINOUTLINE");
  98.     ArenaEnemyFrame5HealthBarText:SetFont(C['media'].fontNormal, C["unitframes"].arena.fontSize,"THINOUTLINE");
  99.     ArenaEnemyFrame5ManaBarText:SetFont(C['media'].fontNormal, C["unitframes"].arena.fontSize, "THINOUTLINE");
  100.  
  101.  
  102.     if C["unitframes"].arena.tracker == true then
  103.         trinkets = {};
  104.         local arenaFrame,trinket;
  105.         for i = 1, 5 do
  106.             arenaFrame = "ArenaEnemyFrame"..i;
  107.             trinket = CreateFrame("Cooldown", arenaFrame.."Trinket", ArenaEnemyFrames);
  108.             trinket:SetPoint("TOPRIGHT", arenaFrame, 30, -6);
  109.             trinket:SetSize(24, 24);
  110.             trinket.icon = trinket:CreateTexture(nil, "BACKGROUND");
  111.             trinket.icon:SetAllPoints();
  112.             trinket.icon:SetTexture("Interface\\Icons\\inv_jewelry_trinketpvp_01");
  113.             trinket:Hide();
  114.             trinkets["arena"..i] = trinket;
  115.         end;
  116.         local events = CreateFrame("Frame");
  117.         function events:UNIT_SPELLCAST_SUCCEEDED(unitID, spell, rank, lineID, spellID)
  118.             if not trinkets[unitID] then
  119.                 return;
  120.             end ;      
  121.             if spellID == 59752 or spellID == 42292 then
  122.                 CooldownFrame_SetTimer(trinkets[unitID], GetTime(), 120, 1);
  123.                 SendChatMessage("Trinket used by: "..GetUnitName(unitID, true), "PARTY");
  124.             end;
  125.         end;
  126.         function events:PLAYER_ENTERING_WORLD()
  127.             local _, instanceType = IsInInstance();
  128.             if instanceType == "arena" then
  129.                 self:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED");
  130.             elseif self:IsEventRegistered("UNIT_SPELLCAST_SUCCEEDED") then
  131.                 self:UnregisterEvent("UNIT_SPELLCAST_SUCCEEDED");
  132.                 for _, trinket in pairs(trinkets) do
  133.                     trinket:SetCooldown(0, 0);
  134.                     trinket:Hide();
  135.                 end;        
  136.             end;
  137.         end;
  138.         events:SetScript("OnEvent", function(self, event, ...) return self[event](self, ...) end);
  139.         events:RegisterEvent("PLAYER_ENTERING_WORLD");
  140.     end;
  141. end;
  142.  
  143.  -- Boss Frames
  144. if C["unitframes"].boss.enable then
  145.     for i = 1,4 do
  146.         local boss = _G["Boss"..i.."TargetFrame"];
  147.         if boss then
  148.             boss:SetScale(C["unitframes"].boss.scale)
  149.             boss:ClearAllPoints();
  150.             boss:SetPoint(C['unitframes'].boss.position.relAnchor, UIParent, C['unitframes'].boss.position.offSetX, C['unitframes'].boss.position.offSetY);
  151.             boss.ClearAllPoints = function() end;
  152.             boss.SetPoint = function() end;    
  153.         end;
  154.     end;
  155. end;
  156.  
  157. -- Font Style thanks to Phanx from WoWinterface.
  158. local shorts = {
  159.     { 1e10, 1e9, "%.0fb" }, --  10b+ as  12b
  160.     {  1e9, 1e9, "%.1fb" }, --   1b+ as 8.3b
  161.     {  1e7, 1e6, "%.0fm" }, --  10m+ as  14m
  162.     {  1e6, 1e6, "%.1fm" }, --   1m+ as 7.4m
  163.     {  1e5, 1e3, "%.0fk" }, -- 100k+ as 840k
  164.     {  1e3, 1e3, "%.1fk" }, --   1k+ as 2.5k
  165.     {    0,   1,    "%d" }, -- < 1k  as  974
  166. }
  167. for i = 1, #shorts do
  168.     shorts[i][4] = shorts[i][3] .. " (%.0f%%)"
  169. end
  170.  
  171. hooksecurefunc("TextStatusBar_UpdateTextStringWithValues", function(statusBar, fontString, value, valueMin, valueMax)
  172.     if value == 0 then
  173.         return fontString:SetText("")
  174.     end
  175.  
  176.     local style = GetCVar("statusTextDisplay")
  177.     if style == "PERCENT" then
  178.         return fontString:SetFormattedText("%.0f%%", value / valueMax * 100)
  179.     end
  180.     for i = 1, #shorts do
  181.         local t = shorts[i]
  182.         if value >= t[1] then
  183.             if style == "BOTH" then
  184.                 return fontString:SetFormattedText(t[4], value / t[2], value / valueMax * 100)
  185.             else
  186.                 return fontString:SetFormattedText(t[3], value / t[2])             
  187.             end
  188.         end
  189.     end
  190. end)
  191.  
  192. local function UnitIsPet(unit)
  193.     return UnitPlayerControlled(unit) and not UnitIsPlayer(unit)
  194. end
  195.  
  196. hooksecurefunc("UnitFrame_Update", function(self)
  197.     if not self.name then return end
  198.     local unit = self.unit -- THIS WAS MISSING
  199.  
  200.     local color
  201.    
  202.     if UnitIsPlayer(unit) then
  203.         local _, class = UnitClass(unit)
  204.         color = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[class]
  205.     elseif UnitIsTapped(unit) and not UnitIsTappedByPlayer(unit) then
  206.         color = GRAY_FONT_COLOR
  207.     elseif UnitIsEnemy(unit, "player") then
  208.         color = FACTION_BAR_COLORS[1]      
  209.     else
  210.         local reaction = UnitReaction(unit, "player")
  211.         color = reaction and FACTION_BAR_COLORS[reaction] or FACTION_BAR_COLORS[5]
  212.     end
  213.  
  214.     if not color then
  215.         color = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)["priest"]
  216.     end
  217.  
  218.     if UnitIsPet(unit) then
  219.         self.name:SetTextColor(1, 1, 1)
  220.     else
  221.         self.name:SetTextColor(color.r, color.g, color.b)
  222.     end
  223.  
  224. end)
  225.  
  226.  
  227. -- Disable healing/damage spam over player/pet frame:
  228. PlayerHitIndicator:SetText(nil)
  229. PlayerHitIndicator.SetText = function() end
  230. PetHitIndicator:SetText(nil)
  231. PetHitIndicator.SetText = function() end

And here is my Buff.lua:
Lua Code:
  1. local B, C, DB = unpack(select(2, ...)) -- Import:  B - function; C - config; DB - Database
  2.  
  3. if C['buff'].enable ~= true then return end
  4.  
  5. BuffFrame:ClearAllPoints()
  6. BuffFrame:SetScale(C["buff"].buffScale)
  7. BuffFrame:SetPoint('TOPRIGHT', Minimap, 'TOPLEFT', -25, 0)

and here is the config for both:
Lua Code:
  1. local B, C, DB = unpack(select(2, ...)) -- Import:  B - function; C - config; DB - Database
  2.  
  3. ---------------
  4. -- Buff Options
  5. ----------------
  6. DB["buff"] = {
  7.     ["enable"] = true,
  8.     ["buffScale"] = 1.19,
  9. }
  10.  
  11. --------------
  12. -- Unitframes
  13. --------------
  14. DB["unitframes"] = {
  15.    
  16.     ["enable"] = true,
  17.     ["player"] = {
  18.         ["enable"] = true,          -- Enable Player Frame Adjustments
  19.         ["scale"] = 1.15,           -- Player Frame Scale
  20.         ["fontSize"] = 13,          -- Stausbar Font Size
  21.         ["fontSizepet"] = 10,           -- Stausbar Font Size
  22.     },
  23.     ["target"] = {
  24.         ["enable"] = true,          -- Enable Target Frame Adjustments
  25.         ["scale"] = 1.15,           -- Target Frame Scale
  26.         ["fontSize"] = 13,          -- Stausbar Font Size
  27.     },
  28.     ["focus"] = {
  29.         ["enable"] = true,          -- Enable Focus Frame Adjustments
  30.         ["scale"] = 1.15,           -- Focus Frame Scale
  31.         ["fontSize"] = 13,          -- Stausbar Font Size
  32.     },
  33.     ["party"] = {
  34.         ["enable"] = true,
  35.         ["scale"] = 1.15,
  36.         ["fontSize"] = 11,          -- Stausbar Font Size
  37.         ["position"] = {
  38.             ["relAnchor"] = "TOPLEFT",
  39.             ["offSetX"] = 10,       -- Controls the X offset. (Left - Right)
  40.             ["offSetY"] = -150,     -- Controls the Y offset. (Up - Down)
  41.         },
  42.     },
  43.     ["arena"] = {
  44.         ["enable"] = true,
  45.         ["scale"] = 1.5,
  46.         ["fontSize"] = 11,          -- Stausbar Font Size
  47.         ["tracker"] = true,
  48.     },
  49.     ["boss"] = {
  50.         ["enable"] = true,
  51.         ["scale"] = 1.15,
  52.         ["fontSize"] = 13,          -- Stausbar Font Size  
  53.         ["position"] = {
  54.             ["relAnchor"] = "TOPRIGHT",
  55.             ["offSetX"] = -50,      -- Controls the X offset. (Left - Right)
  56.             ["offSetY"] = -250,     -- Controls the Y offset. (Up - Down)
  57.         },
  58.     },
  59. }

and beings I use DB and C here is the converter:
Lua Code:
  1. ----------------------------------------------------------------------------
  2. -- This Module loads new user settings if BasicUI_Config is loaded
  3. ----------------------------------------------------------------------------
  4. local B, C, DB = unpack(select(2, ...)) -- Import:  B - function; C - config; DB - Database
  5.  
  6. --Convert default database
  7. for group,options in pairs(DB) do
  8.     if not C[group] then C[group] = {} end
  9.     for option, value in pairs(options) do
  10.         C[group][option] = value
  11.     end
  12. end
  13.  
  14. if IsAddOnLoaded("BasicUI_Config") then
  15.     local BasicUIConfig = LibStub("AceAddon-3.0"):GetAddon("BasicUIConfig")
  16.     BasicUIConfig:Load()
  17.  
  18.     --Load settings from BasicUIConfig database
  19.     for group, options in pairs(BasicUIConfig.db.profile) do
  20.         if C[group] then
  21.             for option, value in pairs(options) do
  22.                 C[group][option] = value
  23.             end
  24.         end
  25.     end
  26.        
  27.     B.SavePath = BasicUIConfig.db.profile
  28. end

Thanks for any help.
Coke

Last edited by cokedrivers : 03-12-14 at 11:12 AM. Reason: Added other 3 errors
  Reply With Quote
03-13-14, 07:20 PM   #2
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,240
Chances are high, say about 99.9%, that "BasicUI" is not actually doing anything wrong. I get that same error with HaloPro, and my roommate gets it with something else.

What is happening is thus:
  1. AddOnX or Blizzard UI element calls protected frame/function
  2. That causes error or taint, but game moves along
  3. When the error or taint gets too much for the game, it blames the next AddOn or Blizzard UI element alphabetically
To prevent your AddOn from getting the blame, remember the golden rule: localize everything! If you have two or more Lua files in your AddOn (like you), reference them locally. There are two methods, depending on how you wrote your AddOn.

[1]
Code:
-- put this at the top of every file
-- returns string, table. being variable names, you can call them whatever you wish
-- use the table to pass data, obviously
-- use the string to call functions
local BasicUI, privateTable = ...
[2]
Code:
-- in your first file, put this
-- does the same thing as above, but adds the AceAddon methods (OnInitialize, OnEnable, OnDisable)
local BasicUI = LibStub("AceAddon-3.0"):NewAddon("BasicUI")

-- in second and consecutive files..
local BasicUI = LibStub("AceAddon-3.0"):GetAddon("BasicUI")
Now your AddOn will not be blamed for UI taint.
  Reply With Quote
03-13-14, 10:32 PM   #3
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
1. For the love of kittens and unicorns, use some freaking variables instead of doing long table lookups over and over. Seeing c['media'].fontNormal written out 500 times is just excruciating.

2. This kind of thing causes Bad Taint, and will definitely get your addon blamed (and rightfully so) for ACTION_BLOCKED errors:

Code:
    -- Make the new locations stay
    PartyMemberFrame1.SetPoint = function() end;
    PartyMemberFrame2.SetPoint = function() end;
    PartyMemberFrame3.SetPoint = function() end;
    PartyMemberFrame4.SetPoint = function() end;
You cannot overwrite functions or (anything else) on a secure frame without breaking something. Your function is insecure, and taints the entire frame. Instead, you need to figure out which Blizzard function(s) move those frames, and post-hook them to move the frames back to the desired location after the default UI repositions them, but only if you're not in combat.

3. Globals are bad. Don't make anything a global unless you have a Really Good Reason. If you're not 100% sure something needs to be global, it doesn't need to be global, so make it local. On a similar topic, always define variables in the narrowest/strictest/lowest scope necessary. For example, here you are doing two things "wrong":

Code:
    if C["unitframes"].arena.tracker == true then
        trinkets = {};
        -- ^^ This is a global (bad) and a very generically named
        -- global at that (even worse). Add a "local" in front of it.
        local arenaFrame,trinket;
        -- ^^ These variables do not need to exist in this scope.
        -- Get rid of this line, and add a "local" in front of each one where
        -- they are defined INSIDE the loop below, since that is the only
        -- place they are used.
        for i = 1, 5 do
            arenaFrame = "ArenaEnemyFrame"..i;
            trinket = CreateFrame("Cooldown", arenaFrame.."Trinket", ArenaEnemyFrames);
(Actually you're doing a third thing "wrong" by parenting all 5 trinket icons the "ArenaEnemyFrames" frame, whatever that is, instead of parenting each one to the specific frame it's associated with. Change "ArenaEnemyFrames" to "arenaFrame" there.)

Finally, ArenaJunkies is a horrible place to get any kind of code. I've never seen any code snippet attributed to ArenaJunkies that wasn't a contender for the Worst Code Ever Written prize.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
03-14-14, 08:35 AM   #4
cokedrivers
A Rage Talon Dragon Guard
 
cokedrivers's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 325
Originally Posted by Phanx View Post
1. For the love of kittens and unicorns, use some freaking variables instead of doing long table lookups over and over. Seeing c['media'].fontNormal written out 500 times is just excruciating.

2. This kind of thing causes Bad Taint, and will definitely get your addon blamed (and rightfully so) for ACTION_BLOCKED errors:

Code:
    -- Make the new locations stay
    PartyMemberFrame1.SetPoint = function() end;
    PartyMemberFrame2.SetPoint = function() end;
    PartyMemberFrame3.SetPoint = function() end;
    PartyMemberFrame4.SetPoint = function() end;
You cannot overwrite functions or (anything else) on a secure frame without breaking something. Your function is insecure, and taints the entire frame. Instead, you need to figure out which Blizzard function(s) move those frames, and post-hook them to move the frames back to the desired location after the default UI repositions them, but only if you're not in combat.

3. Globals are bad. Don't make anything a global unless you have a Really Good Reason. If you're not 100% sure something needs to be global, it doesn't need to be global, so make it local. On a similar topic, always define variables in the narrowest/strictest/lowest scope necessary. For example, here you are doing two things "wrong":

Code:
    if C["unitframes"].arena.tracker == true then
        trinkets = {};
        -- ^^ This is a global (bad) and a very generically named
        -- global at that (even worse). Add a "local" in front of it.
        local arenaFrame,trinket;
        -- ^^ These variables do not need to exist in this scope.
        -- Get rid of this line, and add a "local" in front of each one where
        -- they are defined INSIDE the loop below, since that is the only
        -- place they are used.
        for i = 1, 5 do
            arenaFrame = "ArenaEnemyFrame"..i;
            trinket = CreateFrame("Cooldown", arenaFrame.."Trinket", ArenaEnemyFrames);
(Actually you're doing a third thing "wrong" by parenting all 5 trinket icons the "ArenaEnemyFrames" frame, whatever that is, instead of parenting each one to the specific frame it's associated with. Change "ArenaEnemyFrames" to "arenaFrame" there.)

Finally, ArenaJunkies is a horrible place to get any kind of code. I've never seen any code snippet attributed to ArenaJunkies that wasn't a contender for the Worst Code Ever Written prize.
So I tried taking your advice and cleaned up all the reparative code.


Old Unitframes.lua:
Lua Code:
  1. local B, C, DB = unpack(select(2, ...)) -- Import:  B - function; C - config; DB - Database
  2.  
  3. if C["unitframes"].enable ~= true then return end
  4.  
  5.  
  6. local _G = _G
  7.  
  8.  
  9. -- Player Frame
  10. if C["unitframes"].player.enable then
  11.  
  12.     -- Frame Scale
  13.     _G["PlayerFrame"]:SetScale(C["unitframes"].player.scale);  
  14.     PlayerFrameHealthBarText:SetFont(C['media'].fontNormal, C["unitframes"].player.fontSize,"THINOUTLINE");
  15.     PlayerFrameManaBarText:SetFont(C['media'].fontNormal, C["unitframes"].player.fontSize, "THINOUTLINE");
  16.     PlayerFrameAlternateManaBarText:SetFont(C['media'].fontNormal, C["unitframes"].player.fontSize, "THINOUTLINE");
  17.     PetFrameHealthBarText:SetFont(C['media'].fontNormal, C["unitframes"].player.fontSizepet,"THINOUTLINE");
  18.     PetFrameManaBarText:SetFont(C['media'].fontNormal, C["unitframes"].player.fontSizepet, "THINOUTLINE");
  19.  
  20. end
  21.  
  22. -- Target Frame
  23. if C["unitframes"].target.enable then
  24.  
  25.     -- Frame Scale
  26.      _G["TargetFrame"]:SetScale(C["unitframes"].target.scale);
  27.     TargetFrameTextureFrameHealthBarText:SetFont(C['media'].fontNormal, C["unitframes"].target.fontSize, "THINOUTLINE");
  28.     TargetFrameTextureFrameManaBarText:SetFont(C['media'].fontNormal, C["unitframes"].target.fontSize, "THINOUTLINE");
  29.  
  30. end;
  31.  
  32. -- Focus Frame
  33. if C["unitframes"].focus.enable then
  34.  
  35.     -- Frame Scale
  36.      _G["FocusFrame"]:SetScale(C["unitframes"].focus.scale)
  37.     FocusFrameTextureFrameHealthBarText:SetFont(C['media'].fontNormal, C["unitframes"].focus.fontSize,"THINOUTLINE")
  38.     FocusFrameTextureFrameManaBarText:SetFont(C['media'].fontNormal, C["unitframes"].focus.fontSize,"THINOUTLINE")
  39.  
  40. end;
  41.  
  42.  
  43. -- Party Frames --
  44. if C["unitframes"].party.enable then
  45.  
  46.     -- Clear all old settings
  47.     PartyMemberFrame1:ClearAllPoints();
  48.     PartyMemberFrame2:ClearAllPoints();
  49.     PartyMemberFrame3:ClearAllPoints();
  50.     PartyMemberFrame4:ClearAllPoints();
  51.  
  52.     -- Create new locations
  53.     PartyMemberFrame1:SetPoint(C['unitframes'].party.position.relAnchor, UIParent, C['unitframes'].party.position.offSetX, C['unitframes'].party.position.offSetY);
  54.     PartyMemberFrame2:SetPoint("TOPLEFT", PartyMemberFrame1, 0, -75);
  55.     PartyMemberFrame3:SetPoint("TOPLEFT", PartyMemberFrame2, 0, -75);
  56.     PartyMemberFrame4:SetPoint("TOPLEFT", PartyMemberFrame3, 0, -75);
  57.  
  58.     -- Make the new locations stay
  59.     PartyMemberFrame1.SetPoint = function() end;
  60.     PartyMemberFrame2.SetPoint = function() end;
  61.     PartyMemberFrame3.SetPoint = function() end;
  62.     PartyMemberFrame4.SetPoint = function() end;
  63.  
  64.     -- Set the scale of all the frames
  65.     PartyMemberFrame1:SetScale(C["unitframes"].party.scale);
  66.     PartyMemberFrame2:SetScale(C["unitframes"].party.scale);
  67.     PartyMemberFrame3:SetScale(C["unitframes"].party.scale);
  68.     PartyMemberFrame4:SetScale(C["unitframes"].party.scale);
  69.    
  70.     -- Set Font Size
  71.     PartyMemberFrame1HealthBarText:SetFont(C['media'].fontNormal, C["unitframes"].party.fontSize, "THINOUTLINE")
  72.     PartyMemberFrame1ManaBarText:SetFont(C['media'].fontNormal, C["unitframes"].party.fontSize, "THINOUTLINE")
  73.     PartyMemberFrame2HealthBarText:SetFont(C['media'].fontNormal, C["unitframes"].party.fontSize, "THINOUTLINE")
  74.     PartyMemberFrame2ManaBarText:SetFont(C['media'].fontNormal, C["unitframes"].party.fontSize, "THINOUTLINE")
  75.     PartyMemberFrame3HealthBarText:SetFont(C['media'].fontNormal, C["unitframes"].party.fontSize, "THINOUTLINE")
  76.     PartyMemberFrame3ManaBarText:SetFont(C['media'].fontNormal, C["unitframes"].party.fontSize, "THINOUTLINE")
  77.     PartyMemberFrame4HealthBarText:SetFont(C['media'].fontNormal, C["unitframes"].party.fontSize, "THINOUTLINE")
  78.     PartyMemberFrame4ManaBarText:SetFont(C['media'].fontNormal, C["unitframes"].party.fontSize, "THINOUTLINE")
  79. end;
  80.  
  81.  -- Arena Frames
  82. if C["unitframes"].arena.enable then
  83.     LoadAddOn("Blizzard_ArenaUI"); -- You only need to run this once. You can safely delete any copies of this line.
  84.      
  85.     ArenaEnemyFrames:SetScale(C["unitframes"].arena.scale);
  86.    
  87.     ArenaEnemyFrame1HealthBarText:SetFont(C['media'].fontNormal, C["unitframes"].arena.fontSize,"THINOUTLINE");
  88.     ArenaEnemyFrame1ManaBarText:SetFont(C['media'].fontNormal, C["unitframes"].arena.fontSize, "THINOUTLINE");
  89.     ArenaEnemyFrame2HealthBarText:SetFont(C['media'].fontNormal, C["unitframes"].arena.fontSize,"THINOUTLINE");
  90.     ArenaEnemyFrame2ManaBarText:SetFont(C['media'].fontNormal, C["unitframes"].arena.fontSize, "THINOUTLINE");
  91.     ArenaEnemyFrame3HealthBarText:SetFont(C['media'].fontNormal, C["unitframes"].arena.fontSize,"THINOUTLINE");
  92.     ArenaEnemyFrame3ManaBarText:SetFont(C['media'].fontNormal, C["unitframes"].arena.fontSize, "THINOUTLINE");
  93.     ArenaEnemyFrame4HealthBarText:SetFont(C['media'].fontNormal, C["unitframes"].arena.fontSize,"THINOUTLINE");
  94.     ArenaEnemyFrame4ManaBarText:SetFont(C['media'].fontNormal, C["unitframes"].arena.fontSize, "THINOUTLINE");
  95.     ArenaEnemyFrame5HealthBarText:SetFont(C['media'].fontNormal, C["unitframes"].arena.fontSize,"THINOUTLINE");
  96.     ArenaEnemyFrame5ManaBarText:SetFont(C['media'].fontNormal, C["unitframes"].arena.fontSize, "THINOUTLINE");
  97.  
  98.  
  99.     if C["unitframes"].arena.tracker == true then
  100.         trinkets = {};
  101.         local arenaFrame,trinket;
  102.         for i = 1, 5 do
  103.             arenaFrame = "ArenaEnemyFrame"..i;
  104.             trinket = CreateFrame("Cooldown", arenaFrame.."Trinket", ArenaEnemyFrames);
  105.             trinket:SetPoint("TOPRIGHT", arenaFrame, 30, -6);
  106.             trinket:SetSize(24, 24);
  107.             trinket.icon = trinket:CreateTexture(nil, "BACKGROUND");
  108.             trinket.icon:SetAllPoints();
  109.             trinket.icon:SetTexture("Interface\\Icons\\inv_jewelry_trinketpvp_01");
  110.             trinket:Hide();
  111.             trinkets["arena"..i] = trinket;
  112.         end;
  113.         local events = CreateFrame("Frame");
  114.         function events:UNIT_SPELLCAST_SUCCEEDED(unitID, spell, rank, lineID, spellID)
  115.             if not trinkets[unitID] then
  116.                 return;
  117.             end ;      
  118.             if spellID == 59752 or spellID == 42292 then
  119.                 CooldownFrame_SetTimer(trinkets[unitID], GetTime(), 120, 1);
  120.                 SendChatMessage("Trinket used by: "..GetUnitName(unitID, true), "PARTY");
  121.             end;
  122.         end;
  123.         function events:PLAYER_ENTERING_WORLD()
  124.             local _, instanceType = IsInInstance();
  125.             if instanceType == "arena" then
  126.                 self:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED");
  127.             elseif self:IsEventRegistered("UNIT_SPELLCAST_SUCCEEDED") then
  128.                 self:UnregisterEvent("UNIT_SPELLCAST_SUCCEEDED");
  129.                 for _, trinket in pairs(trinkets) do
  130.                     trinket:SetCooldown(0, 0);
  131.                     trinket:Hide();
  132.                 end;        
  133.             end;
  134.         end;
  135.         events:SetScript("OnEvent", function(self, event, ...) return self[event](self, ...) end);
  136.         events:RegisterEvent("PLAYER_ENTERING_WORLD");
  137.     end;
  138. end;
  139.  
  140.  -- Boss Frames
  141. if C["unitframes"].boss.enable then
  142.     for i = 1,4 do
  143.         local boss = _G["Boss"..i.."TargetFrame"];
  144.         if boss then
  145.             boss:SetScale(C["unitframes"].boss.scale)
  146.             boss:ClearAllPoints();
  147.             boss:SetPoint(C['unitframes'].boss.position.relAnchor, UIParent, C['unitframes'].boss.position.offSetX, C['unitframes'].boss.position.offSetY);
  148.             --boss.ClearAllPoints = function() end;
  149.             --boss.SetPoint = function() end;      
  150.         end;
  151.     end;
  152. end;
  153.  
  154. -- Font Style thanks to Phanx from WoWinterface.
  155. local shorts = {
  156.     { 1e10, 1e9, "%.0fB" }, --  10b+ as  12b
  157.     {  1e9, 1e9, "%.1fB" }, --   1b+ as 8.3b
  158.     {  1e7, 1e6, "%.0fM" }, --  10m+ as  14m
  159.     {  1e6, 1e6, "%.1fM" }, --   1m+ as 7.4m
  160.     {  1e5, 1e3, "%.0fK" }, -- 100k+ as 840k
  161.     {  1e3, 1e3, "%.1fK" }, --   1k+ as 2.5k
  162.     {    0,   1,    "%d" }, -- < 1k  as  974
  163. }
  164. for i = 1, #shorts do
  165.     shorts[i][4] = shorts[i][3] .. " (%.0f%%)"
  166. end
  167.  
  168. hooksecurefunc("TextStatusBar_UpdateTextStringWithValues", function(statusBar, fontString, value, valueMin, valueMax)
  169.     if value == 0 then
  170.         return fontString:SetText("")
  171.     end
  172.  
  173.     local style = GetCVar("statusTextDisplay")
  174.     if style == "PERCENT" then
  175.         return fontString:SetFormattedText("%.0f%%", value / valueMax * 100)
  176.     end
  177.     for i = 1, #shorts do
  178.         local t = shorts[i]
  179.         if value >= t[1] then
  180.             if style == "BOTH" then
  181.                 return fontString:SetFormattedText(t[4], value / t[2], value / valueMax * 100)
  182.             else
  183.                 if value < valueMax then
  184.                     for j = 1, #shorts do
  185.                         local v = shorts[j]
  186.                         if valueMax >= v[1] then
  187.                             return fontString:SetFormattedText(t[3] .. " / " .. v[3], value / t[2], valueMax / v[2])
  188.                         end
  189.                     end
  190.                 end
  191.                 return fontString:SetFormattedText(t[3], value / t[2])
  192.             end
  193.         end
  194.     end
  195. end)
  196.  
  197. hooksecurefunc("UnitFrame_Update", function(self)
  198.     if not self.name then return end
  199.  
  200.     local unit, color = self.unit
  201.     if UnitPlayerControlled(unit) then
  202.         if UnitIsPlayer(unit) then
  203.             local _, class = UnitClass(unit)
  204.             color = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[class]
  205.         else
  206.             color = HIGHLIGHT_FONT_COLOR
  207.         end
  208.     elseif UnitIsDead(unit) or UnitIsTapped(unit) and not UnitIsTappedByPlayer(unit) then
  209.         color = GRAY_FONT_COLOR
  210.     else
  211.         color = FACTION_BAR_COLORS[UnitIsEnemy(unit, "player") and 1 or UnitReaction(unit, "player") or 5]
  212.     end
  213.  
  214.     if not color then
  215.         color = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)["PRIEST"]
  216.     end
  217.  
  218.     self.name:SetTextColor(color.r, color.g, color.b)
  219. end)
  220.  
  221.  
  222. -- Disable healing/damage spam over player/pet frame:
  223. PlayerHitIndicator:SetText(nil)
  224. PlayerHitIndicator.SetText = function() end
  225. PetHitIndicator:SetText(nil)
  226. PetHitIndicator.SetText = function() end

New Unitframes.lua:
Lua Code:
  1. local B, C, DB = unpack(select(2, ...)) -- Import:  B - function; C - config; DB - Database
  2.  
  3. if C["unitframes"].enable ~= true then return end
  4.  
  5.  
  6. local _G = _G
  7. local font = C['media'].fontNormal
  8.  
  9. -- Player Frame
  10. if C["unitframes"].player.enable then
  11.     if _G["PlayerFrame"] then
  12.         _G["PlayerFrame"]:SetScale(C["unitframes"].player.scale);
  13.         _G["PlayerFrameHealthBarText"]:SetFont(font, C["unitframes"].player.fontSize,"THINOUTLINE");
  14.         _G["PlayerFrameManaBarText"]:SetFont(font, C["unitframes"].player.fontSize, "THINOUTLINE");
  15.         _G["PlayerFrameAlternateManaBarText"]:SetFont(font, C["unitframes"].player.fontSize, "THINOUTLINE");
  16.         _G["PetFrameHealthBarText"]:SetFont(font, C["unitframes"].player.fontSizepet,"THINOUTLINE");
  17.         _G["PetFrameManaBarText"]:SetFont(font, C["unitframes"].player.fontSizepet, "THINOUTLINE");
  18.     end
  19. end
  20.  
  21. -- Target Frame
  22. if C["unitframes"].target.enable then
  23.  
  24.     if _G["TargetFrame"] then
  25.         _G["TargetFrame"]:SetScale(C["unitframes"].target.scale);
  26.         _G["TargetFrameTextureFrameHealthBarText"]:SetFont(font, C["unitframes"].target.fontSize, "THINOUTLINE");
  27.         _G["TargetFrameTextureFrameManaBarText"]:SetFont(font, C["unitframes"].target.fontSize, "THINOUTLINE");    
  28.     end;
  29. end;
  30.  
  31. -- Focus Frame
  32. if C["unitframes"].focus.enable then
  33.  
  34.     if _G["FocusFrame"] then
  35.         _G["FocusFrame"]:SetScale(C["unitframes"].focus.scale)
  36.         _G["FocusFrameTextureFrameHealthBarText"]:SetFont(font, C["unitframes"].focus.fontSize,"THINOUTLINE")
  37.         _G["FocusFrameTextureFrameManaBarText"]:SetFont(font, C["unitframes"].focus.fontSize,"THINOUTLINE")    
  38.     end;
  39. end;
  40.  
  41.  
  42. -- Party Frames --
  43. if C["unitframes"].party.enable then
  44.  
  45.     for i = 1, MAX_PARTY_MEMBERS do
  46.         local partyFrame = "PartyMemberFrame"..i
  47.         _G[partyFrame]:SetScale(C["unitframes"].party.scale);
  48.         _G[partyFrame.."HealthBarText"]:SetFont(font, C["unitframes"].party.fontSize, "THINOUTLINE");
  49.         _G[partyFrame.."ManaBarText"]:SetFont(font, C["unitframes"].party.fontSize, "THINOUTLINE");    
  50.     end
  51.    
  52. end;
  53.  
  54.  -- Arena Frames
  55. if C["unitframes"].arena.enable then
  56.     hooksecurefunc("Arena_LoadUI", function()
  57.         for i = 1, MAX_ARENA_ENEMIES do
  58.             arenaFrame = "ArenaEnemyFrame"..i
  59.             _G[arenaFrame]:SetScale(C["unitframes"].arena.scale);
  60.             _G[arenaFrame.."HealthBarText"]:SetFont(font, C["unitframes"].arena.fontSize,"THINOUTLINE");
  61.             _G[arenaFrame.."ManaBarText"]:SetFont(font, C["unitframes"].arena.fontSize, "THINOUTLINE");
  62.         end
  63.     end)   
  64. end;
  65.  
  66.  -- Boss Frames
  67. if C["unitframes"].boss.enable then
  68.  
  69.     for i = 1, MAX_BOSS_FRAMES do
  70.         local bossFrame = "Boss"..i.."TargetFrame"
  71.         _G[bossFrame.."NameBackground"]:SetTexture([[Interface\DialogFrame\UI-DialogBox-Background]])
  72.         _G[bossFrame]:SetScale(C["unitframes"].boss.scale);
  73.         _G[bossFrame]:SetPoint(C['unitframes'].boss.position.relAnchor, UIParent, C['unitframes'].boss.position.offSetX, C['unitframes'].boss.position.offSetY);       
  74.     end;   
  75. end;
  76.  
  77. -- Font Style / Color thanks to Phanx from WoWinterface.
  78.  
  79.     -- Font Style
  80. local shorts = {
  81.     { 1e10, 1e9, "%.0fB" }, --  10b+ as  12b
  82.     {  1e9, 1e9, "%.1fB" }, --   1b+ as 8.3b
  83.     {  1e7, 1e6, "%.0fM" }, --  10m+ as  14m
  84.     {  1e6, 1e6, "%.1fM" }, --   1m+ as 7.4m
  85.     {  1e5, 1e3, "%.0fK" }, -- 100k+ as 840k
  86.     {  1e3, 1e3, "%.1fK" }, --   1k+ as 2.5k
  87.     {    0,   1,    "%d" }, -- < 1k  as  974
  88. }
  89. for i = 1, #shorts do
  90.     shorts[i][4] = shorts[i][3] .. " (%.0f%%)"
  91. end
  92.  
  93. hooksecurefunc("TextStatusBar_UpdateTextStringWithValues", function(statusBar, fontString, value, valueMin, valueMax)
  94.     if value == 0 then
  95.         return fontString:SetText("")
  96.     end
  97.  
  98.     local style = GetCVar("statusTextDisplay")
  99.     if style == "PERCENT" then
  100.         return fontString:SetFormattedText("%.0f%%", value / valueMax * 100)
  101.     end
  102.     for i = 1, #shorts do
  103.         local t = shorts[i]
  104.         if value >= t[1] then
  105.             if style == "BOTH" then
  106.                 return fontString:SetFormattedText(t[4], value / t[2], value / valueMax * 100)
  107.             else
  108.                 if value < valueMax then
  109.                     for j = 1, #shorts do
  110.                         local v = shorts[j]
  111.                         if valueMax >= v[1] then
  112.                             return fontString:SetFormattedText(t[3] .. " / " .. v[3], value / t[2], valueMax / v[2])
  113.                         end
  114.                     end
  115.                 end
  116.                 return fontString:SetFormattedText(t[3], value / t[2])
  117.             end
  118.         end
  119.     end
  120. end)
  121.     -- Font Color
  122. hooksecurefunc("UnitFrame_Update", function(self)
  123.     if not self.name then return end
  124.    
  125.     local PET_COLOR = { r = 157/255, g = 197/255, b = 255/255 }
  126.     local unit, color = self.unit
  127.     if UnitPlayerControlled(unit) then
  128.         if UnitIsPlayer(unit) then
  129.             local _, class = UnitClass(unit)
  130.             color = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[class]
  131.         else
  132.             color = PET_COLOR
  133.         end
  134.     elseif UnitIsDead(unit) or UnitIsTapped(unit) and not UnitIsTappedByPlayer(unit) then
  135.         color = GRAY_FONT_COLOR
  136.     else
  137.         color = FACTION_BAR_COLORS[UnitIsEnemy(unit, "player") and 1 or UnitReaction(unit, "player") or 5]
  138.     end
  139.  
  140.     if not color then
  141.         color = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)["PRIEST"]
  142.     end
  143.  
  144.     self.name:SetTextColor(color.r, color.g, color.b)
  145. end)
  146.  
  147. local frame = CreateFrame("FRAME")
  148. frame:RegisterEvent("GROUP_ROSTER_UPDATE")
  149. frame:RegisterEvent("PLAYER_TARGET_CHANGED")
  150. frame:RegisterEvent("PLAYER_FOCUS_CHANGED")
  151. frame:RegisterEvent("UNIT_FACTION")
  152.  
  153. local unitRegions = {
  154.     target = TargetFrameNameBackground,
  155.     focus = FocusFrameNameBackground,
  156. }
  157.  
  158. frame:SetScript("OnEvent", function(self, event, ...)
  159.     for unit, region in pairs(unitRegions) do
  160.         if UnitIsPlayer(unit) then
  161.             region:SetTexture([[Interface\DialogFrame\UI-DialogBox-Background]])
  162.         end
  163.     end
  164. end)
  165.  
  166. -- Disable healing/damage spam over player/pet frame:
  167. PlayerHitIndicator:SetText(nil)
  168. PlayerHitIndicator.SetText = function() end
  169. PetHitIndicator:SetText(nil)
  170. PetHitIndicator.SetText = function() end

So far no errors with bugsack but then again I haven't joined a group or raid or arena yet.

Coke

Last edited by cokedrivers : 03-14-14 at 12:07 PM.
  Reply With Quote
03-14-14, 04:31 PM   #5
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Could still use some more variables. :P

Also, there's no value in looking things up in _G instead of just using them directly, eg. this:
Code:
_G["PlayerFrame"]:DoSomething()
...costs a global lookup and a table lookup, so it's actually slower than this:
Code:
PlayerFrame:DoSomething()
...which only costs a global lookup.

The only reason to look something up in _G is if it's dynamically constructed, eg.
Code:
for i = 1, 4 do
    _G["PartyFrame"..i]:DoSomething()
end
...where the exact object name is not "known" ahead of time.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Errors when doing the Chen Stormstrout Quest

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