Sorry... I thought it would be better that way. So here we go:
Lua Code:
-- First, we create a namespace for our addon by declaring a top-level table that will hold everything else.
RemiCustomAddon = {}
-- This isn't strictly necessary, but we'll use this string later when registering events.
-- Better to define it in a single place rather than retyping the same string.
RemiCustomAddon.name = "RemiCustomAddon"
function RemiCustomAddon:RestorePositionBagSpace()
local leftBagSpace = self.savedVariables.leftBagSpace
local topBagSpace = self.savedVariables.topBagSpace
RemiCustomAddonIndicator:ClearAnchors()
RemiCustomAddonIndicator:SetAnchor(TOPLEFT, GuiRoot, TOPLEFT, leftBagSpace, topBagSpace)
end
function RemiCustomAddon:RestorePositionFight()
local leftFight = self.savedVariables.leftFight
local topFight = self.savedVariables.topFight
FightIndicator:ClearAnchors()
FightIndicator:SetAnchor(TOPLEFT, GuiRoot, TOPLEFT, leftFight, topFight)
end
-- Next we create a function that will initialize our addon
function RemiCustomAddon:Initialize()
self.inCombat = IsUnitInCombat("player");
EVENT_MANAGER:RegisterForEvent(self.name, EVENT_PLAYER_COMBAT_STATE, self.OnPlayerCombatState)
EVENT_MANAGER:RegisterForEvent(self.name, EVENT_GROUPING_TOOLS_READY_CHECK_UPDATED, self.OnLFGReadyCheckState)
EVENT_MANAGER:RegisterForEvent(self.name, EVENT_PLAYER_ACTIVATED, self.DoesBagHaveSpace)
self.savedVariables = ZO_SavedVars:New("RemiCustomAddonSavedVariables", 1, nil, {})
self:RestorePositionBagSpace()
self:RestorePositionFight()
end
function RemiCustomAddon.DoesBagHaveSpace(eventCode, initial)
itemSpace = GetNumBagFreeSlots(1)
if itemSpace < 10 then
RemiCustomAddonIndicator:SetHidden(false)
end
end
function RemiCustomAddon.OnLFGReadyCheckState(event)
if HasLFGReadyCheckNotification() then
AcceptLFGReadyCheckNotification()
end
end
function RemiCustomAddon.OnPlayerCombatState(event, inCombat)
-- The ~= operator is "not equal to" in Lua.
if inCombat ~= RemiCustomAddon.inCombat then
-- The player's state has changed. Update the stored state...
RemiCustomAddon.inCombat = inCombat
-- ...and then update the control.
FightIndicator:SetHidden(not inCombat)
end
end
function RemiCustomAddon.OnIndicatorMoveStopFight()
RemiCustomAddon.savedVariables.leftFight = FightIndicator:GetLeft()
RemiCustomAddon.savedVariables.topFight = FightIndicator:GetTop()
end
function RemiCustomAddon.OnIndicatorMoveStopBagSpace()
RemiCustomAddon.savedVariables.leftBagSpace = RemiCustomAddonIndicator:GetLeft()
RemiCustomAddon.savedVariables.topBagSpace = RemiCustomAddonIndicator:GetTop()
end
-- Then we create an event handler function which will be called when the "addon loaded" event
-- occurs. We'll use this to initialize our addon after all of its resources are fully loaded.
function RemiCustomAddon.OnAddOnLoaded(event, addonName)
-- The event fires each time *any* addon loads - but we only care about when our own addon loads.
if addonName == RemiCustomAddon.name then
RemiCustomAddon:Initialize()
end
end
-- Finally, we'll register our event handler function to be called when the proper event occurs.
EVENT_MANAGER:RegisterForEvent(RemiCustomAddon.name, EVENT_ADD_ON_LOADED, RemiCustomAddon.OnAddOnLoaded)
As for the error messages, here it is (expanded):
Code:
user:/AddOns/RemiCustomAddon/RemiCustomAddon.lua:12: attempt to index a nil value
stack traceback:
user:/AddOns/RemiCustomAddon/RemiCustomAddon.lua:12: in function 'RemiCustomAddon:RestorePositionBagSpace'
|caaaaaa<Locals> self = [table:1]{inCombat = F, name = "RemiCustomAddon"} </Locals>|r
user:/AddOns/RemiCustomAddon/RemiCustomAddon.lua:34: in function 'RemiCustomAddon:Initialize'
|caaaaaa<Locals> self = [table:1] </Locals>|r
user:/AddOns/RemiCustomAddon/RemiCustomAddon.lua:77: in function 'RemiCustomAddon.OnAddOnLoaded'
|caaaaaa<Locals> event = 65536, addonName = "RemiCustomAddon" </Locals>|r
But to be honest, I don't really see what to do with this information myself... I don't quite understand what would be missing.
For LibDebugLogger, sorry it took quite a lot of time for me to understand how to use it...
Here is the file:
https://sir.insidi.at/or/logviewer/NVxFbP
As for the .txt file, yes I tried putting .xml files before and after the .lua file, no change. I also already tried removing the OnInitialization code (commenting it with --) to no avail.