View Single Post
04/25/14, 06:40 PM   #1
Saucy
 
Saucy's Avatar
Join Date: Apr 2014
Posts: 20
Only show addon msg when player login

Hello everyone,

I wish to only print that the addon has been loaded in the chat when the player just had logged in. My current code prints every time the player logs in, /reloadui or changes zone.

As it is right now, it's a bit spammy for my taste. Is it possible to only show the "addon: loaded" message once?

Lua Code:
  1. local addon = ZO_Object:Subclass()
  2. local EM    = GetEventManager();
  3.  
  4. function addon:New()
  5.   EM:RegisterForEvent('addon_OnLoad', EVENT_ADD_ON_LOADED,    function(...) self:OnLoad(...) end)
  6.   EM:RegisterForEvent('addon_OnInit', EVENT_PLAYER_ACTIVATED, function(...) self:OnInit(...) end)
  7. end
  8.  
  9. function addon:OnLoad(eventCode, addonName)
  10.   if ('addon' ~= addonName) then return end
  11. end
  12.  
  13. function addon:OnInit()
  14.   d('addon: loaded')
  15. end
  16.  
  17. addon:New()
  Reply With Quote