Thread Tools Display Modes
11/04/15, 11:37 PM   #1
Randactyl
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 251
Contextual Actions On Item Slots

Now that game pad support is out, I want to see if we can find a better way of adding actions to context menus.

Currently, we prehook ZO_InventorySlot_ShowContextMenu and shove our code in right before the menu is shown.

The game manages contextual actions in itemslot.lua, but there is no global object to work with and both the table of action handlers and the table of actions available to each slot type are local.

I've built up a preliminary library to manage the manipulation of these tables, but it unfortunately requires a pretty ham-fisted copy/paste of much of the code in itemslot.lua since there are so many local functions used to support the handlers in the actions table.

The benefit of going about managing contextual actions with this library would be:
  • common way to manage actions for kb/m and game pad UIs
  • easily get and manipulate handlers for existing actions

The drawback is obviously the rather large size (89 KB) due to the file containing the ported itemslot.lua code, but I may be able to slim that down further. (When I was originally building it, I broke mouse interactions with item slots like double click and dragging)

So, what do you all think? Am I over-engineering here? Can anyone think of any other potential benefits to build in that would offset the cost? Do you anticipate any problems with the current implementation?
Attached Files
File Type: zip LibActionMenu-1.0.0.0beta1.zip (16.9 KB, 396 views)
  Reply With Quote
11/05/15, 03:42 AM   #2
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,989
I'm not pretty sure what the difference in context menus, between mouse/keyboard and gamepad controllers, is at the moment?
I know the m/k way but what does the controller support? Is there any "keybind" to activate the context menu (like rpessing the right mouse button)? Or aren't there any context menus, just keybinds to start the action with an item?
  Reply With Quote
11/05/15, 01:37 PM   #3
Randactyl
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 251
Originally Posted by Baertram View Post
I'm not pretty sure what the difference in context menus, between mouse/keyboard and gamepad controllers, is at the moment?
I know the m/k way but what does the controller support? Is there any "keybind" to activate the context menu (like rpessing the right mouse button)? Or aren't there any context menus, just keybinds to start the action with an item?
Yes, there is an "Actions" menu attached to the Y/triangle button which has all of the actions like destroy, repair, split, etc.
  Reply With Quote
11/05/15, 01:58 PM   #4
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 613
Originally Posted by Randactyl View Post
Do you anticipate any problems with the current implementation?
I tried something like this once before & ran into problems with Private functions like:

Lua Code:
  1. UseItem(bag, index)



Lua Code:
  1. local MAJOR, MINOR = "LibActionMenu", 1.0.0.0
  Reply With Quote
11/06/15, 05:08 AM   #5
Randactyl
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 251
Originally Posted by circonian View Post
I tried something like this once before & ran into problems with Private functions like:

Lua Code:
  1. UseItem(bag, index)

I think that can be solved by wrapping up those protected function calls in CallSecureProtected.


Lua Code:
  1. local MAJOR, MINOR = "LibActionMenu", 1.0.0.0
Oh duh, that should have been a string. LibStub accepts strings for that, doesn't it?

I'll look at this stuff on Monday. I'm out for the weekend.
  Reply With Quote
11/06/15, 06:38 AM   #6
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 671
Originally Posted by Randactyl View Post
Oh duh, that should have been a string. LibStub accepts strings for that, doesn't it?
Yes it does, but it will only take the "1.0" part. Better to use plain number.
  Reply With Quote
11/06/15, 11:43 AM   #7
Randactyl
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 251
Originally Posted by merlight View Post
Yes it does, but it will only take the "1.0" part. Better to use plain number.
gotcha, thanks
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » Contextual Actions On Item Slots


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