Thread Tools Display Modes
03-21-12, 05:07 PM   #1
MiRai
A Warpwood Thunder Caller
Join Date: Jul 2011
Posts: 96
Questions Regarding oUF_Fail

Hey guys, thanks for the help a few weeks ago with oUF_Karma but now I'm trying out oUF_Fail (same author). I've been tinkering around with it for most of today trying to tweak it how I'd like it but, I've run into a few issues at the moment.

1) How do I go about removing all text from the Raid Frames? [Answered]
2) How do I go about removing all text from the Party Frames? [Answered]
3) How do I go about removing the latency from the end of all cast bars? [Answered]
4) Where do I adjust how many buffs/debuffs are in each row for the Target frame? [Answered]

Please check post #8 for new questions.


Thanks a lot for everyone's help so far (especially p3lim and Phanx) with all my oUF questions.

Last edited by MiRai : 03-23-12 at 02:30 PM.
  Reply With Quote
03-21-12, 05:37 PM   #2
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
I really wish people asking for help with a specific addon would provide a link to that addon's download page, so I didn't have to go hunt for it in order to try to help them... >_<

1) How do I go about removing all text from the Raid Frames?
The only text I see in the code (eg. I did not load the addon in-game) is the health text, which you can remove by commenting out the line in core.lua that creates it:

Code:
329.		lib.gen_hpstrings(self)
If there is any other text, please describe what information it shows, so I can find it in the code. I did not spend a huge amount of time searching.

2) How do I go about removing all text from the Party Frames?
Similiar to the raid frames, simply comment out the call to the function that creates the health bar text, in core.lua:
Code:
367.		lib.gen_hpstrings(self)
3) How do I go about removing the latency from the end of all cast bars?
In lib.lua, comment out the section of code that creates it:
Code:
    if f.mystyle == "player" then
      --latency (only for player unit)
      local z = s:CreateTexture(nil,"OVERLAY")
      z:SetTexture(cfg.statusbar_texture)
      z:SetVertexColor(1,0.1,0,.6)
      z:SetPoint("TOPRIGHT")
      z:SetPoint("BOTTOMRIGHT")
	  s:SetFrameLevel(1)
      s.SafeZone = z
      -- custom latency display
      local l = lib.gen_fontstring(s, cfg.font, 10, "THINOUTLINE")
      l:SetPoint("CENTER", -2, 17)
      l:SetJustifyH("RIGHT")
	  l:Hide()
      s.Lag = l
      f:RegisterEvent("UNIT_SPELLCAST_SENT", cast.OnCastSent)
    end
4) Where do I adjust how many buffs/debuffs are in each row for the Target frame?
In lib.lua find the functions that create buffs/debuffs:
Code:
705.  lib.createBuffs = function(f)
Code:
738.  lib.createDebuffs = function(f)
... and adjust the values as desired. If you want to make the icons bigger or smaller, and have the length of each row adjust automatically, change the size value. If you want to have a specific number of icons on each row, change the value passed to the SetWidth call from:
Code:
717.		b:SetWidth(f:GetWidth())
to something like:
Code:
		b:SetWidth(((b.size+b.spacing)*4)-b.spacing)
... where 4 is the number of icons you want to show on each row.
  Reply With Quote
03-21-12, 05:58 PM   #3
MiRai
A Warpwood Thunder Caller
Join Date: Jul 2011
Posts: 96
Originally Posted by Phanx View Post
I really wish people asking for help with a specific addon would provide a link to that addon's download page, so I didn't have to go hunt for it in order to try to help them... >_<
Apologies...


The only text I see in the code (eg. I did not load the addon in-game) is the health text, which you can remove by commenting out the line in core.lua that creates it:

Code:
329.		lib.gen_hpstrings(self)
If there is any other text, please describe what information it shows, so I can find it in the code. I did not spend a huge amount of time searching.
Thanks that seems to have done it. I don't know why I was hesitant to comment that out...

In lib.lua, comment out the section of code that creates it:
Code:
    if f.mystyle == "player" then
      --latency (only for player unit)
      local z = s:CreateTexture(nil,"OVERLAY")
      z:SetTexture(cfg.statusbar_texture)
      z:SetVertexColor(1,0.1,0,.6)
      z:SetPoint("TOPRIGHT")
      z:SetPoint("BOTTOMRIGHT")
	  s:SetFrameLevel(1)
      s.SafeZone = z
      -- custom latency display
      local l = lib.gen_fontstring(s, cfg.font, 10, "THINOUTLINE")
      l:SetPoint("CENTER", -2, 17)
      l:SetJustifyH("RIGHT")
	  l:Hide()
      s.Lag = l
      f:RegisterEvent("UNIT_SPELLCAST_SENT", cast.OnCastSent)
    end

Commenting that out throws up this error:


Code:
Message: Interface\AddOns\oUF_Fail\castbar.lua:102: attempt to index local 'sf' (a nil value)
Time: 03/21/12 18:52:58
Count: 1
Stack: Interface\AddOns\oUF_Fail\castbar.lua:102: in function `PostCastStart'
Interface\AddOns\oUF\elements\castbar.lua:61: in function `func'
Interface\AddOns\oUF\events.lua:18: in function <Interface\AddOns\oUF\events.lua:16>
(tail call): ?

Locals: self = oUF_failCastbarplayer {
 0 = <userdata>
 PostCastStop = <function> defined @Interface\AddOns\oUF_Fail\castbar.lua:120
 CastingColor = <table> {
 }
 ChannelingColor = <table> {
 }
 Time = <unnamed> {
 }
 interrupt = true
 PostChannelStart = <function> defined @Interface\AddOns\oUF_Fail\castbar.lua:94
 casting = true
 FailColor = <table> {
 }
 castid = 111
 CompleteColor = <table> {
 }
 delay = 0
 max = 1.5
 Text = <unnamed> {
 }
 duration = 0
 PostCastStart = <function> defined @Interface\AddOns\oUF_Fail\castbar.lua:94
 Spark = <unnamed> {
 }
 __owner = oUF_failPlayer {
 }
 ForceUpdate = <function> defined @Interface\AddOns\oUF\elements\castbar.lua:378
 Icon = <unnamed> {
 }
 PostCastInterrupted = <function> defined @Interface\AddOns\oUF_Fail\castbar.lua:135
 PostChannelStop = <function> defined @Interface\AddOns\oUF_Fail\castbar.lua:129
 PostCastFailed = <function> defined @Interface\AddOns\oUF_Fail\castbar.lua:135
 OnUpdate = <function> defined @Interface\AddOns\oUF_Fail\castbar.lua:54
}
unit = "player"
name = "Red Proto-Drake"
rank = nil
text = 111
pcolor = <table> {
 1 = 1
 2 = 0.50196078431373
 3 = 0.50196078431373
}
interruptcb = <table> {
 1 = 0.37254901960784
 2 = 0.71372549019608
 3 = 1
}
sf = nil
(*temporary) = 364466.943
(*temporary) = 364466.943
(*temporary) = 0.71372549019608
(*temporary) = 1
(*temporary) = <userdata>
(*temporary) = "attempt to index local 'sf' (a nil value)"
cast = <unnamed> {
 0 = <userdata>
 setBarTicks = <function> defined @Interface\AddOns\oUF_Fail\castbar.lua:32
 OnCastbarUpdate = <function> defined @Interface\AddOns\oUF_Fail\castbar.lua:54
 PostCastStart = <function> defined @Interface\AddOns\oUF_Fail\castbar.lua:94
 PostCastStop = <function> defined @Interface\AddOns\oUF_Fail\castbar.lua:120
 PostChannelStop = <function> defined @Interface\AddOns\oUF_Fail\castbar.lua:129
 PostCastFailed = <function> defined @Interface\AddOns\oUF_Fail\castbar.lua:135
 OnCastSent = <function> defined @Interface\AddOns\oUF_Fail\castbar.lua:89
}
channelingTicks = <table> {
 Mind Sear = 5
 Soul Harvest = 4
 Tranquility = 4
 Hurricane = 10
 Drain Soul = 5
 Earthquake = 8
 Mind Flay = 3
 Penance = 2
 Blizzard = 5
 Arcane Missiles = 5
 Evocation = 4
 Drain Life = 5
 Rain of Fire = 4
}


