Thread Tools Display Modes
04/12/14, 04:17 PM   #1
Reaper79
Join Date: Apr 2014
Posts: 4
EVENT for open character screen ?

Hi there,

i'm looking for an event if you open the character screen or similiar (e.g. pressing c, or i or even k)

i have an custom XP bar, anchored above to the standard ActionBar. The actionbar disappears if you open something, but the custom XP bar does not. Is there a possibility to hide the bar too with an event?

Maybe an Idea...Is there an ActionBar Event (show/hide) ?

Last edited by Reaper79 : 04/12/14 at 04:21 PM.
  Reply With Quote
04/12/14, 04:33 PM   #2
Errc
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 30
Check out action layers. There are events for those whenever an alternate screen is opened like character or conversation etc.
  Reply With Quote
04/14/14, 03:01 AM   #3
Errc
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 30
Some more detail was asked about, so tossing a more detailed explanation of Action layers for anyone that wants to use them.

-- EVENT_ACTION_LAYER_POPPED (luaindex layerIndex, luaindex activeLayerIndex)
-- EVENT_ACTION_LAYER_PUSHED (luaindex layerIndex, luaindex activeLayerIndex)

Those are events that get fired whenever an alternate screen like the bags or options screen or character conversation or anything appear on screen. You can use /zgoo events and X out all events except those to see exactly what is going on with them.

In my experience the arguments of those events is of little help, and instead I use them just as triggers to then decide to hide/show my addon's UI.

Function to stick all ActionLayer information into a table so you can easily examine it and see how it changes as you open/close other screens.

/zgoo GetAllActionLayerInfo()

to examine it easily.

Code:
function GetAllActionLayerInfo()
	local num = GetNumActionLayers()
	local table = {}
	for i=1,num do
		local layer = {}
		local name, numCata = GetActionLayerInfo(i)

		layer.name = name
		layer.active = IsActionLayerActiveByName(name)
		layer.cata = {}

		layer.tostring = function(self)
			return self.name..(self.active and " - ACTIVE" or "")
		end

		table[i] = layer

		-- Do same thing for each catagory
		for k=1, numCata do
			local cata = {}
			local cname, numAction = GetActionLayerCategoryInfo(i,k)

			cata.name = cname
			cata.actions = {}

			cata.tostring = function(self)
				return self.name
			end

			layer.cata[k] = cata

			--Same thing for each action? Woo copy paste.
			for j=1, numAction do
				local action = {}
				local aname, rebind, hidden = GetActionInfo(i,k,j)

				action.name = aname
				action.rebind = rebind
				action.hidden = hidden

				action.tostring = function(self)
					return self.name
				end

				cata.actions[j] = action

			end
		end
	end

	return table
end
There are currently 15 action layers, some I personally haven't experienced so I just guessed about their use.
Code:
--[[
	1. General							
	2. User Interface Shortcuts	
	3. Siege
	4. Dialogs
	5. Notifications
	6. MouseUIMode					
	7. Conversation					
	8. Guild
	9. RadialMenu						
	10. Death								
	11. Loot							
	12. GameMenu					
	13. Keybind Window
	14. Addons
	15. OptionsWindow

	If 13/14/15 is open then
		12 is open

	if 8 is open then
		2 is open
--]]
So then to handle the events...

Code:
function UI:HandleActionLayer()
	local isActive = IsActionLayerActiveByName
	local l = ActionLabels

	if (( isActive(l[12])			-- GameMenu
		or isActive(l[2])			-- User Interface Shortcuts
		or isActive(l[5])			-- Notifications			
		or isActive(l[3])			-- Siege							
		or isActive(l[4]) )		-- Dialogs						
		and ADDON.sv.profile.hideoninventory
	)
	or (isActive(l[7])			-- Conversation
		and (ADDON.sv.profile.hideonconv	
	)
	then
		if UI:UI_IsShown() then
			self.hiddeninlayer = true

			ADDON.Menu:Hide()
			self:Hide_UI(1)
		end
	else
		if self.hiddeninlayer then
			self.hiddeninlayer = nil

			self:Show_UI(1)
		end
	end
end
So I picked the screens I want to hide my UI and if any of those action layers are active when either event fires, I hide my UI, otherwise I show it.
  Reply With Quote
04/14/14, 12:02 PM   #4
Dio
 
Dio's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 29
Alternatively, you can hook onto the "OnShow" and "OnHide" handler of a frame.

For example, this will call whenever you open up a character screen (bags, skills, journal, etc.)

Code:
ZO_PreHookHandler(ZO_MainMenuCategoryBar, "OnShow", function()
end)

ZO_PreHookHandler(ZO_MainMenuCategoryBar, "OnHide", function()
end)
The "MainMenuCategoryBar" is the top menu bar when you open up a menu.

Use /zgoo mouse to find a specific frame if you don't want them all.
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » EVENT for open character screen ?


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