Thread Tools Display Modes
04/26/14, 04:55 AM   #1
myslex
Join Date: Apr 2014
Posts: 22
Removing 'gloss' from attribute bars?

Helu esoui,

Ever since I discovered theres an alternative way to display the attribute bars by adding these lines:

ZO_PlayerAttributeHealthBarLeftGloss:SetHidden(true)
ZO_PlayerAttributeHealthBarRightGloss:SetHidden(true)
.. I've been inlove, and I cannot imagine going back to using the original 'glossy' version.. However there's a slight issue with this..

It would seem that some function is re-enabling the 'glossyness' when player gain a buff or loses/gain health.. It is then automatically reversed after the 'translation effect'..

Is there a way to completely disable the gloss, and preventing the default functions from 're-enabling' the gloss?

EDIT: also TL;DR
Gloss also has a 'alpha value'. Is it possible to set a 'max alpha value' to say 0 for gloss, like in this example:

ZO_PlayerAttributeHealth.playerAttributeBarObject.timeline:GetAnimation():SetStartAlpha(1.0)
Any help is grately appreciated, thank you in advance!
MYSLxxx

Last edited by myslex : 04/26/14 at 05:10 AM.
  Reply With Quote
04/26/14, 06:15 AM   #2
Fathis Ules
Thief Guild Master
 
Fathis Ules's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 42
what about hooking it directly

Lua Code:
  1. local function newSetHidden(...)
  2.     --origZO_PlayerAttributeHealthBarLeftGloss(...)
  3. end
  4. local origZO_PlayerAttributeHealthBarLeftGloss.SetHidden = ZO_PlayerAttributeHealthBarLeftGloss.SetHidden
  5. local origZO_PlayerAttributeHealthBarRightGloss.SetHidden = ZO_PlayerAttributeHealthBarLeftGloss.SetHidden
  6. ZO_PlayerAttributeHealthBarLeftGloss.SetHidden = newSetHidden
  7. ZO_PlayerAttributeHealthBarRightGloss.SetHidden = newSetHidden

that's a sample of course but that's how you can change the SetHidden behaviour after you changed it once

Last edited by Fathis Ules : 04/26/14 at 06:17 AM.
  Reply With Quote
04/26/14, 06:52 AM   #3
myslex
Join Date: Apr 2014
Posts: 22
Originally Posted by Fathis Ules View Post
what about hooking it directly

Lua Code:
  1. local function newSetHidden(...)
  2.     --origZO_PlayerAttributeHealthBarLeftGloss(...)
  3. end
  4. local origZO_PlayerAttributeHealthBarLeftGloss.SetHidden = ZO_PlayerAttributeHealthBarLeftGloss.SetHidden
  5. local origZO_PlayerAttributeHealthBarRightGloss.SetHidden = ZO_PlayerAttributeHealthBarLeftGloss.SetHidden
  6. ZO_PlayerAttributeHealthBarLeftGloss.SetHidden = newSetHidden
  7. ZO_PlayerAttributeHealthBarRightGloss.SetHidden = newSetHidden

that's a sample of course but that's how you can change the SetHidden behaviour after you changed it once
I must start this post with saying that I am a mediocre c# programmer, and have never worked with lua before.. and while I :REALLY: appreciate you taking the time to reply in this thread, I have no idea what to make of this proposition you made regarding hooking it directly..

Would it be to much to ask for a 'working' example, since I am too stupid to understand what you're trying to teach me?

/hugs
MYSleX
  Reply With Quote
04/26/14, 08:18 AM   #4
Fathis Ules
Thief Guild Master
 
Fathis Ules's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 42
If :SetHidden(true) is your solution but something calls again :SetHidden(false) to revert your solution then you need to replace SetHidden by your function to filter out the calls made to SetHidden with false

In the sample I show you how to replace the SetHidden function by yours so you can decide then to pass the original execution to origZO_PlayerAttributeHealthBarLeftGloss to have the result of a normal SetHidden, or to not continue the execution , that's how you can forbid any call made to SetHidden

It is not specific to Lua, it is just called function hooking and is present in all the programming language, the only requirement is overwrite the pointer of the original function by your and to store a pointer of the original function in a local variable before you replace it so you can call later the original function from your.

Lua Code:
  1. local originalSetHiddenLeft = ZO_PlayerAttributeHealthBarLeftGloss.SetHidden
  2. local originalSetHiddenRight = ZO_PlayerAttributeHealthBarRightGloss.SetHidden
  3.  
  4. local function newSetHiddenLeft(self, hidden, ...)
  5.     if hidden == false then
  6.         --do nothing, meaning, SetHidden is disabled
  7.         return
  8.     end
  9.     originalSetHiddenLeft(self, hidden, ...) -- Calls the normal ZO_PlayerAttributeHealthBarLeftGloss.SetHidden
  10. end
  11.  
  12. local function newSetHiddenRight(self, hidden, ...)
  13.     if hidden == false then
  14.         --do nothing, meaning, SetHidden is disabled
  15.         return
  16.     end
  17.     originalSetHiddenRight (self, hidden, ...) -- Calls the normal ZO_PlayerAttributeHealthBarRightGloss.SetHidden
  18. end
  19.  
  20. ZO_PlayerAttributeHealthBarLeftGloss.SetHidden = newSetHiddenLeft
  21. ZO_PlayerAttributeHealthBarRightGloss.SetHidden = newSetHiddenRight

Last edited by Fathis Ules : 04/26/14 at 08:30 AM.
  Reply With Quote
04/26/14, 08:29 AM   #5
myslex
Join Date: Apr 2014
Posts: 22
Originally Posted by Fathis Ules View Post
If :SetHidden(true) is your solution but something calls again :SetHidden(false) to revert your solution then you need to replace SetHidden by your function to filter out the calls made to SetHidden with false

In the sample I show you how to replace the SetHidden function by yours so you can decide then to pass the original execution to origZO_PlayerAttributeHealthBarLeftGloss to have the result of a normal SetHidden, or to not continue the execution , that's how you can forbid any call made to SetHidden

It is not specific to Lua, it is just called function hooking and is present in all the programming language, the only requirement is overwrite the pointer of the original function by your and to store a pointer of the original function in a local variable before you replace it so you can call later the original function from your.

Lua Code:
  1. local function newSetHiddenLeft(self, hidden, ...)
  2.     if hidden == false then
  3.         --do nothing, meaning, SetHidden is disabled
  4.         return
  5.     end
  6.     originalSetHiddenLeft(self, hidden, ...) -- Calls the normal ZO_PlayerAttributeHealthBarLeftGloss.SetHidden
  7. end
  8.  
  9. local function newSetHiddenRight(self, hidden, ...)
  10.     if hidden == false then
  11.         --do nothing, meaning, SetHidden is disabled
  12.         return
  13.     end
  14.     originalSetHiddenRight (self, hidden, ...) -- Calls the normal ZO_PlayerAttributeHealthBarRightGloss.SetHidden
  15. end
  16.  
  17. local originalSetHiddenLeft = ZO_PlayerAttributeHealthBarLeftGloss.SetHidden
  18. local originalSetHiddenRight = ZO_PlayerAttributeHealthBarRightGloss.SetHidden
  19.  
  20. ZO_PlayerAttributeHealthBarLeftGloss.SetHidden = newSetHiddenLeft
  21. ZO_PlayerAttributeHealthBarRightGloss.SetHidden = newSetHiddenRight
This is very impressive, A new way (for me) to tackle the problem. Its kind of like overriding a function, isnt it?

However.. Hiding the 'glossy frame' and then disabling the sethidden function, still results in the 'glossyness' being shown when first aggroing an enemy thinking theres something glossy somewhere else.. Damn it!!

I appreciate you helping me out, really! thank you!
MysLEx
  Reply With Quote
04/26/14, 08:33 AM   #6
myslex
Join Date: Apr 2014
Posts: 22
Originally Posted by myslex View Post
This is very impressive, A new way (for me) to tackle the problem. Its kind of like overriding a function, isnt it?

However.. Hiding the 'glossy frame' and then disabling the sethidden function, still results in the 'glossyness' being shown when first aggroing an enemy thinking theres something glossy somewhere else.. Damn it!!

I appreciate you helping me out, really! thank you!
MysLEx
It seems that the game's default behaviour to fade in the attribute bar on combat begin is messing with the alpha of the 'glossy frame' .. requires further investigation.. Any help is always appreciated. Again.. thanks =)

MsysELx
  Reply With Quote
04/26/14, 08:43 AM   #7
Fathis Ules
Thief Guild Master
 
Fathis Ules's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 42
did you tried the same with SetAlpha, SetAlpha(0) can sets an object invisible and SetAlpha(1) visible



and yeah btw it is just function oiverwriting, hooking is the commong term, that's a very powerfull way to change the way the default client is working, I use this in my anti spam addon to hook message comming before they reach the chatwindow and also to inject special command when you right click player names

Last edited by Fathis Ules : 04/26/14 at 08:46 AM.
  Reply With Quote
04/26/14, 08:47 AM   #8
myslex
Join Date: Apr 2014
Posts: 22
Originally Posted by Fathis Ules View Post
did you tried the same with SetAlpha, SetAlpha(0) can sets an object invisible and SetAlpha(1) visible



and yeah btw it is just function oiverwriting, hooking is the commong term, that's a very powerfull way to change the way the default client is working, I use this in my anti spam addon to hook message comming before they reach the chatwindow and also to inject special command when you right click player names
That is... excuse the choice of words... ****ing awesome!! I'll try it! thanks man! you're awesome!
  Reply With Quote
04/26/14, 09:12 AM   #9
myslex
Join Date: Apr 2014
Posts: 22
Originally Posted by myslex View Post
That is... excuse the choice of words... ****ing awesome!! I'll try it! thanks man! you're awesome!
I tried it but i think im doing something wrong..

This is declared at the most top of the lua file:

local originalSetAlphaLeft = ZO_PlayerAttributeHealthBarLeftGloss.SetAlpha
local originalSetAlphaRight = ZO_PlayerAttributeHealthBarRightGloss.SetAlpha
These are my two functions declared outside the 'OnAddonLoaded' event:

function newSetAlphaLeft(self, alpha, ...)
if alpha > 0 then
--do nothing, meaning, SetHidden is disabled
return
end
originalSetAlphaLeft(self, alpha, ...) -- Calls the normal ZO_PlayerAttributeHealthBarLeftGloss.SetAlpha
end

function newSetAlphaRight(self, alpha, ...)
if alpha > 0 then
--do nothing, meaning, SetHidden is disabled
return
end
originalSetAlphaRight (self, alpha, ...) -- Calls the normal ZO_PlayerAttributeHealthBarRightGloss.SetAlpha
end
And this is declared 'OnAddonLoaded', aka 'initialized function':

ZO_PlayerAttributeHealthBarLeftGloss.SetAlpha = newSetAlphaLeft
ZO_PlayerAttributeHealthBarRightGloss.SetAlpha = newSetAlphaRight
Please tell me if im doing something wrong, or if this should infact work. I am able to write this after the changes:

ZO_PlayerAttributeHealthBarRightGloss:SetAlpha(1)
Shouldnt work should it?

MSSYLex
  Reply With Quote
04/26/14, 09:30 AM   #10
myslex
Join Date: Apr 2014
Posts: 22
Originally Posted by myslex View Post
alot of text in previous post
OK so I got it to block both SetHidden and SetAlpha with method overriding (or hooking) like you suggested and the values are not changable from addon nor ingame /script .. However.. Upon entering combat the gloss is still showing and then disappearing shortly after. very weird..

investigation continues...
  Reply With Quote
04/26/14, 09:32 AM   #11
Biki
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 34
Lua Code:
  1. ZO_PlayerAttributeHealthBarLeftGloss:SetHandler("OnUpdate", function()
  2.     ZO_PlayerAttributeHealthBarLeftGloss:SetHidden(true)
  3.   end)
  4.   ZO_PlayerAttributeHealthBarRightGloss:SetHandler("OnUpdate", function()
  5.     ZO_PlayerAttributeHealthBarRightGloss:SetHidden(true)
  6.   end)

Will work too, quick and dirty. Just tested it. But there might be more performant options available.
  Reply With Quote
04/26/14, 09:55 AM   #12
myslex
Join Date: Apr 2014
Posts: 22
Originally Posted by Biki View Post
Lua Code:
  1. ZO_PlayerAttributeHealthBarLeftGloss:SetHandler("OnUpdate", function()
  2.     ZO_PlayerAttributeHealthBarLeftGloss:SetHidden(true)
  3.   end)
  4.   ZO_PlayerAttributeHealthBarRightGloss:SetHandler("OnUpdate", function()
  5.     ZO_PlayerAttributeHealthBarRightGloss:SetHidden(true)
  6.   end)

Will work too, quick and dirty. Just tested it. But there might be more performant options available.
Oh this is progress!

Allthough im ashamed to admit, i am allergic to 'onupdate' functions that run continuesly. As you said, im a performance junkie.. All addons Im using / have written are triggered on events..

Small update to my problem..
It would seem my problem is directly related to the
ZO_PlayerAttributeHealth.playerAttributeBarObject.timeline:GetAnimation() ..
the animation is running when engaging in combat, aswell as when using an 'power up' ability such as increase armor buff..

If only there was a way to remove an existing animation................

MSLex
  Reply With Quote
04/26/14, 10:13 AM   #13
Fathis Ules
Thief Guild Master
 
Fathis Ules's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 42
your hook probably not registered , try to debug with adding d("text") inside the functions
  Reply With Quote
04/26/14, 10:13 AM   #14
Biki
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 34
Ok so I've tested a little more, seeing I also like the non-glossy version

Lua Code:
  1. ZO_PlayerAttributeHealthBarLeftGloss:SetHidden(true)
  2.   ZO_PlayerAttributeHealthBarLeftGloss:SetDimensions(0, 0)
  3.   ZO_PlayerAttributeHealthBarLeftGloss:SetDimensionConstraints(0, 0, 0, 0)
  4.   ZO_PlayerAttributeHealthBarRightGloss:SetHidden(true)
  5.   ZO_PlayerAttributeHealthBarRightGloss:SetDimensions(0, 0)
  6.   ZO_PlayerAttributeHealthBarRightGloss:SetDimensionConstraints(0, 0, 0, 0)

Seems to work and only gets called once. It avoids the re-showing problem by just setting the dimensions of the glow to 0 width and 0 height.
  Reply With Quote
04/26/14, 10:24 AM   #15
myslex
Join Date: Apr 2014
Posts: 22
Originally Posted by Fathis Ules View Post
your hook probably not registered , try to debug with adding d("text") inside the functions
You were right, I did as you instructed and and its working again. Thank you!

Originally Posted by Biki View Post
Ok so I've tested a little more, seeing I also like the non-glossy version

Lua Code:
  1. ZO_PlayerAttributeHealthBarLeftGloss:SetHidden(true)
  2.   ZO_PlayerAttributeHealthBarLeftGloss:SetDimensions(0, 0)
  3.   ZO_PlayerAttributeHealthBarLeftGloss:SetDimensionConstraints(0, 0, 0, 0)
  4.   ZO_PlayerAttributeHealthBarRightGloss:SetHidden(true)
  5.   ZO_PlayerAttributeHealthBarRightGloss:SetDimensions(0, 0)
  6.   ZO_PlayerAttributeHealthBarRightGloss:SetDimensionConstraints(0, 0, 0, 0)

Seems to work and only gets called once. It avoids the re-showing problem by just setting the dimensions of the glow to 0 width and 0 height.
THIS!!!!!!! exactly what I wanted. Minimal testing is pointing towards success, I will do more extensive testing and post back here..

Thank you all so much for helping me. Been annoyed the whole day! LOL!
  Reply With Quote

ESOUI » AddOns » AddOn Help/Support » Removing 'gloss' from attribute bars?

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