<Bindings> <Layer name="SI_MYADDON_LAYER"> <Category name="MYADDON_KEYBINDINGS_CATEGORY"> <Action name="MYADDON_SPECIAL_MOVE_BLOCK" inheritsBindFrom="SPECIAL_MOVE_BLOCK" allowFallthrough="true" rebindable="false"> <Up>return MyAddon_BlockInputUp()</Up> <Down>return MyAddon_BlockInputDown()</Down> </Action> </Category> </Layer> </Bindings>
EVENT_MANAGER:RegisterForEvent(addonName, EVENT_GLOBAL_MOUSE_DOWN, OnGlobalMouseDown) EVENT_MANAGER:RegisterForEvent(addonName, EVENT_GLOBAL_MOUSE_UP, OnGlobalMouseUp)and
local function OnGlobalMouseDown(eventCode, button) if button == 2 then ;RMB is Down end end local function OnGlobalMouseUp(eventCode, button) if button == 2 then ;RMB is Up end endto see if you're holding that key.
<Bindings> <Layer name="SI_MYADDON_LAYER"> <Category name="MYADDON_KEYBINDINGS_CATEGORY"> <Action name="MYADDON_SPECIAL_MOVE_BLOCK" inheritsBindFrom="SPECIAL_MOVE_BLOCK" allowFallthrough="true" rebindable="false"> <Up> d("Block key released.") return true </Up> <Down> d("Block key pressed") <!-- return true: block works, but 'Blockkey released' never displays --> <!-- return false: block is consumed, but 'Blockkey released' WILL display --> return true </Down> </Action> </Category> </Layer> </Bindings>
Pease do not hardcode the values but use the proper ZOs defined constants for the buttons (and everywhere else in the game too):if button == 2 then
monkidb16_ESO wrote: »If you are using the default (RMB) binding you can use
...
If the Wiki is not describing it properly go ahead please and update it so whatever you found out and needs better description: Add it there. We all are maintaining a Wiki! Thank you very much.
An addon example to capture the keybind (Bar Swap) can be found here:
https://github.com/slippycheeze/SlippyCheezeESO/tree/main/BarSwapFailWarning
Dack_Janiels wrote: »Have you looked at the code of Am I Blocking? https://www.esoui.com/downloads/info2920-AmIBlocking.html
Maybe it could give you some ideas.
I guess those movement and combat related bindings are protected then so that you could not "insert any code to do botting or whatever".
Maybe it's because the OnDown and OnUp actions are secure functions?
For those EVENT_GLOBAL_MOUSE_UP:
Make sure they unregister for your addon ...
Pease do not hardcode the values but use the proper ZOs defined constants for the buttons (and everywhere else in the game too):
MOUSE_BUTTON_INDEX_RIGHT
local function OnGlobalMouseDown(eventCode, button) d(button) end
Using named constants instead of numeric literals is just good software development practice, you should avoid using literals where possible.monkidb16_ESO wrote: »
Is there really any difference?
If I hook up a debug like:local function OnGlobalMouseDown(eventCode, button) d(button) end
the game will even print 1 for LMB, 2 for RMB, and 3 for MMB in the chat.