WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   WoD Beta archived threads (https://www.wowinterface.com/forums/forumdisplay.php?f=151)
-   -   Small bug in my nameplate addon, the castbar, wtb help of lua genius please. (https://www.wowinterface.com/forums/showthread.php?t=50027)

Falleneu 10-11-14 11:53 AM

Small bug in my nameplate addon, the castbar, wtb help of lua genius please.
 
1 Attachment(s)
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

Phanx 10-12-14 12:57 AM

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.

Tonyleila 10-12-14 04:27 AM

KuiNameplates

Phanx 10-12-14 05:56 AM

Yeah, that's what I use as well, but there are others to choose from if you prefer another style. :p

Falleneu 10-12-14 06:22 AM

Quote:

Originally Posted by Phanx (Post 297630)
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

semlar 10-12-14 06:42 AM

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.

Falleneu 10-12-14 06:57 AM

Quote:

Originally Posted by semlar (Post 297636)
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.

Choonstertwo 10-12-14 07:18 AM

Quote:

Originally Posted by Falleneu (Post 297637)
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.

Rainrider 10-12-14 09:19 AM

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

Falleneu 10-12-14 10:41 AM

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.

MoonWitch 10-12-14 02:23 PM

DO you happen to have a screenshot of it in action?

Falleneu 10-13-14 04:12 AM

Quote:

Originally Posted by MoonWitch (Post 297655)
DO you happen to have a screenshot of it in action?

The addon or the bug i referred to in the original post?

MoonWitch 10-13-14 05:04 AM

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 :)

Falleneu 10-13-14 06:49 AM

Quote:

Originally Posted by MoonWitch (Post 297676)
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.

MoonWitch 10-13-14 11:22 AM

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.

Falleneu 10-15-14 05:13 AM

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.


All times are GMT -6. The time now is 06:30 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI