Originally Posted by Aprikot
... For giggles I used the whole thing in my hooksecurefunc() to no avail...I'm not seeing the SetStatusBarColor() values being applied. I appreciate any thoughts.
|
Here's a clip of MainMenuBar.xml...
xml Code:
<Button name="ExhaustionTick" parent="MainMenuExpBar" hidden="false" frameStrata="DIALOG">
<Size>
<AbsDimension x="32" y="32"/>
</Size>
<Anchors>
<Anchor point="CENTER" relativeTo="MainMenuExpBar">
<Offset>
<AbsDimension x="0" y="0"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad function="ExhaustionTick_OnLoad"/>
<OnEvent function="ExhaustionTick_OnEvent"/>
<OnEnter function="ExhaustionToolTipText"/>
<OnLeave function="GameTooltip_Hide"/>
</Scripts>
<NormalTexture name="ExhaustionTickNormal" file="Interface\MainMenuBar\UI-ExhaustionTickNormal"/>
<HighlightTexture name="ExhaustionTickHighlight" file="Interface\MainMenuBar\UI-ExhaustionTickHighlight" alphaMode="ADD"/>
</Button>
Notice the way the script functions are registered. This grabs the function immediately and sets it to the associated script.
hooksecurefunc() will not work on this. You'll have to hook the frame's script handler directly with something like this.
lua Code:
ExhaustionTick:HookScript("OnEvent",function(self,event,...)
MainMenuExpBar:SetStatusBarColor(1,1,1,1);
end);
Originally Posted by Aprikot
I'm trying to do the same thing with the rep bar (recolor it), and having an issue where the bar will not recolor on load (but will recolor on exp gain):
...
Any idea why this doesn't work with PLAYER_ENTERING_WORLD? It works for the exp bar (code in post above this).
|
Your code is conflicting with Blizzards and the event API will randomly choose which it'll fire the event first for. This one seems to actually be called instead of set as a script handler, so
hooksecurefunc() will work on this one.
lua Code:
hooksecurefunc("ReputationWatchBar_Update",function()
ReputationWatchStatusBar:SetStatusBarColor(1,1,1,1);
end);