create-macro
Create a world macro hotbar button that runs JavaScript or posts chat text, and optionally pin it to a player's hotbar with ownership in the same call. GM-only.
Instructions
Create a world Macro — a hotbar button. type "script" (default) runs JavaScript as the clicking user (e.g. dnd5e.documents.macro.rollItem("Graze") rolls that item on their assigned character); type "chat" posts its text to chat. Optionally grant a player OWNER access and pin the button to their hotbar (hotbarUser + optional hotbarSlot, default first free slot) in the same call — the way to hand a player a one-click ability. GM-only.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| img | No | Icon path or URL for the hotbar button. Omit for Foundry's stock macro icon. A path that does not resolve on the server is replaced with the stock icon (rule 8) with a warning. | |
| name | Yes | Macro name — the hotbar tooltip and its Macro Directory entry. | |
| type | No | 'script' (default) executes JavaScript; 'chat' posts its text to the chat log. | script |
| owner | No | User id or name granted OWNER on the macro. The hotbarUser is always granted OWNER — pass this only to grant a DIFFERENT user as well. | |
| command | Yes | The macro body. For type 'script': JavaScript run as the clicking user — e.g. dnd5e.documents.macro.rollItem("Graze") rolls the item named Graze on that user's assigned character. For type 'chat': text posted to chat verbatim (inline rolls like [[/roll 1d6]] work). | |
| hotbarSlot | No | Hotbar slot 1–50 (page 1 = slots 1–10). Default: the first free slot. An occupied slot is replaced with a warning. | |
| hotbarUser | No | User id or name whose hotbar gets the button (also granted OWNER so it's theirs to see and edit). Omit to create the macro without pinning it anywhere. |