Skip to content

Store macros in your items, execute them from your character sheet or from your favorite automation module!

License

Notifications You must be signed in to change notification settings

Foundry-Workshop/Item-Macro

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Item Macro

GitHub release (latest SemVer) Foundry Core Compatible Version Foundry Core Compatible Version
License GitHub Releases GitHub All Releases
Discord Patreon Ko-Fi

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.

Installation

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.

  1. Inside Foundry's Configuration and Setup screen, go to Add-on Modules
  2. Click "Install Module"
  3. 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.

Usage

Once activated, open an Item Sheet, click on the Item Macro button to open the Macro window. In Action

Various different settings will change the way Item Macro interacts with the game server. In Action

With no settings enabled, you can still execute the macro that is saved in the item, perfect for macros! In Action

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)

Added Item Functionality

  1. Item.hasMacro() => returns boolean on if the item has a macro command
  2. Item.getMacro() => returns Macro instance, if the item has a macro command
  3. Item.setMacro(Macro) => overwrites and saves given Macro to the Item
  4. Item.executeMacro(...args) => executes Macro command, giving item, speaker, actor, token, character, and event constants. This is recognized as the macro itself. Pass an event as the first argument.

Added System Functionality

Dungeons & Dragons Fifth Edition

Starting from v1.11.0, Item Macro changed how it's supporting DnD 5e (3.0.0+). Here is the breakdown:

  1. 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
  2. Character Sheet Hook and Right Click Override settings for dnd5e are now removed in favor of single Override default macro execution
  3. Item Macros that you wish to still execute "standard" item.use() must now do it in one of two ways:
    1. Return true from macro, or
    2. Call item.use({}, {skipItemMacro: true}) instead (passing skipItemMacro = true in options argument)

Simple Worldbuilding

  • 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.

Contact

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.

Support

If you wish to support module's development, please consider becoming my Patreon or donating through Paypal or Ko-Fi. Thanks!

Acknowledgements

  • 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!

License

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.

About

Store macros in your items, execute them from your character sheet or from your favorite automation module!

Resources

License

Stars

Watchers

Forks

Languages

  • JavaScript 96.3%
  • HTML 3.7%