I think you need to put it into the callback function of the event_player_activated so it gets called everytime a zonechage/reloadui takes place:
Lua Code:
local function Callback_Player_Activated(...)
--remove borders at action buttons
for slotNum = 3, 9 do
local button = ZO_ActionBar_GetButton(slotNum).button
button:SetNormalTexture("")
button:SetPressedTexture("")
button:SetDisabledTexture("")
end
end
--Put this somewhere where your addon gets initialized, e.g. inside callback function of EVENT_ADDON_ON_LOAD or just at the bottom of your addon
--Register for the zone change/player ready event
EVENT_MANAGER:RegisterForEvent("MyAddonName", EVENT_PLAYER_ACTIVATED, Callback_Player_Activated)
Like written in the code the addon should load some function as it loads up, by event EVENT_ADDON_ON_LOAD. Replace MyAddonName with the name of your addon, like the lua filename is.
Lua Code:
local function Addon_Loaded(eventCode, addOnName)
--Is this addon found? Put your addon's name here!!!
if(addOnName ~= "MyAddonName") then
return
end
--Unregister this event again so it isn't fired again after this addon has beend reckognized
EVENT_MANAGER:UnregisterForEvent("MyAddonName", EVENT_ADD_ON_LOADED)
--Register for the zone change/player ready event
EVENT_MANAGER:RegisterForEvent("MyAddonName", EVENT_PLAYER_ACTIVATED, Callback_Player_Activated)
end
At the bottom of your addon's lua file put this then to register the event on addon load callback function:
Lua Code:
EVENT_MANAGER:RegisterForEvent("MyAddonName", EVENT_ADD_ON_LOADED, Addon_Loaded)
About the weapon bar change:
I do not know how to check on this but I'll have a look.
EDIT:
There is an event for this too. So put this into the ON ADDOn LOAD event callback function:
Lua Code:
EVENT_MANAGER:RegisterForEvent("YourAddonName", EVENT_ACTIVE_WEAPON_PAIR_CHANGED, WeaponSwapped)
And this somewhere above:
Lua Code:
local function WeaponSwapped(...)
--remove borders at action buttons
for slotNum = 3, 9 do
local button = ZO_ActionBar_GetButton(slotNum).button
button:SetNormalTexture("")
button:SetPressedTexture("")
button:SetDisabledTexture("")
end
end
end
As the code is duplicate now try to put it in a nother local function and then call the function inside the Weapon swapped callback function AND the player activated function instead.