Thread: KGPanels script
View Single Post
11-10-14, 04:02 AM   #29
BabyRay
An Aku'mai Servant
Join Date: Sep 2009
Posts: 39
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.
Lua Code:
  1. Skada


OnLoad -- Register appropriate events and do an initial check OnLoad.

Lua Code:
  1. --table with the Skada frames that should be handled
  2. self.SkadaWindowsToToggle = {
  3.  Recount = true,
  4.  Omen = true,
  5. }
  6.  
  7. function self:ToggleAllSkadaWindows()
  8.  for name,v in pairs(self.SkadaWindowsToToggle) do
  9.  if v then
  10.  local f = _G["SkadaBarWindow"..name]
  11.  if f then
  12.  f[IsInGroup() and "Show" or "Hide"](f)
  13.  end
  14.  end
  15.  end
  16. end
  17.  
  18. --Get LibStub's Skada table
  19. local skada = LibStub("AceAddon-3.0"):GetAddon("Skada")
  20.  
  21. --hook the settings application that is run after a Skada window is created
  22. hooksecurefunc(skada,"ApplySettings", function() self:ToggleAllSkadaWindows() end)
  23.  
  24. --hide any asociated Skada windows that are already created
  25. self:ToggleAllSkadaWindows()
  26.  
  27. --register events
  28. self:RegisterEvent("PLAYER_ENTERING_WORLD")
  29. self:RegisterEvent("GROUP_ROSTER_UPDATE")


OnEvent -- Do checks

Lua Code:
  1. self:ToggleAllSkadaWindows()


OnClick -- Show or hide frames and play sound. Should CTRL be held, reset instead

Lua Code:
  1. if IsAddOnLoaded("Skada") and pressed then
  2.     if IsControlKeyDown() then
  3.         Skada:Reset()
  4.         PlaySoundFile("Sound\\Interface\\iAbilitiesTurnPageA.wav")
  5.     else
  6.         CombatLogClearEntries()
  7.         Skada:ToggleWindow()
  8.         if SkadaBarWindowRecount:IsShown() and SkadaBarWindowOmen:IsShown() then
  9.             PlaySoundFile("Sound\\Interface\\uCharacterSheetOpen.wav")
  10.         else
  11.             PlaySoundFile("Sound\\Interface\\uCharacterSheetClose.wav")
  12.         end
  13.     end
  14. end



Button labeled as 'Chat'
...which is intended to toggle the chat windows.
If i replaced this:

Lua Code:
  1. self:RegisterEvent("ZONE_CHANGED")
  2. self:RegisterEvent("ZONE_CHANGED_NEW_AREA")
  3. self:RegisterEvent("ZONE_CHANGED_INDOORS")

with this one

Lua Code:
  1. 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:
  1. self:RegisterEvent("ZONE_CHANGED")
  2. self:RegisterEvent("ZONE_CHANGED_NEW_AREA")
  3. self:RegisterEvent("ZONE_CHANGED_INDOORS")
  4. self:RegisterEvent("PLAYER_ENTERING_WORLD")
  5. self:RegisterEvent("GROUP_ROSTER_UPDATE")
  6.  
  7. if IsResting() or IsInGroup() then
  8.     _G["ChatFrame1"]:Show()
  9.     _G["ChatFrame3"]:Show()
  10.     _G["ChatFrame1ButtonFrame"]:Show()
  11.     _G["ChatFrame3ButtonFrame"]:Show()
  12.     _G["ChatFrameMenuButton"]:Show()
  13.     _G["GeneralDockManager"]:Show()
  14.     _G["FriendsMicroButton"]:Show()
  15. else
  16.     _G["ChatFrame1"]:Hide()
  17.     _G["ChatFrame3"]:Hide()
  18.     _G["ChatFrame1ButtonFrame"]:Hide()
  19.     _G["ChatFrame3ButtonFrame"]:Hide()
  20.     _G["ChatFrameMenuButton"]:Hide()
  21.     _G["GeneralDockManager"]:Hide()
  22.     _G["FriendsMicroButton"]:Hide()
  23. end

OnEvent

