Thread Tools Display Modes
01/19/18, 07:36 PM   #1
Rhyono
AddOn Author - Click to view addons
Join Date: Sep 2016
Posts: 659
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:
  1. local Test = {
  2. name = "Test",
  3. author = "Rhyono",
  4. version = 1}
  5.  
  6. local function OnAddOnLoaded(event, addonName)
  7.     if addonName == Test.name then
  8.         d("Loaded.")
  9.         EVENT_MANAGER:RegisterForEvent(Test.name,EVENT_PLAYER_ACTIVATED,Test.HouseTest)
  10.         EVENT_MANAGER:UnregisterForEvent(Test.name, EVENT_ADD_ON_LOADED)
  11.     end
  12. end
  13.  
  14. function Test.HouseTest()
  15.     d("Function called.")
  16.     if GetCurrentZoneHouseId() > 0 then
  17.         if IsOwnerOfCurrentHouse() then
  18.             d("My house.")
  19.             myHouse = true
  20.         else
  21.             d("Not my house.")
  22.             myHouse = false
  23.     else
  24.         d("Not a house.")
  25.         myHouse = false
  26.     end
  27. end
  28.  
  29. EVENT_MANAGER:RegisterForEvent(Test.name, EVENT_ADD_ON_LOADED, OnAddOnLoaded)
  Reply With Quote
01/20/18, 03:25 AM   #2
votan
 
votan's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 577
Originally Posted by Rhyono View Post
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:
Short: siri.exe
Long: Is this really a copy of your source?
I corrected the missing "end" and it works with my house.
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » Housing Zone Event


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off