Thread Tools Display Modes
01-12-10, 02:40 PM   #1
Vexryn
A Defias Bandit
Join Date: Jan 2010
Posts: 3
kgPanels city toggle

I've been experimenting with using kgPanels to toggle a ChatFrame when I enter/exit a city (and the associated Trade Channel), but can't seem to get it work. I've tried the scripts from the kgPanels page at: http://www.wowace.com/addons/kg-pane...g-a-major-city

But that doesn't seem to work (even when I correct the typo on "RegisterEvent"

Right now, here's what I'm using, and not certain why it won't work:

OnLoad:
self:RegisterEvent('CHAT_MSG_CHANNEL_NOTICE')

OnEvent:
if event == "CHAT_MSG_CHANNEL_NOTICE" then
if arg1 == "YOU_JOINED" and arg7 == 2 then
ChatFrame3:Show()
end
if arg1 == "YOU_LEFT" and arg7 == 2 then
ChatFrame3:Hide()
end
end


Note that I tagged it as ChatFrame3:Show() and Hide() respectively, because I actually want to toggle that frame, not the kgPanels frame itself.

I've tried toggling the self:Show() and self:Hide() and anchoring/parenting it to ChatFrame3, and that doesn't seem to work either.

Notably, I *can* make it work by making an OnClick event as follows:
if pressed then
if ChatFrame3:IsVisible() then
ChatFrame3:Hide() else ChatFrame3:Show()
end
end


I just cannot make it occur "automatically" based on CHAT_MSG_CHANNEL_NOTICE

Any insight would be greatly appreciated!
  Reply With Quote
03-02-10, 02:31 PM   #2
harrellj
A Flamescale Wyrmkin
Join Date: Jul 2009
Posts: 132
Necro'ing an older thread because I've been pounding my head against a wall attempting this myself. I have used both ChatFrame3:Hide()/Show() and self:Hide()/Show() and neither work automatically, I get left with a panel on the screen. I even attempted to have a ChatFrame4 that is blank and tell 3 to hide and 4 to show for the appropriate things, but that failed. And the panel is anchored/parented to ChatFrame3 and the only mention of 4 is to try and get the show/hide to work, it has no other attachment to the panel.

Any other ideas on how to get a panel to disappear when leaving trade and reappear when entering trade?
  Reply With Quote
03-02-10, 02:57 PM   #3
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,961
You might have to hide all 3 elements for it to work completely.

local gcframe = ChatFrame3;
local gctab = ChatFrame3Tab;
local gcbackground = ChatFrame3Background;
__________________


Characters:
Gwynedda - 70 - Demon Warlock
Galaviel - 65 - Resto Druid
Gamaliel - 61 - Disc Priest
Gwynytha - 60 - Survival Hunter
Lienae - 60 - Resto Shaman
Plus several others below level 60

Info Panel IDs : http://www.wowinterface.com/forums/s...818#post136818
  Reply With Quote
03-02-10, 04:54 PM   #4
harrellj
A Flamescale Wyrmkin
Join Date: Jul 2009
Posts: 132
Hrm, thanks, I'll try that and see what develops.
  Reply With Quote
03-04-10, 05:20 AM   #5
khurzog
A Frostmaul Preserver
 
khurzog's Avatar
Join Date: Dec 2007
Posts: 266
i was going to post a similar thread except i want to toggle a party chat frame when i join a party. i havent even tried at all, and i am now scared to even try it after reading this and being utterly confused already reading this, so nevermind i guess unless somehow im reassured i can do it. will keep an eye on this thread!
  Reply With Quote
03-05-10, 12:07 PM   #6
harrellj
A Flamescale Wyrmkin
Join Date: Jul 2009
Posts: 132
Well, I've not yet tried to work on the city thing just yet, but khurzog mentioning the auto-party chat which was something I was going to do as well. And while I was looking up API stuff yesterday for the city issue, I came across a mention of IsInInstance(). So, I'm working on getting the automatic party chat to work, and I think I almost do. Much easier for me to test currently as I'm nearly done with Loremaster of Kalimdor, so am not near to a city for easy testing.
  Reply With Quote
03-06-10, 10:00 PM   #7
khurzog
A Frostmaul Preserver
 
khurzog's Avatar
Join Date: Dec 2007
Posts: 266
Originally Posted by harrellj View Post
Well, I've not yet tried to work on the city thing just yet, but khurzog mentioning the auto-party chat which was something I was going to do as well. And while I was looking up API stuff yesterday for the city issue, I came across a mention of IsInInstance(). So, I'm working on getting the automatic party chat to work, and I think I almost do. Much easier for me to test currently as I'm nearly done with Loremaster of Kalimdor, so am not near to a city for easy testing.
it was really easy and ill edit this to tell you how after this raid
  Reply With Quote
03-10-10, 10:34 AM   #8
harrellj
A Flamescale Wyrmkin
Join Date: Jul 2009
Posts: 132
well, I've got both party and trade chats working to show automatically. Minor tweaking needed for them however.

Trade:

OnLoad:
Code:
self:RegisterEvent('CHAT_MSG_CHANNEL_NOTICE')
OnEvent:
Code:
if event == "CHAT_MSG_CHANNEL_NOTICE" then
   if arg1 == "YOU_JOINED" and arg8 == 2 then
      self:Show()
   end
   if arg1 == "SUSPENDED" and arg8 == 2 then
      self:Hide()
   end
end
Party:

OnLoad:
Code:
self:RegisterEvent('PLAYER_ENTERING_WORLD')
OnEvent:
Code:
if event == "PLAYER_ENTERING_WORLD" then
 local isInstance, _ = IsInInstance();
if isInstance == 1 then
   self:Show()
 else
   self:Hide()
 end
end
However, the party chat only shows when joining an instance. I'm going to work on getting it to work when you join a party as well.

As for the trade chat? It works, beautifully. However, how do you clear out the text from the chat window? Maybe it is because I'm using self rather than the appropriate chat frame but the text still hangs around until I /rl. However, using the appropriate chat frame seems to break this script from working in the first place.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » kgPanels city toggle


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