Thread Tools Display Modes
12-05-10, 09:47 AM   #1
Zax
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 147
[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,360
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 Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 147
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,360
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

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


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