Thread: KGPanels script
View Single Post
09-18-12, 02:28 AM   #5
suicidalkatt
A Rage Talon Dragon Guard
 
suicidalkatt's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 331
Final product

* Double Post *

So, few things I want to point out about the layout:
  1. Most objects are not parented to any frames, which may or may not hide specific elements you're looking to do. (I'll go into more detail)
  2. Also, I wasn't sure if you wanted to simply not load the DPS/HPS button should you not have Skada loaded.
  3. Chatframes were limited to hiding only ChatFrame1 and ChatFrame3 and no other additional chat frames will be toggled. I also did not include the edit box (the box which comes up when you want to type.

Import text attached!


There are 4 buttons involved and I'll be discussing each:


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. self:RegisterEvent("PLAYER_ENTERING_WORLD")
  2. self:RegisterEvent("GROUP_ROSTER_UPDATE")
  3.  
  4. if IsInRaid() or IsInGroup() then
  5.     SkadaBarWindowRecount:Show()
  6.     SkadaBarWindowOmen:Show()
  7. else
  8.     SkadaBarWindowRecount:Hide()
  9.     SkadaBarWindowOmen:Hide()
  10. end
OnEvent -- Do checks
Lua Code:
  1. if IsInRaid() or IsInGroup() then
  2.     SkadaBarWindowRecount:Show()
  3.     SkadaBarWindowOmen:Show()
  4. else
  5.     SkadaBarWindowRecount:Hide()
  6.     SkadaBarWindowOmen:Hide()
  7. end
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.
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

If you have any questions about my script please feel free to post!
Attached Files
File Type: txt BabyUI kgPanels Import.txt (16.4 KB, 523 views)

Last edited by suicidalkatt : 09-18-12 at 02:34 AM.
  Reply With Quote