View Single Post
08-01-19, 01:20 PM   #9
LudiusMaximus
A Rage Talon Dragon Guard
 
LudiusMaximus's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2018
Posts: 322
Apparently PLAYER_LOGIN was just not late enough. It works, when I am using a timer to make sure that I am really the last. Thanks again!!


Lua Code:
  1. local folderName = ...
  2. local L = LibStub("AceAddon-3.0"):NewAddon(folderName, "AceTimer-3.0")
  3. local startupFrame = CreateFrame("Frame")
  4. startupFrame:RegisterEvent("PLAYER_LOGIN")
  5. startupFrame:SetScript("OnEvent", function(self, event, ...)
  6.   L:ScheduleTimer("initCode", 5.0)
  7. end)
  8.  
  9. function L:initCode()
  10.   -- Save any previously registered scripts.
  11.   local oldscript=GameTooltip:GetScript("OnTooltipSetItem")
  12.  
  13.   -- Futureproofing, support extra args to pass to previous scripts
  14.   GameTooltip:SetScript("OnTooltipSetItem", function(self, ...)
  15.    
  16.     self:AddLine("I am first!")
  17.  
  18.     if oldscript then return oldscript(self, ...) end
  19.   end);
  20. end
  Reply With Quote