Lua Code:
  1. if IsResting() or IsInGroup() then
  2.     _G["ChatFrame1"]:Show()
  3.     _G["ChatFrame3"]:Show()
  4.     _G["ChatFrame1ButtonFrame"]:Show()
  5.     _G["ChatFrame3ButtonFrame"]:Show()
  6.     _G["ChatFrameMenuButton"]:Show()
  7.     _G["GeneralDockManager"]:Show()
  8.     _G["FriendsMicroButton"]:Show()
  9. else
  10.     _G["ChatFrame1"]:Hide()
  11.     _G["ChatFrame3"]:Hide()
  12.     _G["ChatFrame1ButtonFrame"]:Hide()
  13.     _G["ChatFrame3ButtonFrame"]:Hide()
  14.     _G["ChatFrameMenuButton"]:Hide()
  15.     _G["GeneralDockManager"]:Hide()
  16.     _G["FriendsMicroButton"]:Hide()
  17. 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:
  1. if pressed then
  2.     if _G["ChatFrame1"]:IsShown() then
  3.         _G["ChatFrame1"]:Hide()
  4.         _G["ChatFrame3"]:Hide()
  5.         _G["ChatFrame1ButtonFrame"]:Hide()
  6.         _G["ChatFrame3ButtonFrame"]:Hide()
  7.         _G["ChatFrameMenuButton"]:Hide()
  8.         _G["GeneralDockManager"]:Hide()
  9.         _G["FriendsMicroButton"]:Hide()
  10.         PlaySoundFile("Sound\\Interface\\uCharacterSheetClose.wav")
  11.     else
  12.         _G["ChatFrame1"]:Show()
  13.         _G["ChatFrame3"]:Show()
  14.         _G["ChatFrame1ButtonFrame"]:Show()
  15.         _G["ChatFrame3ButtonFrame"]:Show()
  16.         _G["ChatFrameMenuButton"]:Show()
  17.         _G["GeneralDockManager"]:Show()
  18.         _G["FriendsMicroButton"]:Show()
  19.         PlaySoundFile("Sound\\Interface\\uCharacterSheetOpen.wav")
  20.     end
  21. end



Button labeled as 'Show'
...which is intended to show the chat and Skada windows.
OnClick --

Lua Code:
  1. if IsAddOnLoaded("Skada") and pressed then
  2.     if not SkadaBarWindowOmen:IsShown() or not SkadaBarWindowRecount:IsShown() then
  3.         PlaySoundFile("Sound\\Interface\\uCharacterSheetOpen.wav")
  4.     end
  5.     SkadaBarWindowRecount:Show()
  6.     SkadaBarWindowOmen:Show()
  7. end
  8. if pressed then
  9.     _G["ChatFrame1"]:Show()
  10.     _G["ChatFrame3"]:Show()
  11.     _G["ChatFrame1ButtonFrame"]:Show()
  12.     _G["ChatFrame3ButtonFrame"]:Show()
  13.     _G["ChatFrameMenuButton"]:Show()
  14.     _G["GeneralDockManager"]:Show()
  15.     _G["FriendsMicroButton"]:Show()
  16. end

Button labeled as 'Hide'
...which is intended to hide the chat and Skada windows.
OnClick --
Lua Code:
  1. if IsAddOnLoaded("Skada") and pressed then
  2.     if SkadaBarWindowOmen:IsShown() or SkadaBarWindowRecount:IsShown() then
  3.         PlaySoundFile("Sound\\Interface\\uCharacterSheetClose.wav")
  4.     end
  5.     SkadaBarWindowRecount:Hide()
  6.     SkadaBarWindowOmen:Hide()
  7. end
  8. if pressed then
  9.     _G["ChatFrame1"]:Hide()
  10.     _G["ChatFrame3"]:Hide()
  11.     _G["ChatFrame1ButtonFrame"]:Hide()
  12.     _G["ChatFrame3ButtonFrame"]:Hide()
  13.     _G["ChatFrameMenuButton"]:Hide()
  14.     _G["GeneralDockManager"]:Hide()
  15.     _G["FriendsMicroButton"]:Hide()
  16. end


OnEvent

Lua Code:
  1. local oEvents = {
  2.     "GOSSIP_SHOW",
  3.     "BANKFRAME_OPENED",
  4.     "GUILDBANKFRAME_OPENED"
  5. }
  6.  
  7. if tContains(oEvents,event) then
  8.     ChatFrame1:Hide()
  9.     ChatFrame3:Hide()
  10.     ChatFrame1ButtonFrame:Hide()
  11.     ChatFrame3ButtonFrame:Hide()
  12.     ChatFrameMenuButton:Hide()
  13.     GeneralDockManager:Hide()
  14.     FriendsMicroButton:Hide()
  15. else
  16.     ChatFrame1:Show()
  17.     ChatFrame3:Show()
  18.     ChatFrame1ButtonFrame:Show()
  19.     ChatFrame3ButtonFrame:Show()
  20.     ChatFrameMenuButton:Show()
  21.     GeneralDockManager:Show()
  22.     FriendsMicroButton:Show()
  23. end

Last edited by BabyRay : 11-10-14 at 09:05 AM.
  Reply With Quote