Here's the castbar.lua code:


lua Code:
  1. local addon, ns = ...
  2.   local cfg = ns.cfg
  3.   local cast = CreateFrame("Frame")  
  4.  
  5.   -----------------------------
  6.   -- FUNCTIONS
  7.   -----------------------------
  8.   -- special thanks to Allez for coming up with this solution
  9. local channelingTicks = {
  10.     -- warlock
  11.     [GetSpellInfo(1120)] = 5, -- drain soul
  12.     [GetSpellInfo(689)] = 5, -- drain life
  13.     [GetSpellInfo(5740)] = 4, -- rain of fire
  14.     [GetSpellInfo(79268)] = 4, -- soul harvest
  15.     -- druid
  16.     [GetSpellInfo(740)] = 4, -- Tranquility
  17.     [GetSpellInfo(16914)] = 10, -- Hurricane
  18.     -- priest
  19.     [GetSpellInfo(15407)] = 3, -- mind flay
  20.     [GetSpellInfo(48045)] = 5, -- mind sear
  21.     [GetSpellInfo(47540)] = 2, -- penance
  22.     -- mage
  23.     [GetSpellInfo(5143)] = 5, -- arcane missiles
  24.     [GetSpellInfo(10)] = 5, -- blizzard
  25.     [GetSpellInfo(12051)] = 4, -- evocation
  26.     -- shaman
  27.     [GetSpellInfo(61882)] = 8 -- earthquake
  28. }
  29.  
  30. local ticks = {}
  31.  
  32. cast.setBarTicks = function(castBar, ticknum)
  33.     if ticknum and ticknum > 0 then
  34.         local delta = castBar:GetWidth() / ticknum
  35.         for k = 1, ticknum do
  36.             if not ticks[k] then
  37.                 ticks[k] = castBar:CreateTexture(nil, 'OVERLAY')
  38.                 ticks[k]:SetTexture(cfg.statusbar_texture)
  39.                 ticks[k]:SetVertexColor(0, 0, 0)
  40.                 ticks[k]:SetWidth(1)
  41.                 ticks[k]:SetHeight(castBar:GetHeight())
  42.             end
  43.             ticks[k]:ClearAllPoints()
  44.             ticks[k]:SetPoint("CENTER", castBar, "LEFT", delta * k, 0 )
  45.             ticks[k]:Show()
  46.         end
  47.     else
  48.         for k, v in pairs(ticks) do
  49.             v:Hide()
  50.         end
  51.     end
  52. end
  53.  
  54. cast.OnCastbarUpdate = function(self, elapsed)
  55.     local currentTime = GetTime()
  56.     if self.casting or self.channeling then
  57.         local parent = self:GetParent()
  58.         local duration = self.casting and self.duration + elapsed or self.duration - elapsed
  59.         if (self.casting and duration >= self.max) or (self.channeling and duration <= 0) then
  60.             self.casting = nil
  61.             self.channeling = nil
  62.             return
  63.         end
  64.         if parent.unit == 'player' then
  65.             if self.delay ~= 0 then
  66.                 self.Time:SetFormattedText('%.1f / |cffff0000%.1f|r', duration, self.casting and self.max + self.delay or self.max - self.delay)
  67.             else
  68.                 self.Time:SetFormattedText('%.1f / %.1f', duration, self.max)
  69.                 self.Lag:SetFormattedText("%d ms", self.SafeZone.timeDiff * 1000)
  70.             end
  71.         else
  72.             self.Time:SetFormattedText('%.1f / %.1f', duration, self.casting and self.max + self.delay or self.max - self.delay)
  73.         end
  74.         self.duration = duration
  75.         self:SetValue(duration)
  76.         self.Spark:SetPoint('CENTER', self, 'LEFT', (duration / self.max) * self:GetWidth(), 0)
  77.     else
  78.         self.Spark:Hide()
  79.         local alpha = self:GetAlpha() - 0.02
  80.         if alpha > 0 then
  81.             self:SetAlpha(alpha)
  82.         else
  83.             self.fadeOut = nil
  84.             self:Hide()
  85.         end
  86.     end
  87. end
  88.  
  89. cast.OnCastSent = function(self, event, unit, spell, rank)
  90.     if self.unit ~= unit or not self.Castbar.SafeZone then return end
  91.     self.Castbar.SafeZone.sendTime = GetTime()
  92. end
  93.  
  94. cast.PostCastStart = function(self, unit, name, rank, text)
  95.     local pcolor = {255/255, 128/255, 128/255}
  96.     local interruptcb = {95/255, 182/255, 255/255}
  97.     self:SetAlpha(1.0)
  98.     self.Spark:Show()
  99.     self:SetStatusBarColor(unpack(self.casting and self.CastingColor or self.ChannelingColor))
  100.     if unit == "player"then
  101.         local sf = self.SafeZone
  102.         sf.timeDiff = GetTime() - sf.sendTime
  103.         sf.timeDiff = sf.timeDiff > self.max and self.max or sf.timeDiff
  104.         sf:SetWidth(self:GetWidth() * sf.timeDiff / self.max)
  105.         sf:Show()
  106.         if self.casting then
  107.             cast.setBarTicks(self, 0)
  108.         else
  109.             local spell = UnitChannelInfo(unit)
  110.             self.channelingTicks = channelingTicks[spell] or 0
  111.             cast.setBarTicks(self, self.channelingTicks)
  112.         end
  113.     elseif (unit == "target" or unit == "focus") and not self.interrupt then
  114.         self:SetStatusBarColor(interruptcb[1],interruptcb[2],interruptcb[3],1)
  115.     else
  116.         self:SetStatusBarColor(pcolor[1], pcolor[2], pcolor[3],1)
  117.     end
  118. end
  119.  
  120. cast.PostCastStop = function(self, unit, name, rank, castid)
  121.     if not self.fadeOut then
  122.         self:SetStatusBarColor(unpack(self.CompleteColor))
  123.         self.fadeOut = true
  124.     end
  125.     self:SetValue(self.max)
  126.     self:Show()
  127. end
  128.  
  129. cast.PostChannelStop = function(self, unit, name, rank)
  130.     self.fadeOut = true
  131.     self:SetValue(0)
  132.     self:Show()
  133. end
  134.  
  135. cast.PostCastFailed = function(self, event, unit, name, rank, castid)
  136.     self:SetStatusBarColor(unpack(self.FailColor))
  137.     self:SetValue(self.max)
  138.     if not self.fadeOut then
  139.         self.fadeOut = true
  140.     end
  141.     self:Show()
  142. end
  143.   --hand the lib to the namespace for further usage
  144.   ns.cast = cast


