Thread: KGPanels script
View Single Post
09-21-12, 04:16 AM   #15
suicidalkatt
A Rage Talon Dragon Guard
 
suicidalkatt's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 331
Well since no one could assist!!

Button labeled as 'Chat'
...which is intended to toggle the chat windows, and now to hide while resting.
OnLoad -- Set proper Events and do initial check.
Lua Code:
  1. self:RegisterEvent("ZONE_CHANGED")
  2. self:RegisterEvent("ZONE_CHANGED_NEW_AREA")
  3. self:RegisterEvent("ZONE_CHANGED_INDOORS")
  4.  
  5. if IsResting() then
  6.     _G["ChatFrame1"]:Hide()
  7.     _G["ChatFrame3"]:Hide()
  8.     _G["ChatFrame1ButtonFrame"]:Hide()
  9.     _G["ChatFrame3ButtonFrame"]:Hide()
  10.     _G["ChatFrameMenuButton"]:Hide()
  11.     _G["GeneralDockManager"]:Hide()
  12.     _G["FriendsMicroButton"]:Hide()
  13. else
  14.     _G["ChatFrame1"]:Show()
  15.     _G["ChatFrame3"]:Show()
  16.     _G["ChatFrame1ButtonFrame"]:Show()
  17.     _G["ChatFrame3ButtonFrame"]:Show()
  18.     _G["ChatFrameMenuButton"]:Show()
  19.     _G["GeneralDockManager"]:Show()
  20.     _G["FriendsMicroButton"]:Show()
  21. end

OnEvent -- Do Checks
Lua Code:
  1. if IsResting() then
  2.     _G["ChatFrame1"]:Hide()
  3.     _G["ChatFrame3"]:Hide()
  4.     _G["ChatFrame1ButtonFrame"]:Hide()
  5.     _G["ChatFrame3ButtonFrame"]:Hide()
  6.     _G["ChatFrameMenuButton"]:Hide()
  7.     _G["GeneralDockManager"]:Hide()
  8.     _G["FriendsMicroButton"]:Hide()
  9. else
  10.     _G["ChatFrame1"]:Show()
  11.     _G["ChatFrame3"]:Show()
  12.     _G["ChatFrame1ButtonFrame"]:Show()
  13.     _G["ChatFrame3ButtonFrame"]:Show()
  14.     _G["ChatFrameMenuButton"]:Show()
  15.     _G["GeneralDockManager"]:Show()
  16.     _G["FriendsMicroButton"]:Show()
  17. end

OnClick --
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

Last edited by suicidalkatt : 09-21-12 at 04:18 AM.
  Reply With Quote