module

Scriptable Items for dnd5e

Endorsements
0
Installs
0.01%
Comments
0
Latest version1.3.0
Minimum Core12
Compatible Core12
Last updated3 months ago
Created5 months ago
Authors
Languages English
Systems Dnd5e
Project source Project URL
Report bugs Bug tracker URL
Changelog Changelog URL
License License URL

Scriptable Items

A module for the Foundry dnd5e system, which allows you to attach one or more JS scripts to an item. Each of these scripts can have multiple triggers that determine when or how the script is executed.

After installing this module, you can find a 'Scriptable Items' button in any item sheet header. Clicking this button opens an overview where you can edit that item's scripts.

A script receives the following arguments (very similar to a normal Foundry macro!) when run:

  • this - is a copy of the Script itself
  • item - the item containing the script
  • speaker - speaker data of the item's Actor or the currently selected token or user's character
  • actor - actor from the speaker data, usually the item's owner
  • token - token from the speaker data
  • character - the current user's character or null
  • trigger - the trigger of the script, such as a button press or on item use. Is equal to debug when ran from the script's config sheet.
  • optional - an object containing additional, optional arguments
    • optional.message - The chat message containing the clicked button (if trigger === "button" is true)

Available triggers are currently:

  • preUseItem - When using the item (Hook is dnd5e.preUseItem)
    • If you want to also have normal item usage, you can return true from the script
    • If you want to use item.use() inside the script, you can use item.use({}, {skipScripts: true})
  • button A button in the item's chat card that triggers the script when clicked
  • addToActor When the item is added to an actor
  • removeFromActor When the item is removed from an actor

For more information and submitting issues as well as pull requests, visit the modules page at https://github.com/FurtherV/scriptable-items.

Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x