I have yet to play with the width of the buffs but thanks for pointing me in the right direction.
  Reply With Quote
03-21-12, 11:19 PM   #4
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
You need to comment out the parts of the code that try to manipulate the elements you already prevented from being created:

Line 69:
Code:
self.Lag:SetFormattedText("%d ms", self.SafeZone.timeDiff * 1000)
Lines 101-105:
Code:
        local sf = self.SafeZone
        sf.timeDiff = GetTime() - sf.sendTime
        sf.timeDiff = sf.timeDiff > self.max and self.max or sf.timeDiff
        sf:SetWidth(self:GetWidth() * sf.timeDiff / self.max)
        sf:Show()
There may be others; you should be able to find them pretty quickly for any sections of code that either check for the "player" unit or attempt to do anything with the Lag and/or SafeZone members.
  Reply With Quote
03-22-12, 07:46 AM   #5
MiRai
A Warpwood Thunder Caller
Join Date: Jul 2011
Posts: 96
Thanks for taking the time to look at this stuff.

*EDITED OUT BECAUSE ISSUE IS FIXED*

Lines 90 and 91 also contain SafeZone text but, I'm not entirely sure whether I should be commenting out just 90 and 91 or 89 - 92. However, commenting out 89 - 92 seem to produce no change.

Here is my updated castbar.lua w/o 89 - 92 commented out:


