Thanks guys,
even if I only understand a quarter of the what you have written.
Here again summarized as my scripts in KGPanels are registered.
I hope the "OnEvent" script is in the right place.
EDIT:
I made malygos and see that there is a UI like in Ulduar (1 Boss) oder the PetBattle UI.
Is this the right ones for the Event?
VEHICLE_ANGLE_SHOW
PET_BATTLE_OPENING_START
So that the UI is disabled when i´m in a vihicle or in petbattle
Button labeled as 'DPS' ...which is intended to toggle the Skada windows has a few key features implemented.- Automatically show or hide the frames depending on if you're in group or raid.
- Toggle the frames cleanly, with audio feedback.
- Reset skada with a simple holding of CTRL and clicking the button.
Scripts Dependency -- This will disable / remove this button should Skada not be enabled.
OnLoad -- Register appropriate events and do an initial check OnLoad.
Lua Code:
--table with the Skada frames that should be handled
self.SkadaWindowsToToggle = {
Recount = true,
Omen = true,
}
function self:ToggleAllSkadaWindows()
for name,v in pairs(self.SkadaWindowsToToggle) do
if v then
local f = _G["SkadaBarWindow"..name]
if f then
f[IsInGroup() and "Show" or "Hide"](f)
end
end
end
end
--Get LibStub's Skada table
local skada = LibStub("AceAddon-3.0"):GetAddon("Skada")
--hook the settings application that is run after a Skada window is created
hooksecurefunc(skada,"ApplySettings", function() self:ToggleAllSkadaWindows() end)
--hide any asociated Skada windows that are already created
self:ToggleAllSkadaWindows()
--register events
self:RegisterEvent("PLAYER_ENTERING_WORLD")
self:RegisterEvent("GROUP_ROSTER_UPDATE")
OnEvent -- Do checks
Lua Code:
self:ToggleAllSkadaWindows()
OnClick -- Show or hide frames and play sound. Should CTRL be held, reset instead
Lua Code:
if IsAddOnLoaded("Skada") and pressed then
if IsControlKeyDown() then
Skada:Reset()
PlaySoundFile("Sound\\Interface\\iAbilitiesTurnPageA.wav")
else
CombatLogClearEntries()
Skada:ToggleWindow()
if SkadaBarWindowRecount:IsShown() and SkadaBarWindowOmen:IsShown() then
PlaySoundFile("Sound\\Interface\\uCharacterSheetOpen.wav")
else
PlaySoundFile("Sound\\Interface\\uCharacterSheetClose.wav")
end
end
end
Button labeled as 'Chat' ...which is intended to toggle the chat windows.
If i replaced this:
Lua Code:
self:RegisterEvent("ZONE_CHANGED")
self:RegisterEvent("ZONE_CHANGED_NEW_AREA")
self:RegisterEvent("ZONE_CHANGED_INDOORS")
with this one
Lua Code:
self: Register Event ("PLAYER_UPDATE_RESTING")
but should fix my problem with the chat window to sensitive, right?
So that the Chat is only to see when i´m resting?
OnLoad
Lua Code:
self:RegisterEvent("ZONE_CHANGED")
self:RegisterEvent("ZONE_CHANGED_NEW_AREA")
self:RegisterEvent("ZONE_CHANGED_INDOORS")
self:RegisterEvent("PLAYER_ENTERING_WORLD")
self:RegisterEvent("GROUP_ROSTER_UPDATE")
if IsResting() or IsInGroup() then
_G["ChatFrame1"]:Show()
_G["ChatFrame3"]:Show()
_G["ChatFrame1ButtonFrame"]:Show()
_G["ChatFrame3ButtonFrame"]:Show()
_G["ChatFrameMenuButton"]:Show()
_G["GeneralDockManager"]:Show()
_G["FriendsMicroButton"]:Show()
else
_G["ChatFrame1"]:Hide()
_G["ChatFrame3"]:Hide()
_G["ChatFrame1ButtonFrame"]:Hide()
_G["ChatFrame3ButtonFrame"]:Hide()
_G["ChatFrameMenuButton"]:Hide()
_G["GeneralDockManager"]:Hide()
_G["FriendsMicroButton"]:Hide()
end
OnEvent
Lua Code:
if IsResting() or IsInGroup() then
_G["ChatFrame1"]:Show()
_G["ChatFrame3"]:Show()
_G["ChatFrame1ButtonFrame"]:Show()
_G["ChatFrame3ButtonFrame"]:Show()
_G["ChatFrameMenuButton"]:Show()
_G["GeneralDockManager"]:Show()
_G["FriendsMicroButton"]:Show()
else
_G["ChatFrame1"]:Hide()
_G["ChatFrame3"]:Hide()
_G["ChatFrame1ButtonFrame"]:Hide()
_G["ChatFrame3ButtonFrame"]:Hide()
_G["ChatFrameMenuButton"]:Hide()
_G["GeneralDockManager"]:Hide()
_G["FriendsMicroButton"]:Hide()
end
OnClick -- Only specific frames are toggled.
I had to reparent the kgpanels 'Chatframe_links' to the absolute center of ChatFrame1 and 'Chatframe_rechts' to the absolute center of ChatFrame3.
Lua Code:
if pressed then
if _G["ChatFrame1"]:IsShown() then
_G["ChatFrame1"]:Hide()
_G["ChatFrame3"]:Hide()
_G["ChatFrame1ButtonFrame"]:Hide()
_G["ChatFrame3ButtonFrame"]:Hide()
_G["ChatFrameMenuButton"]:Hide()
_G["GeneralDockManager"]:Hide()
_G["FriendsMicroButton"]:Hide()
PlaySoundFile("Sound\\Interface\\uCharacterSheetClose.wav")
else
_G["ChatFrame1"]:Show()
_G["ChatFrame3"]:Show()
_G["ChatFrame1ButtonFrame"]:Show()
_G["ChatFrame3ButtonFrame"]:Show()
_G["ChatFrameMenuButton"]:Show()
_G["GeneralDockManager"]:Show()
_G["FriendsMicroButton"]:Show()
PlaySoundFile("Sound\\Interface\\uCharacterSheetOpen.wav")
end
end
Button labeled as 'Show'...which is intended to show the chat and Skada windows.
OnClick --
Lua Code:
if IsAddOnLoaded("Skada") and pressed then
if not SkadaBarWindowOmen:IsShown() or not SkadaBarWindowRecount:IsShown() then
PlaySoundFile("Sound\\Interface\\uCharacterSheetOpen.wav")
end
SkadaBarWindowRecount:Show()
SkadaBarWindowOmen:Show()
end
if pressed then
_G["ChatFrame1"]:Show()
_G["ChatFrame3"]:Show()
_G["ChatFrame1ButtonFrame"]:Show()
_G["ChatFrame3ButtonFrame"]:Show()
_G["ChatFrameMenuButton"]:Show()
_G["GeneralDockManager"]:Show()
_G["FriendsMicroButton"]:Show()
end
Button labeled as 'Hide'...which is intended to hide the chat and Skada windows.
OnClick --
Lua Code:
if IsAddOnLoaded("Skada") and pressed then
if SkadaBarWindowOmen:IsShown() or SkadaBarWindowRecount:IsShown() then
PlaySoundFile("Sound\\Interface\\uCharacterSheetClose.wav")
end
SkadaBarWindowRecount:Hide()
SkadaBarWindowOmen:Hide()
end
if pressed then
_G["ChatFrame1"]:Hide()
_G["ChatFrame3"]:Hide()
_G["ChatFrame1ButtonFrame"]:Hide()
_G["ChatFrame3ButtonFrame"]:Hide()
_G["ChatFrameMenuButton"]:Hide()
_G["GeneralDockManager"]:Hide()
_G["FriendsMicroButton"]:Hide()
end
OnEvent
Lua Code:
local oEvents = {
"GOSSIP_SHOW",
"BANKFRAME_OPENED",
"GUILDBANKFRAME_OPENED"
}
if tContains(oEvents,event) then
ChatFrame1:Hide()
ChatFrame3:Hide()
ChatFrame1ButtonFrame:Hide()
ChatFrame3ButtonFrame:Hide()
ChatFrameMenuButton:Hide()
GeneralDockManager:Hide()
FriendsMicroButton:Hide()
else
ChatFrame1:Show()
ChatFrame3:Show()
ChatFrame1ButtonFrame:Show()
ChatFrame3ButtonFrame:Show()
ChatFrameMenuButton:Show()
GeneralDockManager:Show()
FriendsMicroButton:Show()
end