arcanistzed / sidebar-macros

Add a Macros tab to the Foundry VTT sidebar!
https://arcanist.me
MIT License
6 stars 7 forks source link

[FEAT] Execute Macro #6

Closed patrickburk1988 closed 2 years ago

patrickburk1988 commented 2 years ago

Is your feature request related to a problem? Please describe. I use this module as a functional replacement for the macro hotbar. Unlike the hotbar, however, there's currently no way to execute a sidebar macro aside from left-clicking to open the macro editor and then clicking Execute Macro. And even this isn't possible if the player doesn't have owner permissions for the macro.

Describe the solution you'd like Maybe an option in the settings to override the default left-click functionality so that left-clicking a sidebar macro executes it instead of opening the editor? This would also require adding a context menu option to open the editor, I guess.

Describe alternatives you've considered Barring that, maybe just adding a right-click context menu option to execute the macro? I've plugged this functionality into my local copy of the module, and it seems to work pretty okay. My quick-and-dirty context menu option.

arcanistzed commented 2 years ago

If you have the code written, would you be interested in making a PR? I'm fairly busy so I won't be able to get to this for a few weeks otherwise.

arcanistzed commented 2 years ago

I'm definitely interested in this and I've already briefly brainstormed it actually. I was thinking of replacing the default click, but I like the context menu idea better.

ravingdragoon commented 2 years ago

@patrickburk1988 Are you still using Foundry V0.8.x? On V9 I get the following error when I try to use your version of this module

sidebar-macros.js:121 Uncaught TypeError: Cannot read properties of undefined (reading 'data')
[Detected 1 package: sidebar-macros]
    at Object.condition (sidebar-macros.js:121)
    at ContextMenu.render (foundry.js:43494)
    at HTMLLIElement.<anonymous> (foundry.js:43437)
    at HTMLElement.dispatch (jquery.min.js:2)
    at HTMLElement.v.handle (jquery.min.js:2)
condition   @   sidebar-macros.js:121
render  @   foundry.js:43494
(anonymous) @   foundry.js:43437
dispatch    @   jquery.min.js:2
v.handle    @   jquery.min.js:2
arcanistzed commented 2 years ago

@ravingdragoon I think it's because it needs documentId instead of entityId.

patrickburk1988 commented 2 years ago

@patrickburk1988 Are you still using Foundry V0.8.x? On V9 I get the following error when I try to use your version of this module

Yeah, I'm still using 0.8.9.

ravingdragoon commented 2 years ago

@ravingdragoon I think it's because it needs documentId instead of entityId.

Yeah, that fixed it for me..

arcanistzed commented 2 years ago

Implemented in 9cf9bcf34d47e148d8f743dfd7d7843fd0160715. Thanks for the help with this!