Thread Tools Display Modes
11-09-14, 03:17 PM   #21
suicidalkatt
A Rage Talon Dragon Guard
 
suicidalkatt's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 331
Originally Posted by BabyRay View Post
You have helped me so far so good but once or twice I have to ask you again for help.

1. Is there a possibility that hides the chat window and skada window when I am standing at a dealer or in the bank?

2. Is there a possibility that respond to the chat window is not quite as sensitive?
I run through Nagrand and during running about changes zone name and my chat window disappears while I just wanted to write something. Maybe it is only on for an entire zone change. Nagrand -> Talador not within the individual areas?

self: Register Event ("ZONE_CHANGED")
self: Register Event ("ZONE_CHANGED_NEW_AREA")
self: Register Event ("ZONE_CHANGED_INDOORS")
self: Register Event ("PLAYER_ENTERING_WORLD")
self: Register Event ("GROUP_ROSTER_UPDATE")


Maybe about the event of Phanx?

self: Register Event ("PLAYER_UPDATE_RESTING")

So just replace the top events through the bottom?
There are a few things you could be registering for:
GOSSIP_SHOW
GOSSIP_CLOSED

BANKFRAME_OPENED
BANKFRAME_CLOSED

GUILDBANKFRAME_OPENED
GUILDBANKFRAME_CLOSED

More info here:
http://wowprogramming.com/docs/events
  Reply With Quote
11-09-14, 04:57 PM   #22
BabyRay
An Aku'mai Servant
Join Date: Sep 2009
Posts: 39
Is this the only thing that i have to put in the OnEvent?

OnEvent:


if GOSSIP_SHOW() or BANKFRAME_OPENED() then then
_G["ChatFrame1"]:Hide()
_G["ChatFrame3"]:Hide()
_G["ChatFrame1ButtonFrame"]:Hide()
_G["ChatFrame3ButtonFrame"]:Hide()
_G["ChatFrameMenuButton"]:Hide()
_G["GeneralDockManager"]:Hide()
_G["FriendsMicroButton"]:Hide()
else
_G["ChatFrame1"]:Show()
_G["ChatFrame3"]:Show()
_G["ChatFrame1ButtonFrame"]:Show()
_G["ChatFrame3ButtonFrame"]:Show()
_G["ChatFrameMenuButton"]:Show()
_G["GeneralDockManager"]:Show()
_G["FriendsMicroButton"]:Show()
end
  Reply With Quote
11-09-14, 06:08 PM   #23
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Lose the _G table lookups. Just use the frame name directly.

Ex:
ChatFrame1:Hide()
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
11-10-14, 12:01 AM   #24
Choonstertwo
A Chromatic Dragonspawn
 
Choonstertwo's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2011
Posts: 194
In addition to what Seerah said, you don't check which event fired by calling their names (e.g. GOSSIP_SHOW()), they're not functions.

kgPanels provides the OnEvent handler with an event argument whose value is the name of the event that fired.

So the code would look like this:
lua Code:
  1. if event == "GOSSIP_SHOW" or event == "BANKFRAME_OPENED" then
  2.     ChatFrame1:Hide()
  3.     ChatFrame3:Hide()
  4.     ChatFrame1ButtonFrame:Hide()
  5.     ChatFrame3ButtonFrame:Hide()
  6.     ChatFrameMenuButton:Hide()
  7.     GeneralDockManager:Hide()
  8.     FriendsMicroButton:Hide()
  9. else
  10.     ChatFrame1:Show()
  11.     ChatFrame3:Show()
  12.     ChatFrame1ButtonFrame:Show()
  13.     ChatFrame3ButtonFrame:Show()
  14.     ChatFrameMenuButton:Show()
  15.     GeneralDockManager:Show()
  16.     FriendsMicroButton:Show()
  17. end

Keep in mind that you need to register these events in the OnLoad script if you want them to fire for your panel.
  Reply With Quote
11-10-14, 12:01 AM   #25
suicidalkatt
A Rage Talon Dragon Guard
 
suicidalkatt's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 331
You want to check that the event passed is equal to the name of the event:

