View Single Post
04/26/14, 09:24 AM   #6
Saucy
 
Saucy's Avatar
Join Date: Apr 2014
Posts: 20
Originally Posted by LilBudyWizer View Post
Just set a variable while processing the addon loaded event. You can't avoid on /reloadui unless you want to avoid the initial load as well and never show the message. You can avoid displaying it after the initial player activation though.

Lua Code:
  1. local function onAddonLoaded()
  2.     addon.firstActivation = true
  3. end
  4.  
  5. local function onPlayerActivated()
  6.     if (addon.firstActivation) then
  7.         addon.firstActivation = false
  8.         Print("Hello World!")
  9.     end
  10. end
Originally Posted by ins View Post
Unregister the event in onInit.
Thanks, both of your suggestions worked.

Originally Posted by Iyanga View Post
That's not possible, the addon can't see the difference whether a new "gaming session" was started or he just switched characters. You can only get rid of the zone change message.


For my addons, I don't print a message, but just supply a slash command, even if they have no settings. The slash command prints the "Addon: Running" message for people to verify that it was loaded.
Hmm, okay. I'm guessing the response from LilBudyWizer and ins are the next best thing.

Originally Posted by Stormknight View Post
Please please please do NOT output a line to chat on load.

Does it really need it? What does it accomplish? Most addons I have seen do this, it's just a vanity statement to let the user know the addon has loaded.

Imagine if all addons did this.... I have 16 addons running currently.

That said, if you have a real need .... There doesn't seem to be an event you can catch, so I have currently seen two ways:

1. Have your initialisation function create a callback timer for 2 seconds later and use that to output the message.

2. Use the zone in event you're probably catching currently, but have a variable that you set to say you've done the output and check the value of that variable each event.
Sometimes I think it's great to know that the addon you just downloaded is working, compared to it being completely silent and there's no menu settings or slash commands. Nor being able to turn off the chat message.

I'm building my addon that only one of them prints to the chat (which can be turned on/off via menu settings or slash command). So my other addons will never print anything to the chat. I'm also building it to have all modules in a single menu setting where the user can find all the settings for the addons.
  Reply With Quote