Quantcast
Event to detect a skill on your bar changing? - ESOUI
Thread Tools Display Modes
06/13/20, 03:08 PM   #1
QuantumPie
AddOn Author - Click to view addons
Join Date: Sep 2019
Posts: 24
Event to detect a skill on your bar changing?

Is there an event that allows you to detect if a player slots / replaces an ability with a new one on their bar? Looking at the wiki, EVENT_ACTION_SLOT_ABILITY_SLOTTED seemed like the most straightforward event but that was removed in 10028. I've tried EVENT_ACTION_SLOT_UPDATED and EVENT_ACTION_SLOT_STATE_UPDATED but the first never fires when I change an ability and the later gets called for every actionSlotIndex if I replace an ability or bar swap. EVENT_HOTBAR_SLOT_CHANGE_REQUESTED also looked promising but I couldn't figure out what triggers it (swapping abilities clearly doesn't). Is there anything I'm missing or is this behavior not possible?
  Reply With Quote
06/13/20, 03:19 PM   #2
Scootworks
 
Scootworks's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2014
Posts: 290
you could try to hook that function:

ZO_ActionBarAssignmentManager:TryToSlotNewSkill(skillData)
__________________
EU Server - SŁĄuGhTerHĜuSe
  Reply With Quote
06/13/20, 03:46 PM   #3
QuantumPie
AddOn Author - Click to view addons
Join Date: Sep 2019
Posts: 24
Originally Posted by Scootworks View Post
you could try to hook that function:

ZO_ActionBarAssignmentManager:TryToSlotNewSkill(skillData)
What exactly do you mean by hooking? I also don't think that does what I need. I don't want the addon to actually change the user's abilities, just detect if they are manually changed and update a table with that info (to track what is on a users bars, currently it only happens when the UI is reloaded, and doesn't reflect any changes the user makes to their bars onwards).
  Reply With Quote
06/13/20, 04:08 PM   #4
Scootworks
 
Scootworks's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2014
Posts: 290
doesn't matter, you can listen to this:


Lua Code:
  1. ACTION_BAR_ASSIGNMENT_MANAGER:RegisterCallback("SlotUpdated", function(hotbarCategory, actionSlotIndex, isChangedByPlayer)
  2.     d(hotbarCategory, actionSlotIndex, isChangedByPlayer)
  3. end)
__________________
EU Server - SŁĄuGhTerHĜuSe
  Reply With Quote
06/13/20, 04:12 PM   #5
QuantumPie
AddOn Author - Click to view addons
Join Date: Sep 2019
Posts: 24
After learning you can use Zgoo with /zgoo events to track them, I found EVENT_SKILL_RESPEC_RESULT triggers when I change abilities, but I don't know which one. I'll just have to re-process all the slots once the event is called.
  Reply With Quote
06/13/20, 04:16 PM   #6
Scootworks
 
Scootworks's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2014
Posts: 290
typing my code above with a /script into the chat, you will see what happens if you gonna change a slot
__________________
EU Server - SŁĄuGhTerHĜuSe
  Reply With Quote
06/13/20, 04:28 PM   #7
Baertram
 
Baertram's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 3,092
Originally Posted by QuantumPie View Post
After learning you can use Zgoo with /zgoo events to track them, I found EVENT_SKILL_RESPEC_RESULT triggers when I change abilities, but I don't know which one. I'll just have to re-process all the slots once the event is called.
Not everything can be managed via events! Either there is no event for your purpose or you use it but it was not designed for your purpose, like in this case here:
This event is NOT for normal slot changes, it's about RESPECcing your skills. I wouldn't use this for your purpose as you cannot be sure it will always fire on a skill slot change (in the future e.g.).

But the CallbackManager was designed to be used for such purposes. You register a "callback" function to the fired event (here "OnSlotUpdated") and can run your code then. That's how ZOs does mutliple things in their code as well.

So try Scootworks callback function on the SlotUpdated callback fired by ACTION_BAR_ASSIGNMENT_MANAGER.
It provides you the actioNSlotIndex and everything should be what you are searching for.


And "Hooking" is explained here:
https://wiki.esoui.com/How_to_run_yo...eHook/PostHook)

You need to find a function which is called by ZOs code, that's what Scootworks tried to show you with his first post.
Then you Pre or PostHook to it and run your code afterwards, using the function's own parameters (like the slotindex etc.).
But this should only be used if there is no EVENT and/or CALLBACK_MANAGER entry defined which you could and should use instead,
as your PreHook code (if returning true e.g. or throwing errors) will break ZOs code, and other addons PreHooking the same or later code of the same object!

Last edited by Baertram : 06/13/20 at 04:32 PM.
  Reply With Quote
06/14/20, 08:38 AM   #8
andy.s
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 9
Lua Code:
  1. EVENT_ACTION_SLOTS_ALL_HOTBARS_UPDATED
  Reply With Quote
06/14/20, 11:17 AM   #9
Baertram
 
Baertram's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 3,092
This does not fire for single action slots and not always as only e.g. one of the slot changes, so you would still need to check all slots each time if fires.
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » Event to detect a skill on your bar changing?

Thread Tools
Display Modes

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