View Single Post
12/27/23, 06:25 AM   #9
SimonIllyan
 
SimonIllyan's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2018
Posts: 2
Sorry to reheat that old thread, but it is the only place I've found in this forum mentioning "initial" parameter to a function handling EVENT_PLAYER_ACTIVATED. What is real meaning of this parameter? https://wiki.esoui.com/EVENT_PLAYER_ACTIVATED says:
boolean initial - whether the user just logged on
but this does not seem to be correct; according to the example code in this thread, "initial" is true not just after logging in, but also after fast travel, and false only after reloadui. Is that right? Is there anything else worth knowing about this parameter?

Originally Posted by Calamath View Post
There are many ways to detect warping between different zones using fast travel, but I use EVENT_PLAYER_ACTIVATED.

Here is a hint.

Lua Code:
  1. local isFirstTimePlayerActivated = true
  2.  
  3. local function OnPlayerActivated(eventCode, initial)
  4.     if initial then
  5.         if isFirstTimePlayerActivated == false then
  6.             -- --------------------------------- after fast travel
  7.             -- do something
  8.         else
  9.             -- --------------------------------- after login
  10.             isFirstTimePlayerActivated = false
  11.         end
  12.     else
  13.         -- ------------------------------------- after reloadui
  14.         isFirstTimePlayerActivated = false
  15.     end
  16. end
  17.  
  18. EVENT_MANAGER:RegisterForEvent("yourAddonName", EVENT_PLAYER_ACTIVATED, OnPlayerActivated)
  Reply With Quote