WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   AddOn Help/Support (https://www.wowinterface.com/forums/forumdisplay.php?f=3)
-   -   Hiding SexyCooldown when out of combat... (https://www.wowinterface.com/forums/showthread.php?t=45890)

Aryae21 02-25-13 11:41 AM

Hiding SexyCooldown when out of combat...
 
1 Attachment(s)
Title pretty much sums it up...
I know this option is not included in the add-on and dont see any hint of future implementation, there is a option where I can set its Inactive opacity, but it doesn't quite work as well as a OOC option. I basically want a set of action bars (Only 1 bar) from Bartender4 to show, in combat the bars are set to disappear. On these bars ill use for various things not typically used in combat situations. Once they disappear in the same exact position will be the cool down bar in its place. While the Inactivity opacity works, somewhat... if I have any sort of cool down it will show on the bar regardless of being out of combat and both my action bar and the cooldown bar will overlap each other, making it a bit of an eyesore. I attached a picture to show what I mean. Is there anyway I can make Sexycooldown disappear OOC? Either by some small code snip in the add on (Which I'd need instructions for my LUA skills are beginner at best.) or maybe even another similar add on without the bulk ForteXorcist/Raven provide but still the same customization for the bar (Which Coolline doesn't provide for me.) Or maybe even some method via another add on to disable showing the frame while the action bar is present, achieving the same effect in a round about way. Only add ons I think that could do this would be KGPanels or Bartender itself, both of which I have.

Phanx 02-25-13 09:56 PM

This should work for SexyCooldown, and any other frames you want to hide or show only in or out of combat. Type "/fstack" and move the cursor over the SexyCooldown bar to check its name; if it's not "SexyCooldown", change the code below accordingly. Type "/fstack" again to hide the frame stack tooltip.

Code:

-- Add frames to hide in this table:
local FramesToHide = {
        ["SexyCooldown"] = "PLAYER_REGEN_ENABLED", -- Show out of combat
        ["SomeOtherFrame"] = "PLAYER_REGEN_DISABLED", -- Show in combat
}

local CombatHider = CreateFrame("Frame")
CombatHider:RegisterEvent("PLAYER_REGEN_DISABLED")
CombatHider:RegisterEvent("PLAYER_REGEN_ENABLED")
CombatHider:SetScript("OnEvent", function(self, event)
        for frameName, showEvent in pairs(FramesToHide) do
                local frame = _G[frameName]
                if frame then
                        frame:SetShown(event == showEvent)
                end
        end
end)

If you need help turning the above code into an addon, paste it onto this page, enter a title, and click the green button: http://addon.ziuo.net/

Aryae21 02-26-13 06:27 AM

Following the above instructions, I can't seem to get this to work. I made it into an add on, and it loads perfectly well using the site provided. Changed the name "SexyCooldown" to "SexyCooldown2Bar 1" As /fstack showed, and even tried tinkering with the code (Such as trying multiple frame names ect.) To try and get it to work, but nothing. The frame still shows out of combat. Not sure if I am doing something wrong or if the code itself is missing something specific to this add on.

Aryae21 02-26-13 06:48 AM

To be more specific I posted the code I edited according to your instructions, I simply copy and pasted the entire LUA file after using that website provided. On an additional note just to be as thorough as possible, I did check to see if the add-on created was actually loaded in wow multiple times. It is on, however the memory usage is 0. Not sure if that means anything, Id think it would use something no matter how small but that's just what i thought, doesn't necessarily mean anything.

Code:

-- This file is loaded from "SexyCooldownHideOOC.toc"

-- Add frames to hide in this table:
local FramesToHide = {
        ["SexyCooldown2Bar 1"] = "PLAYER_REGEN_ENABLED", -- Show out of combat
        ["SomeOtherFrame"] = "PLAYER_REGEN_DISABLED", -- Show in combat
}

local CombatHider = CreateFrame("Frame")
CombatHider:RegisterEvent("PLAYER_REGEN_DISABLED")
CombatHider:RegisterEvent("PLAYER_REGEN_ENABLED")
CombatHider:SetScript("OnEvent", function(self, event)
        for frameName, showEvent in pairs(FramesToHide)
                local frame = _G[frameName]
                if frame then
                        frame:SetShown(event == showEvent)
                end
        end
end)


Dridzt 02-26-13 10:45 AM

There's a chance SexyCooldown updates its visibility continuously in an OnUpdate or animation script.

ravagernl 02-26-13 11:37 AM

If you are still having trouble you can also try and install Aura Frames. If you make a container in it of the type "timeline", you can use it to display the buffs, cooldowns or anything you want; with your own visibility, filter and sorting options.

Phanx 02-26-13 04:47 PM

Well, there is a typo in that code that I just noticed. I edited my previous post to fix it.

However, it looks like SexyCooldown re-shows its frames every time a cooldown starts, so that code won't work anyway. Rather than hiding and showing individual frames, it will probably work better to re-parent them all to the CombatHider frame and just hide and show that, so the hidden/shown state of the inidividual frames doesn't matter:

Code:

-- Add frames to hide in this table:
local FramesToHide = {
        "SexyCooldown2Bar1",
}

local CombatHider = CreateFrame("Frame", "MyCombatHider", UIParent, "SecureHandlerStateTemplate")
CombatHider:SetAllPoints(true)
RegisterStateDriver(CombatHider, "visibility", "[nocombat] hide; show")

CombatHider:RegisterEvent("PLAYER_ENTERING_WORLD")
CombatHider:SetScript("OnEvent", function(self, event)
        for i = #FramesToHide, 1, -1 do
                local frame = _G[FramesToHide[i]]
                if frame then
                        frame:SetParent(self)
                        tremove(FramesToHide, i)
                end
        end
end)

I chose the PLAYER_ENTERING_WORLD event because it happens *after* PLAYER_LOGIN so hopefully SexyCooldown has finished setting up its frames by then.


All times are GMT -6. The time now is 07:01 AM.

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