Quantcast Small bug in my nameplate addon, the castbar, wtb help of lua genius please. - WoWInterface
 
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, 160 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.
__________________
Author/maintainer of Grid, PhanxChat, oUF_Phanx, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
 
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: 759
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.
__________________
Author/maintainer of Grid, PhanxChat, oUF_Phanx, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
 
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,059
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.
 
10-12-14, 09:19 AM   #9
Rainrider
A Firelord
AddOn Author - Click to view addons
Join Date: Nov 2008
Posts: 453
WoW was in development long before 2003 (the release date of lua 5.0), so they probably used a previous version. Since everything that is not nil / false(post lua 5.0) is true, true booleans were probably pretty low on their list
 
10-12-14, 10:41 AM   #10
Falleneu
A Deviate Faerie Dragon
Join Date: Aug 2010
Posts: 12
Ok i just keep breaking stuff, imma just ask if anyone here with lots of addon knowledge and some time would like to clean up the addon.

Would greatly appreciate it, can throw in a beta key for WoD for anyone who can help.
 
10-12-14, 02:23 PM   #11
MoonWitch
A Firelord
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 455
DO you happen to have a screenshot of it in action?
__________________
 
10-13-14, 04:12 AM   #12
Falleneu
A Deviate Faerie Dragon
Join Date: Aug 2010
Posts: 12
Originally Posted by MoonWitch View Post
DO you happen to have a screenshot of it in action?
The addon or the bug i referred to in the original post?
 
10-13-14, 05:04 AM   #13
MoonWitch
A Firelord
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 455
Both actually.

I do agree with someone elses opinion you might be better of migrating to something else; but if we know what they look like - we might be able to make better recommendations. Or find an incentive to fix it
__________________
 
10-13-14, 06:49 AM   #14
Falleneu
A Deviate Faerie Dragon
Join Date: Aug 2010
Posts: 12
Originally Posted by MoonWitch View Post
Both actually.

I do agree with someone elses opinion you might be better of migrating to something else; but if we know what they look like - we might be able to make better recommendations. Or find an incentive to fix it
http://i.imgur.com/CLZHsJ8.jpg

The bug isn't on this screenshot but its basicly that all the text doesn't appear beneath the castbar, but as mentioned previously I managed to fix that but then found out the entire addon coding is borked due to the above posters.
 
10-13-14, 11:22 AM   #15
MoonWitch
A Firelord
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 455
NOt the best coder out there - most certainly not. But the reason I asked for screenshots - is because it's not the code that got you, it's the way it looks. Perhaps some currently working nameplates will suit your look just fine.

As it is right now; I do think there are a few that come close, so with slight mods could definitely look exactly the same. Might be easier than restoring what you currently have.
__________________
 
10-15-14, 05:13 AM   #16
Falleneu
A Deviate Faerie Dragon
Join Date: Aug 2010
Posts: 12
Ok well it works without errors so its good enough, but how do I disable the blizzard boss "icon" on the nameplte? It shows the dragon portrait around my nameplates.

Last edited by Falleneu : 10-15-14 at 08:59 AM.
 
 

WoWInterface » Site Forums » Archived Beta Forums » WoD Beta archived threads » Small bug in my nameplate addon, the castbar, wtb help of lua genius please.

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