View Single Post
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