Lua Code:
  1. local oEvents = { -- These are events that we can check for
  2.     "GOSSIP_SHOW",
  3.     "BANKFRAME_OPENED",
  4.     "GUILDBANKFRAME_OPENED"
  5. }
  6.  
  7. if oEvents[event] then -- The 'event' is passed from the OnEvent script within kgPanels
  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
  Reply With Quote
11-10-14, 12:28 AM   #26
Choonstertwo
A Chromatic Dragonspawn
 
Choonstertwo's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2011
Posts: 194
Originally Posted by suicidalkatt View Post
You want to check that the event passed is equal to the name of the event:
You're initialising the oEvents table as an array of strings (i.e. strings are values), but you're using it as if it were a hashset (i.e. strings are keys).

You should be initialising it like this:
lua Code:
  1. local oEvents = { -- These are events that we can check for
  2.     GOSSIP_SHOW = true,
  3.     BANKFRAME_OPENED = true,
  4.     GUILDBANKFRAME_OPENED = true
  5. }
  Reply With Quote
11-10-14, 12:41 AM   #27
suicidalkatt
A Rage Talon Dragon Guard
 
suicidalkatt's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 331
Originally Posted by Choonstertwo View Post
You're initialising the oEvents table as an array of strings (i.e. strings are values), but you're using it as if it were a hashset (i.e. strings are keys).

You should be initialising it like this:
lua Code:
  1. local oEvents = { -- These are events that we can check for
  2.     GOSSIP_SHOW = true,
  3.     BANKFRAME_OPENED = true,
  4.     GUILDBANKFRAME_OPENED = true
  5. }
It's simply checking if the event is in the table. It should still return valid.

Alternatively you could do this as well:

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 suicidalkatt : 11-10-14 at 12:43 AM. Reason: formatting
  Reply With Quote
11-10-14, 12:59 AM   #28
Choonstertwo
A Chromatic Dragonspawn
 
Choonstertwo's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2011
Posts: 194
Originally Posted by suicidalkatt View Post
It's simply checking if the event is in the table. It should still return valid.
When you use the array-style table initialiser, the keys are numeric starting from 1 and the values are the values listed (the event strings in this case).

When you use the square bracket indexing operator, you're looking up the value associated with that key. In this case, you're looking up the value of the event name string, which is always nil because the event names are values rather than keys.

Originally Posted by suicidalkatt View Post
Alternatively you could do this as well:
That would work, but tContains iterates through the table until it finds the specified value. A simple key lookup is more efficient (although the difference is probably measured in milliseconds here).
  Reply With Quote
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
11-10-14, 11:15 PM   #30
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Stop doing this:

Lua Code:
  1. _G["ChatFrame1"]:Hide() -- NO!

Just do this:

Lua Code:
  1. ChatFrame1:Hide() -- YES!

Adding the extra _G lookup just makes your code more cluttered to read, and slower to run. The only reason to use a _G lookup is if you are dynamically construting a name that is not constant or known ahead of time, eg. in a loop:

Lua Code:
  1. for i = 1, 10 do
  2.      _G["ChatFrame"..i]:SetFont("Fonts\\FRIZQT__.ttf", 16, "OUTLINE")
  3. end

Also, don't do this (whoever suggested this solution, just... no, and stop using Blizzard's UI code as your guide; most of it is obviously written by people who are not familiar with Lua programming -- there's even a place where they do ~30 if/else checks to uppercase a string instead of just calling string.upper FFS):

Lua Code:
  1. local oEvents = {
  2.     "GOSSIP_SHOW",
  3.     "BANKFRAME_OPENED",
  4.     "GUILDBANKFRAME_OPENED"
  5. }
  6.  
  7. if tContains(oEvents,event) then

This is quite possibly THE most inefficient way you could achieve this goal. First, you are creating a new table every time an event fires. This is a total waste of memory, and wastes CPU cycles on garbage collection. Second, you are adding a function call (which is one of the slowest, if not the slowest, single action you can perform in Lua) and looping over your entire table, instead of just structuring your table correctly for your purpose in the first place.

You should just do this instead:

Lua Code:
  1. if event == "GOSSIP_SHOW"
  2. or event == "BANKFRAME_OPENED"
  3. or event == "GUILDBANKFRAME_OPENED"
  4. then

