1. I am trying to create a script (in this case, inside of kgPanels) to toggle a ChatFrame to be visible or not visible, based on entering or leaving Trade Channel.

    The basic script I have right now is as follows:

     if event == "CHAT_MSG_CHANNEL_NOTICE" and arg8 == 2 then 
         if ChatFrame3:IsVisible() then 
       else ChatFrame3:Show()

    However, if I somehow have a channel event when it was already visible - e.g., when I log into the game and join the channel - I lose the window.

    The straightforward solution appears to be to also check arg2, which identifies the type of event as either "YOUJOINED" or "YOULEFT".

    However, when I try to do this in practice, the event doesn't seem to trigger. Everything I've read says this should be transmitted on arg2, and that I have the return arguments of "YOUJOINED" and "YOULEFT" correct, but the code simply doesn't work. So I'm thinking that it's either not arg2 (anymore?), or the responses returned under arg2 have changed wording/syntax.

    Does anyone have insight? Ideally, I want something like the code below... except for it to actually work. :)

     if event == "CHAT_MSG_CHANNEL_NOTICE" and arg8 == 2 then 
       if arg2 == "YOU_JOINED" then ChatFrame3:Show()
         else ChatFrame3:Hide()

    In practice, the above script successfully causes the window to hide if it is visible when I left the city, but ALSO causes the window to hide when I enter the city (and never causes a hidden window to show). So it appears "YOU_JOINED" is not right, and/or it's not on arg2.

    Insight would be welcome! :)

    You'll need to check the arguments to the event yourself by printing them, or using the /eventtrace utility in-game. This will tell you which arguments contain which information which should help you figure out what to do next. Hope that helps.