Quantcast [HELP] Display Guild Frame? - WoWInterface
Thread Tools Display Modes
12-05-10, 09:47 AM   #1
Zax
A Wyrmkin Dreamwalker
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 59
[HELP] Display Guild Frame?

Hello,

Does anyone know how to display the main guild frame (the one where guildmates are listed) from an AddOn?

I tried the basic "GuildFrame:Show();" but wow returns this LUA error: "attempt to index global 'GuildFrame' (a nil value)"

Thanks in advance.
  Reply With Quote
12-05-10, 09:57 AM   #2
sacrife
An Onyxian Warder
 
sacrife's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 384
the :Show command only show's it if it is initially hidden or hidden on purpose.

You need to find a toggle version of it.
ToggleGuildFrame();
__________________


Last edited by sacrife : 12-05-10 at 10:00 AM.
  Reply With Quote
12-05-10, 10:30 AM   #3
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,257
What sacrife said.

Keep in mind that the guild is nowadays a load on demand blizzard addon.
"Blizzard_GuildUI".

Depending how soon you try to show it it might not be loaded.
For unguilded players I'm not sure it loads at all.

Do not try to force load it as that tends to break other Blizzard addons (Calendar for example).

Your best bet is monitoring ADDON_LOADED for "Blizzard_GuildUI" as first argument,
then you know it's available.

Hope it helps.
  Reply With Quote
12-05-10, 02:22 PM   #4
Zax
A Wyrmkin Dreamwalker
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 59
Thanks

Keeping in mind what you said, I tried this:
Code:
if (IsInGuild()) then
	if (not IsAddOnLoaded("Blizzard_GuildUI")) then
		local loaded, reason = LoadAddOn("Blizzard_GuildUI");
		if not loaded then
  			echo("Blizzard_GuildUI not loaded: "..reason);
  		else
  			echo("**************** TEST *********************");
  			ToggleGuildFrame();
  		end;
  	else
  		ToggleGuildFrame();
  	end
end
But it doesn't work (my personal echo() function just displays a text in the chat box): the TEST message in well displayed but the guild frame is not shown. I suppose it is because this script is called on VARIABLES_LOADED event.

I was just trying to display guild frame when entering WoW in order to quickly see the connected guildmates.
  Reply With Quote
12-05-10, 03:06 PM   #5
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,257
Originally Posted by Zax View Post
Thanks

Keeping in mind what you said, I tried this:

But it doesn't work (my personal echo() function just displays a text in the chat box): the TEST message in well displayed but the guild frame is not shown. I suppose it is because this script is called on VARIABLES_LOADED event.

I was just trying to display guild frame when entering WoW in order to quickly see the connected guildmates.
Yes your guess is correct, VARIABLES_LOADED is too early.
Also LoadAddOn() is not good practice, it can break other LoD Blizzard addons, most notably the Calendar.
This might be better:
Lua Code:
  1. local f = CreateFrame("Frame")
  2. f:SetScript("OnEvent",
  3. function(self,event,...)
  4.     if self[event] then
  5.         self[event](...)
  6.     end
  7. end)
  8. f:RegisterEvent("ADDON_LOADED")
  9. function f.ADDON_LOADED(...)
  10.     local addon = ...
  11.     if addon == "Blizzard_GuildUI" then
  12.         ToggleGuildFrame()
  13.     end
  14. end
  Reply With Quote
12-05-10, 03:42 PM   #6
henrik_s
Enhancement Shaman
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 19
It seems the frame is not created until you open it (manually). After that GuildFrame:Show() should work.
  Reply With Quote
12-05-10, 08:11 PM   #7
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,696
ToggleGuildFrame() loads Blizzard_GuildUI upon use, so no need to wait for it.

https://github.com/tekkub/wow-ui-sou...arent.lua#L443
  Reply With Quote
12-05-10, 08:31 PM   #8
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,257
Yes but the only 2 places the default client calls that function is when you click the microbutton,
or use the keybind.

In both cases the game is fully loaded.

Calling it from addon code at say VARIABLES_LOADED will cause the same problem I pointed out above as if you did LoadAddOn() or ## RequiredDependencies on an addon.

It's not the best idea.

You either need for it to load "normally" or delay calling that function sufficiently.
  Reply With Quote
12-05-10, 08:34 PM   #9
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,696
I belive the GuildUI is loaded on demand, but I could be wrong.
  Reply With Quote
12-05-10, 08:39 PM   #10
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,257
You're absolutely right.
I mentioned that on post #3.

The problem is that Blizzard "assumes" the several Blizzard_ LoD addons will load in a specific order.

This is an implicit assumption though they are not ReqDep on each other.

This (which is essentially a lack of forethought on their part, not addon author's part)
causes obscure side-effects when you force-load Blizz LoD addons (like GuildUI) too early.
  Reply With Quote
12-06-10, 10:20 AM   #11
Zax
A Wyrmkin Dreamwalker
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 59
I tried your script Dridzt (thanks to post it).
The guild frame was not shown but when I press my key to show it, WoW played the standard little sound and the guild frame didn't appear. Si I believe your script calls the frame without showing it and when I pressed my "guild" shortcut, WoW closed the guild pane.
I reloaded the UI and WoW crashed (it never crashes on my computer).

So, considering the goal - just show the guild pane on connect - I think I will abandon this non-essential feature. I didn't think it would be so difficult (it worked very easily on pre 4.x Wow version.

Anyhow, thanks all for your help.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » [HELP] Display Guild Frame?

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