Thread Tools Display Modes
10-11-14, 11:53 AM   #1
Falleneu
A Deviate Faerie Dragon
Join Date: Aug 2010
Posts: 12
Small bug in my nameplate addon, the castbar, wtb help of lua genius please.

Hey, I have been using a heavily edited version of SH_Nameplates, a addon that hasn't been updated for 2+years now and I kept alive through my poor lua skills. Half a year ago the addon's castbar randomly broke and I came here for some help and a kind member called "Oppugno" fixed it for me.

Sadly the addon on PTR/BETA is broken again in the same section, the name of the spell and the spell duration no longer shows, also if a mob is casting, and WHILE it is casting I target said mob, the castbar decides to grow in hight X10.

http://www.wowinterface.com/forums/s...ad.php?t=48963 Thats the old post.


I hope perhaps someone can help me out here once again.

Thanks anyone for reading this and possibly helping me.

/Nuckels
Attached Files
File Type: zip shNameplates.zip (267.4 KB, 476 views)

Last edited by Falleneu : 10-11-14 at 12:07 PM.
 
10-12-14, 12:57 AM   #2
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
I haven't looked at the code, but whatever the problem is is certainly fixable... however, at this point, you would probably be better off just switching to any of the many nameplate addons that are still actively maintained by their authors. Searching for "plate" should find them all.
__________________
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.
 
10-12-14, 04:27 AM   #3
Tonyleila
A Molten Giant
 
Tonyleila's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 758
KuiNameplates
__________________
Author of: LeilaUI and Aurora: Missing Textures
__________________
 
10-12-14, 05:56 AM   #4
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Yeah, that's what I use as well, but there are others to choose from if you prefer another style.
__________________
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.
 
10-12-14, 06:22 AM   #5
Falleneu
A Deviate Faerie Dragon
Join Date: Aug 2010
Posts: 12
Originally Posted by Phanx View Post
I haven't looked at the code, but whatever the problem is is certainly fixable... however, at this point, you would probably be better off just switching to any of the many nameplate addons that are still actively maintained by their authors. Searching for "plate" should find them all.
I know but I just really like these and I hate swapping nameplate addon as a tank, so I am really hoping on fixing these.

Edit: disabling " if self:IsShown() ~= 1 then return end " makes them work again, what does that line exactly do? It returned a 1 on beta so I just decided to disable it but ya.

Edit 2: perhaps it helps if i link all the code, so ya here that line is alreayd disabled that part with --

Lua Code:
  1. ----------------------------
  2. --- EVENT HANDLERS/CUSTOM---
  3. ----------------------------
  4. local function OnSizeChanged(self, width, height)
  5.     if self:IsShown() ~= 1 then return end
  6.        
  7.     if height > cfg.castbar.height then
  8.         self.needFix = true
  9.     end
  10. end
  11.  
  12. local function OnValueChanged(self, curValue)
  13.      -- if self:IsShown() ~= 1 then return end
  14.     UpdateTime(self, curValue)
  15.    
  16.     --fix castbar from bloating - as a back up to onshow fixcastbar call
  17.     if self:GetHeight() > cfg.castbar.height or self.needFix then
  18.         FixCastbar(self)
  19.         self.needFix = nil
  20.     end
  21.    
  22.     -- --another safety to ensure proper casbar coloring for interruptable vs uninteruptable items
  23.     -- if self.controller and select(2, self:GetStatusBarColor()) > 0.15 then
  24.         -- self:SetStatusBarColor(0.83, 0.14, 0.14)
  25.     -- end
  26. end
  27.  
  28. local function OnShow(self)
  29.     FixCastbar(self)
  30.     self.IconOverlay:Show()
  31.     ColorCastbar(self, self.shieldedRegion:IsShown() == 1)
  32. end
  33.  
  34. local function OnHide(self)
  35.     self.highlight:Hide()
  36. end

Last edited by Falleneu : 10-12-14 at 06:34 AM.
 
10-12-14, 06:42 AM   #6
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
Never compare something like IsShown() to an explicit value like 1 or true, you should pretty much always just do "if not f:IsShown() then" to check that it's not being shown.

I don't think OnSizeChanged can even fire for a hidden frame, anyway.

Just remove the line, it doesn't do anything. It's breaking the function because IsShown() can never return 1 (it returns true on the beta).

This is not the only place you're comparing IsShown() to 1, so you'll have to clean up a few other areas.

Last edited by semlar : 10-12-14 at 06:54 AM.
 
10-12-14, 06:57 AM   #7
Falleneu
A Deviate Faerie Dragon
Join Date: Aug 2010
Posts: 12
Originally Posted by semlar View Post
Never compare something like IsShown() to an explicit value like 1 or true, you should pretty much always just do "if not f:IsShown() then" to check that it's not being shown.

I don't think OnSizeChanged can even fire for a hidden frame, anyway.

Just remove the line, it doesn't do anything. It's breaking the function because IsShown() can never return 1 (it returns true on the beta).

This is not the only place you're comparing IsShown() to 1, so you'll have to clean up a few other areas.
I wish I was better at this, surprising that it even works on Live without issues the way I read this.
 
10-12-14, 07:18 AM   #8
Choonstertwo
A Chromatic Dragonspawn
 
Choonstertwo's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2011
Posts: 194
Originally Posted by Falleneu View Post
I wish I was better at this, surprising that it even works on Live without issues the way I read this.
On live a lot of functions return 1/nil for "boolean" values, but WoD changes most (if not all) of them to return the actual boolean values true/false instead. Explicitly comparing to 1 works if the function returns 1/nil, but it's best to treat them as booleans so you don't need to worry about the specific values returned as long as they evaluate to true/false in boolean expressions (nil and false evaluate to false, everything else to true).

I'm not sure why Blizzard was using 1/nil in the first place, since even Lua 5.0 (the version of Lua initially used by the game) had proper booleans.
 
 

WoWInterface » Site Forums » Archived Beta Forums » WoD Beta archived threads » Small bug in my nameplate addon, the castbar, wtb help of lua genius 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