(You can put it all one line if you want; I just included the line breaks to keep it more readable in the tiny boxes kgPanels provides for code entry.)

If you end up checking more events, using a table might be worthwhile, but please do it the right way. Put the table in your OnLoad script so it's only created once, and structure it correctly (hash table, not array):

Lua Code:
  1. self.openEvents = {
  2.     GOSSIP_SHOW = true,
  3.     BANKFRAME_OPENED = true,
  4.     GUILDBANKFRAME_OPENED = true,
  5. }

Then refer to it in your OnEvent script:

Lua Code:
  1. if self.openEvents[event] then
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
11-11-14, 02:08 AM   #31
BabyRay
An Aku'mai Servant
Join Date: Sep 2009
Posts: 39
First of all thanks for your help!
Since I have no idea about LUA, I have all my scripts here from the thread. And here, thanks to all!

I changed the following

From this

Code:
    _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()
to this

Code:
    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()
The line unfortunately I could not find it. Possibly I am not yet fully awake. But I will look over it again

Code:
for i = 1, 10 do
     _G["ChatFrame"..i]:SetFont("Fonts\\FRIZQT__.ttf", 16, "OUTLINE")
end
Hope this is right, now.
Button labeled as 'Hide'

OnLoad:

Code:
self.openEvents = {
    GOSSIP_SHOW = true,
    BANKFRAME_OPENED = true,
    GUILDBANKFRAME_OPENED = true,
}
 
if 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
OnEvent:

Code:
if self.openEvents[event] then
 
if oEvents[event] then
    ChatFrame1:Show()
    ChatFrame3:Show()
    ChatFrame1ButtonFrame:Show()
    ChatFrame3ButtonFrame:Show()
    ChatFrameMenuButton:Show()
    GeneralDockManager:Show()
    FriendsMicroButton:Show()
else
    ChatFrame1:Hide()
    ChatFrame3:Hide()
    ChatFrame1ButtonFrame:Hide()
    ChatFrame3ButtonFrame:Hide()
    ChatFrameMenuButton:Hide()
    GeneralDockManager:Hide()
    FriendsMicroButton:Hide()
end
  Reply With Quote
11-11-14, 02:12 AM   #32
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by BabyRay View Post
The line unfortunately I could not find it. Possibly I am not yet fully awake. But I will look over it again
That code was an example of where that technique should be used -- you're not doing anything like that in your scripts, which is why you don't need to use that technique.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
11-11-14, 02:37 AM   #33
BabyRay
An Aku'mai Servant
Join Date: Sep 2009
Posts: 39
The rest is ok?

Button labeled as 'Hide'

OnLoad:

Code:
self.openEvents = {
    GOSSIP_SHOW = true,
    BANKFRAME_OPENED = true,
    GUILDBANKFRAME_OPENED = true,
}
 
if 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
OnEvent:

Code:
if self.openEvents[event] then
 
if oEvents[event] then
    ChatFrame1:Show()
    ChatFrame3:Show()
    ChatFrame1ButtonFrame:Show()
    ChatFrame3ButtonFrame:Show()
    ChatFrameMenuButton:Show()
    GeneralDockManager:Show()
    FriendsMicroButton:Show()
else
    ChatFrame1:Hide()
    ChatFrame3:Hide()
    ChatFrame1ButtonFrame:Hide()
    ChatFrame3ButtonFrame:Hide()
    ChatFrameMenuButton:Hide()
    GeneralDockManager:Hide()
    FriendsMicroButton:Hide()
end
  Reply With Quote
11-11-14, 03:27 AM   #34
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
You should be getting errors from those scripts.

In your OnLoad, you have this:
Code:
if oEvents[event] then
    -- stuff
else
    -- stuff
end
You don't have anything named "oEvents" anymore, and there's no variable named "event" in an OnLoad script. I don't think you want to hide anything at login, since none of the the bank, guild, or gossip frames are open at login, so you should just remove that part. You only need to define the table OnLoad.

Then in your OnEvent you have:
Code:
if self.openEvents[event] then
 
if oEvents[event] then
Again, you don't have anything named "oEvents" anymore, and now you have more "if"s than "else/end"s. Delete the second line.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » KGPanels script

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off