WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   AddOn Search/Requests (https://www.wowinterface.com/forums/forumdisplay.php?f=6)
-   -   Request: Prevent an addon from firing its script on reload? (https://www.wowinterface.com/forums/showthread.php?t=59740)

Aethereality 12-21-23 06:05 PM

Request: Prevent an addon from firing its script on reload?
 
Howdy. I'm trying to write an overly basic addon that runs some code when the player first logs in, but not when they do a /reload. Is there a way to prevent this from happening?

The code is very basic;

Lua Code:
  1. local frame=CreateFrame("Frame");
  2. frame:RegisterEvent("PLAYER_LOGIN");
  3. frame:SetScript("OnEvent",function(self,event,...)
  4.     --My code is here, it's one line
  5. end);

Dridzt 12-21-23 07:29 PM

Code:

local frame=CreateFrame("Frame")
frame:RegisterEvent("PLAYER_ENTERING_WORLD")
frame:SetScript("OnEvent",function(self,event,...)
    local isLogin, isReload = ...
    if isLogin then
    -- your action here
    end
end)


Aethereality 12-21-23 07:34 PM

Quote:

Originally Posted by Dridzt (Post 343063)
Code:

local frame=CreateFrame("Frame")
frame:RegisterEvent("PLAYER_ENTERING_WORLD")
frame:SetScript("OnEvent",function(self,event,...)
    local isLogin, isReload = ...
    if isLogin then
    -- your action here
    end
end)


Thank you very much @_@


All times are GMT -6. The time now is 06:12 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI