Foundry-Workshop / Item-Macro

Store macros in your items, execute them from your character sheet or from your favorite automation module!
MIT License
1 stars 4 forks source link

Macros that have item.use() prompt consumption twice [dnd5e 3.0.1] #10

Closed etiquettestartshere closed 9 months ago

etiquettestartshere commented 10 months ago

Steps to replicate: create an item with Limited Uses and check Uses Prompt. With the Character Sheet Hook setting in Item Macro enabled, create and run (by clicking the item) an Item Macro on the item like:

const use = await item.use();
if (!use) return;
ui.notifications.warn("steve");

A dialog will appear to prompt "Consume Available Usage?" Either hit "Use Ability" with the box checked, unchecked, or simply close the dialog--regardless, a second dialog will appear to prompt "Consume Available Usage?". At this point, hitting "Use Ability" will fire the macro and print the chat message.

This is contrary to behavior in dnd5e 2.4.X, wherein the above would result in a single "Consume Available Usage?" prompt being rendered, and the macro correctly executing or not based on whether the user hits "Use Ability" or closes the dialog.

Environment Info Foundry Version 11 Stable Build 315 dnd5e Version 3.0.1 Active Modules 1 (Item Macro)

Forien commented 9 months ago

Should be adressed in v1.11.0.

Please note that I had to change how Item Macro is called and how it interacts with the system, and usage of item.use() is disabled in favor of return true; or item.use({}, {skipItemMacro: true}).

You can read more here: https://github.com/Foundry-Workshop/Item-Macro/releases/tag/v1.11.0

Closing for now, feel free to comment or contact me if you encounter any issues.