This is a FoundryVTT module for the DnD5e, WFRPP4e, SFRPG, SWADE, Old-School Essentials, Dungeon World, and Simple Worldbuilding (as of now) systems. It allow macros to be saved inside of an item and for various different ways to execute macros.
You can execute the macro from the "item" class using the executeMacro(...args) function, from the character sheet (if the settings are satisfied to do so), from the hotbar using the default rollItemMacro function for your system (if the settings are satisfied to do so), or from token-action-hud.
Item Macro v1.11.0 onwards will not work with DnD 5e 2.4.
If you do not use the newest version of the DnD 5e system, please do not update Item Macro and install v1.10.5 instead using this manifest link.
You can read more about these changes in v1.11.0 Release notes.
- Inside Foundry's Configuration and Setup screen, go to Add-on Modules
- Click "Install Module"
- Install module using one of the two approaches:
- Search for the Module and install using the Module Manager, or
- In the Manifest URL field paste:
https://github.com/Foundry-Workshop/Item-Macro/releases/latest/download/module.json
.
Once activated, open an Item Sheet, click on the Item Macro button to open the Macro window.
Various different settings will change the way Item Macro interacts with the game server.
With no settings enabled, you can still execute the macro that is saved in the item, perfect for macros!
Added context menu support allowing GM users to mass update item-macros on like named items throughout the game! (the context menu is on items in the game directory, will update all item-macros in the item-directory, actor items, and token items)
Item.hasMacro()
=> returns boolean on if the item has a macro commandItem.getMacro()
=> returns Macro instance, if the item has a macro commandItem.setMacro(Macro)
=> overwrites and saves given Macro to the ItemItem.executeMacro(...args)
=> executes Macro command, givingitem
,speaker
,actor
,token
,character
, andevent
constants. This is recognized as the macro itself. Pass an event as the first argument.
Starting from v1.11.0, Item Macro changed how it's supporting DnD 5e (3.0.0+). Here is the breakdown:
- Item Macro now directly listens to
dnd5e.preUseItem
Hook- Because of that, there no longer is distinction between using item from sheet, macro or any other way
- Because of that, using plain
item.use()
in Item Macro is now disabled as it can lead to uncontrolled infinite loops - Since good practice dictates that all 3rd party modules, including custom sheets, should make use of
item.use()
, this means that all of them should now be supported by default
Character Sheet Hook
andRight Click Override
settings for dnd5e are now removed in favor of singleOverride default macro execution
- Item Macros that you wish to still execute "standard"
item.use()
must now do it in one of two ways:- Return
true
from macro, or - Call
item.use({}, {skipItemMacro: true})
instead (passingskipItemMacro = true
inoptions
argument)
- Return
- Item names on actor sheets have been converted to rollable links that will execute the macro attached to the item when the "Enable Character Sheet Hook" is enabled.
- Item names will now highlight on hover to indicate this added functionality.
- Dragging an item to the hotbar will create a macro utilizing an added system helper
game.worldbuilding.rollItemMacro(itemNameString)
. - Dropping formula-type item attributes will continue to create the default
new Roll
system macro.
For questions, feature requests, or bug reports, feel free to contact me on the Foundry Discord (forien
) or open an issue here directly.
You are also welcome to join my Discord where you can talk about this and other Foundry modules.
If you wish to support module's development, please consider becoming my Patreon or donating through Paypal or Ko-Fi. Thanks!
- Big shoutout to Kekilla, the original author, for making this module!
- Thanks to Honeybadger for contributions and keeping module functional
- Thanks to kgar for contributing compatibility with his
Tidy 5e Sheet
module!
This Foundry VTT module, written by Kekilla, is licensed under a MIT License.
This work is licensed under Foundry Virtual Tabletop EULA - Limited License Agreement for module development.