I don't know what I'm doing wrong: check for addon load, register player activated, when player activates, it should call the house test, which grabs the zone ID and if the ID is greater than 0, it knows it is a house. So then it checks if I own the house. There are chat messages for all of them and I included a variable just to see. It isn't triggering. So now I feel that I've likely made some dumb, obvious mistake that is breaking it:
lua Code:
local Test = {
name = "Test",
author = "Rhyono",
version = 1}
local function OnAddOnLoaded(event, addonName)
if addonName == Test.name then
d("Loaded.")
EVENT_MANAGER:RegisterForEvent(Test.name,EVENT_PLAYER_ACTIVATED,Test.HouseTest)
EVENT_MANAGER:UnregisterForEvent(Test.name, EVENT_ADD_ON_LOADED)
end
end
function Test.HouseTest()
d("Function called.")
if GetCurrentZoneHouseId() > 0 then
if IsOwnerOfCurrentHouse() then
d("My house.")
myHouse = true
else
d("Not my house.")
myHouse = false
else
d("Not a house.")
myHouse = false
end
end
EVENT_MANAGER:RegisterForEvent(Test.name, EVENT_ADD_ON_LOADED, OnAddOnLoaded)