Hiding elements based on player state
I'm currently working on some additions/changes to the oUF_Neav layout and I've run into a snag. I'm trying to hide the Level text when I am resting or in combat, and display those icons instead. I'm able to get the icons to display correctly, however I'm having issues with hiding the Level text. This is the code I'm currently running:
Code:
-- level Code:
if self.Resting then Code:
if (not self.Resting or self.Combat) then Edit: Actually, after beating on a target dummy my request has become slightly more complicated. I'd like to prioritize Resting icon > Combat icon > Level text. I still haven't found a way to do this though. |
I think thats rather easy. Create yourself a assistant frame and anchor 4 Events on that frame. (Resting started, Resting ended, Combat started, Combat ended and Player Entering World)
http://www.wowwiki.com/Events/P PLAYER_UPDATE_RESTING PLAYER_REGEN_ENABLED PLAYER_REGEN_DISABLED PLAYER_ENTERING_WORLD This is how you could implement. Create the assistant frame, register Events to that frame and call a function upcon event. Use conditions to do specific thing upon specific events. Code:
|
So I added your code into my layout like this:
Code:
-- Hello world function I found http://www.wowwiki.com/API_IsResting which looks closer to what I am looking for but I'm not sure how to use it since it isn't an event. Any other ideas? :D Edit: Updated description of what the code actually does. Edit2: An idea I had, though I'm too much of a coding noob to be sure if it would work. Could I make my own event to fire resting = true or resting = false using the IsResting() API? |
All times are GMT -6. The time now is 01:05 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI