Thread: Compass Events
View Single Post
07/28/14, 09:41 PM   #14
Garkin
 
Garkin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 832
Originally Posted by unLeashed3k View Post
Is there any type of documentation on all these [no clue what they are] controls?

What I truly need is a method to try all these functions and controls within an basic/universal example program. I'm extremely frustrated because I believe I'm looking at how everything works completely backwards.

Looking at http://wiki.esoui.com/Userdata_in_100007_API I can't figure out what they return (or contain). Are these all objects? If so, how do I look at them? Every function I use on them returns nil or an error (userdata).

Edit: How about that. Getting output now of ZO_MapPin1 through 50. Now to figure out how to map the globals to what they really are.
Controls are objects.
http://wiki.esoui.com/Controls

Working code:
Lua Code:
  1. EVENT_MANAGER:RegisterForEvent("QuestOffers", EVENT_ADD_ON_LOADED,
  2.    function(event, addonName)
  3.       if (addonName):find("^ZO_") then return end
  4.       EVENT_MANAGER:UnregisterForEvent("QuestOffers", event)
  5.  
  6.       local time_between_alerts = 5000 --in milliseconds
  7.       local lastDescription, nextAlert
  8.       ZO_PreHookHandler(COMPASS.container, "OnUpdate",
  9.          function(self)
  10.             local now = GetFrameTimeMilliseconds()
  11.             if now < COMPASS.nextLabelUpdateTime then
  12.                return true
  13.             end
  14.  
  15.             --do not show alerts when boss bar is active
  16.             if BOSS_BAR.control:IsHidden() then
  17.                for i = 1, self:GetNumCenterOveredPins() do
  18.                   local description, pinTypeId = self:GetCenterOveredPinInfo(i)
  19.                   if pinTypeId == MAP_PIN_TYPE_QUEST_OFFER and (lastDescription ~= description or nextAlert < now) then
  20.                      CENTER_SCREEN_ANNOUNCE:DisplayMessage(CSA_EVENT_SMALL_TEXT, SOUNDS.QUEST_FOCUSED, "Quest offer: " .. ZO_ERROR_COLOR:Colorize(description))
  21.                      lastDescription = description
  22.                      nextAlert = now + time_between_alerts
  23.                   end
  24.                end
  25.             end
  26.  
  27.          end)
  28.  
  29.    end)
  Reply With Quote