lua Code:
  1. local addon, ns = ...
  2.   local cfg = ns.cfg
  3.   local cast = CreateFrame("Frame")  
  4.  
  5.   -----------------------------
  6.   -- FUNCTIONS
  7.   -----------------------------
  8.   -- special thanks to Allez for coming up with this solution
  9. local channelingTicks = {
  10.     -- warlock
  11.     [GetSpellInfo(1120)] = 5, -- drain soul
  12.     [GetSpellInfo(689)] = 5, -- drain life
  13.     [GetSpellInfo(5740)] = 4, -- rain of fire
  14.     [GetSpellInfo(79268)] = 4, -- soul harvest
  15.     -- druid
  16.     [GetSpellInfo(740)] = 4, -- Tranquility
  17.     [GetSpellInfo(16914)] = 10, -- Hurricane
  18.     -- priest
  19.     [GetSpellInfo(15407)] = 3, -- mind flay
  20.     [GetSpellInfo(48045)] = 5, -- mind sear
  21.     [GetSpellInfo(47540)] = 2, -- penance
  22.     -- mage
  23.     [GetSpellInfo(5143)] = 5, -- arcane missiles
  24.     [GetSpellInfo(10)] = 5, -- blizzard
  25.     [GetSpellInfo(12051)] = 4, -- evocation
  26.     -- shaman
  27.     [GetSpellInfo(61882)] = 8 -- earthquake
  28. }
  29.  
  30. local ticks = {}
  31.  
  32. cast.setBarTicks = function(castBar, ticknum)
  33.     if ticknum and ticknum > 0 then
  34.         local delta = castBar:GetWidth() / ticknum
  35.         for k = 1, ticknum do
  36.             if not ticks[k] then
  37.                 ticks[k] = castBar:CreateTexture(nil, 'OVERLAY')
  38.                 ticks[k]:SetTexture(cfg.statusbar_texture)
  39.                 ticks[k]:SetVertexColor(0, 0, 0)
  40.                 ticks[k]:SetWidth(1)
  41.                 ticks[k]:SetHeight(castBar:GetHeight())
  42.             end
  43.             ticks[k]:ClearAllPoints()
  44.             ticks[k]:SetPoint("CENTER", castBar, "LEFT", delta * k, 0 )
  45.             ticks[k]:Show()
  46.         end
  47.     else
  48.         for k, v in pairs(ticks) do
  49.             v:Hide()
  50.         end
  51.     end
  52. end
  53.  
  54. cast.OnCastbarUpdate = function(self, elapsed)
  55.     local currentTime = GetTime()
  56.     if self.casting or self.channeling then
  57.         local parent = self:GetParent()
  58.         local duration = self.casting and self.duration + elapsed or self.duration - elapsed
  59.         if (self.casting and duration >= self.max) or (self.channeling and duration <= 0) then
  60.             self.casting = nil
  61.             self.channeling = nil
  62.             return
  63.         end
  64.         if parent.unit == 'player' then
  65.             if self.delay ~= 0 then
  66.                 self.Time:SetFormattedText('%.1f / |cffff0000%.1f|r', duration, self.casting and self.max + self.delay or self.max - self.delay)
  67.             else
  68.                 self.Time:SetFormattedText('%.1f / %.1f', duration, self.max)
  69.                 --self.Lag:SetFormattedText("%d ms", self.SafeZone.timeDiff * 1000)
  70.             end
  71.         else
  72.             self.Time:SetFormattedText('%.1f / %.1f', duration, self.casting and self.max + self.delay or self.max - self.delay)
  73.         end
  74.         self.duration = duration
  75.         self:SetValue(duration)
  76.         self.Spark:SetPoint('CENTER', self, 'LEFT', (duration / self.max) * self:GetWidth(), 0)
  77.     else
  78.         self.Spark:Hide()
  79.         local alpha = self:GetAlpha() - 0.02
  80.         if alpha > 0 then
  81.             self:SetAlpha(alpha)
  82.         else
  83.             self.fadeOut = nil
  84.             self:Hide()
  85.         end
  86.     end
  87. end
  88.  
  89. cast.OnCastSent = function(self, event, unit, spell, rank)
  90.     if self.unit ~= unit or not self.Castbar.SafeZone then return end
  91.     self.Castbar.SafeZone.sendTime = GetTime()
  92. end
  93.  
  94. cast.PostCastStart = function(self, unit, name, rank, text)
  95.     local pcolor = {255/255, 128/255, 128/255}
  96.     local interruptcb = {95/255, 182/255, 255/255}
  97.     self:SetAlpha(1.0)
  98.     self.Spark:Show()
  99.     self:SetStatusBarColor(unpack(self.casting and self.CastingColor or self.ChannelingColor))
  100.     if unit == "player"then
  101.         --local sf = self.SafeZone
  102.         --sf.timeDiff = GetTime() - sf.sendTime
  103.         --sf.timeDiff = sf.timeDiff > self.max and self.max or sf.timeDiff
  104.         --sf:SetWidth(self:GetWidth() * sf.timeDiff / self.max)
  105.         --sf:Show()
  106.         if self.casting then
  107.             cast.setBarTicks(self, 0)
  108.         else
  109.             local spell = UnitChannelInfo(unit)
  110.             self.channelingTicks = channelingTicks[spell] or 0
  111.             cast.setBarTicks(self, self.channelingTicks)
  112.         end
  113.     elseif (unit == "target" or unit == "focus") and not self.interrupt then
  114.         self:SetStatusBarColor(interruptcb[1],interruptcb[2],interruptcb[3],1)
  115.     else
  116.         self:SetStatusBarColor(pcolor[1], pcolor[2], pcolor[3],1)
  117.     end
  118. end
  119.  
  120. cast.PostCastStop = function(self, unit, name, rank, castid)
  121.     if not self.fadeOut then
  122.         self:SetStatusBarColor(unpack(self.CompleteColor))
  123.         self.fadeOut = true
  124.     end
  125.     self:SetValue(self.max)
  126.     self:Show()
  127. end
  128.  
  129. cast.PostChannelStop = function(self, unit, name, rank)
  130.     self.fadeOut = true
  131.     self:SetValue(0)
  132.     self:Show()
  133. end
  134.  
  135. cast.PostCastFailed = function(self, event, unit, name, rank, castid)
  136.     self:SetStatusBarColor(unpack(self.FailColor))
  137.     self:SetValue(self.max)
  138.     if not self.fadeOut then
  139.         self.fadeOut = true
  140.     end
  141.     self:Show()
  142. end
  143.   --hand the lib to the namespace for further usage
  144.   ns.cast = cast


EDIT: I'm sorry, I did mess up the above and all is currently well. Thank you once again. My question still stands about lines 89 - 92 -- Should something on them be commented out as I do not currently see a visual difference but, those lines contain SafeZone text and I'm just trying to cover any future cast bar issues.

Last edited by MiRai : 03-22-12 at 08:37 AM.
  Reply With Quote
03-22-12, 03:43 PM   #6
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
You don't need to comment those lines out, because they check to see if the SafeZone sub-element exists before trying to manipulate it.

If you are obsessively concerned about shaving off a CPU cycle or two, you could comment out the calls to the whole OnCastSent function from the player frame, but realistically speaking you would not see any difference, so I wouldn't bother.
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Questions Regarding oUF_Fail


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