Thread Tools Display Modes
11/22/14, 07:03 AM   #1
Carter_DC
 
Carter_DC's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2014
Posts: 18
Skill Trigger

Hi guys,
is there a workaround the lack of a proper event triggered each time an action skill is activated ?

I saw some addons (like sorcerer helper) use a 1 second loop to check for button state, but i'd like to know it's there's a more proper way to go.
  Reply With Quote
11/22/14, 07:17 AM   #2
Ayantir
 
Ayantir's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 1,019
you can prehook one of the core function which will trigger when user activate a skill. but i don't know really which one to use.

Looked on code, maybe ZO_Skills_AbilitySlot_OnClick..
  Reply With Quote
11/22/14, 08:01 AM   #3
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 671
Originally Posted by Ayantir View Post
you can prehook one of the core function which will trigger when user activate a skill. but i don't know really which one to use.
I don't think so, ActionButtonUp -> button:HandleRelease -> OnSlotUp (which is private)
Before the call to OnSlotUp, there's self.button:SetState(BSTATE_NORMAL, false), so you could hook SetState. But gamepads don't use separate Down/Up calls, they use DownAndUp, and these don't call SetState at all. And now when I saw that, I'm thinking of replacing Down with DownAndUp, and Up with empty function, if that works it should fire abilities earlier

Originally Posted by Ayantir View Post
Looked on code, maybe ZO_Skills_AbilitySlot_OnClick..
I think OnClick is for actual mouse clicks.

Maybe

* EVENT_ACTION_SLOT_STATE_UPDATED (*luaindex* _slotNum_)

and

* HasActivationHighlight(*luaindex* _slotIndex_)
** _Returns:_ *bool* _status_

?
  Reply With Quote
11/22/14, 08:18 AM   #4
Garkin
 
Garkin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 832
Kith in his Srendarr addon uses post hook of the ActionButton's SetState method:

Lua Code:
  1. local function ActionFailed(slotnum)
  2.     return GetSlotType(slotnum) == ACTION_TYPE_NOTHING or
  3.     HasCostFailure(slotnum) or
  4.     HasTargetFailure(slotnum) or
  5.     HasRequirementFailure(slotnum) or
  6.     HasWeaponSlotFailure(slotnum) or
  7.     HasStatusEffectFailure(slotnum) or
  8.     HasFallingFailure(slotnum) or
  9.     HasSwimmingFailure(slotnum) or
  10.     HasMountedFailure(slotnum) or
  11.     HasReincarnatingFailure(slotnum) or
  12.     HasRangeFailure(slotnum)
  13. end
  14.  
  15. local ActionButton_SetState_Orig = ActionButton3Button.SetState
  16.  
  17. local function ActionButton_SetState_Hook(self, state, locked)
  18.     ActionButton_SetState_Orig(self, state, locked)
  19.  
  20.     if state == BSTATE_PRESSED and (not ActionFailed(self.slotNum)) then
  21.  
  22.         --your code
  23.  
  24.     end
  25. end
  26.  
  27. ActionButton3Button.SetState = ActionButton_SetState_Hook
  28. ActionButton4Button.SetState = ActionButton_SetState_Hook
  29. ActionButton5Button.SetState = ActionButton_SetState_Hook
  30. ActionButton6Button.SetState = ActionButton_SetState_Hook
  31. ActionButton7Button.SetState = ActionButton_SetState_Hook
  32. ActionButton8Button.SetState = ActionButton_SetState_Hook

Last edited by Garkin : 11/22/14 at 08:30 AM.
  Reply With Quote
11/22/14, 08:49 AM   #5
Carter_DC
 
Carter_DC's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2014
Posts: 18
i'm gonna look into this, thx guys ! (you're great ! )
  Reply With Quote

ESOUI » AddOns » AddOn Help/Support » Skill Trigger


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