7 Library and Assignments
Flaig edited this page 2026-10-18 20:53:57 +02:00
This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Library and Assignments

World library

Library entries belong to the world, not to a character or to Foundry's Macro directory. Folders and tags organize them, and the search matches names, folders and tags. The usage count on each entry, and Used by in the editor, show which item actions use it. Folders remember whether they are collapsed; the button next to the search collapses or expands them all.

Right-click an entry to duplicate it (to give two items different looks), move it to another folder, export it, assign it to many items or delete it. Right-click a folder to rename it, add a subfolder or delete it with everything in it (after a confirmation that names the affected item actions). Drag a folder onto another folder to nest it, or a macro onto a folder to move it there; drop on the free space of the list for the top level. An empty folder can also be removed with the × on its row, and the broom button next to the search removes all empty folders at once.

Import reads one JSON file at a time, and a file can hold any number of entries. Entries are merged by ID: when some already exist, you choose whether to replace them or keep yours and import only the new ones. Malformed entries are skipped. Export all writes the whole library, so you can move it to another world or keep a backup. Item assignments are stored on the items and are not part of a library export.

Macro code runs as ordinary Foundry JavaScript with the permissions of the user who plays it. Read imported code before you run it.

Bulk selection and deletion

Tick macros, or tick a folder to select it, its subfolders and every matching macro inside them. Select results selects everything that matches the current search, including entries in collapsed folders. Changing the search clears the selection, and so does Clear.

Delete selected (the bin button) shows how many macros and item actions are affected. Selected folders are removed with them, each one only if no macros are left in it. Cancel keeps both the selection and your editor draft. Deletion is permanent, so export the library first if you want a backup. Item actions that used a deleted macro play nothing until you reassign them or import the macro again. If you were editing one of the deleted macros, its unsaved changes are discarded only after you confirm; drafts of other macros stay.

If another editor changes one of the selected macros while the confirmation is open, the whole deletion is rejected: check the selection and try again. Folders that became empty stay until you remove them.

Editor

A macro's assets and behavior live in its code; there is no separate parameter panel and no per-item override. Change the constants at the top, or duplicate the entry when you need a variant.

The Variables and helpers panel lists what a macro can use, in groups marked by their source: SWADE (the action's data in swade.* and each target's fields), Trappings (sequence(), preview, fx), common Sequencer calls and, when TokenMove is active, its token moves and easings. Search it (Enter inserts the first hit, Escape clears), collapse groups, and click a row to insert it at the cursor. Rows that have no value for the macro's event are dimmed, rows your code uses get a dot, and after Play each swade.* and t.* row shows the value it had. Code that uses TokenMove while TokenMove isn't active is flagged above the editor.

Save with Save or Ctrl+S. Code with a syntax error can still be saved, with a warning, so you don't lose unfinished work; fix the error before you assign the macro. You are asked before unsaved changes are discarded, for example when you switch entries or close the window. With Replay on save ticked, every successful save without syntax errors plays the preview again.

Drag the inner edge of the library or preview pane to resize it, double-click the edge to reset its width, or hide a pane with the arrow buttons. The layout is remembered on your computer.

Asset picker

Insert asset searches the installed Sequencer databases. Filter by pack and media type; color variants of one asset share a tile. Videos play while their tile is visible, sound tiles have a listen button, and your recent picks are listed at the top.

With the cursor between empty quotes, only the chosen key is inserted; anywhere else it is inserted with quotes. The picker lists database entries only: for a media file outside a database, type its file path into the constant yourself. The warning about keys missing from the Sequencer database helps you spot packs that aren't installed; it does not check file paths or whether the art suits the macro.

Preview controls

Play runs the code in the editor with preview = true, your selected token as the caster and your current targets. As item plays the preview as if one of the selected token's items fired: it fills swade.item, swade.actor, swade.attack and swade.power, which changes the animation only where the macro reads them. The outcome buttons force a result: Hit, Raise, Near miss, Wild miss, Critical Failure or Fizzle (a failed power activation).

Template previews create a temporary template, which stays while effects attached to it are playing and is removed afterwards. Closing the editor removes any preview template that is left, so a preview of a lasting area attached to its template lasts until you close the editor; the Lasting area starter plays its preview for a fixed time instead. The active GM also removes preview templates that a disconnected client left behind.

Previews are shared, not private rehearsals. A macro can call play({ local: true }) to keep its Sequencer effects on your screen, but fx.shake and fx.nudge always play for everyone.

Item assignment rows

Row Plays when
Main trait and additional trait actions The trait roll from the item's SWADE card
Damage (with its formula) and additional damage actions The damage roll from the item's SWADE card
Template placed A template is placed with the item's template button
Effect applied One of the item's active effects is dropped onto a token, actor sheet or combatant (from the chat card or the item sheet), or an active effect with the item as its origin is created
Consumable used SWADE uses up the consumable

Each row holds a macro, Same as … another row of the same kind, or None. The macro list is grouped by library folder. Same as … offers only rows that resolve to a macro without a loop, and rejects an invalid reference if the assignment changes while the editor is open. Older references that loop or point to a deleted macro play nothing. The code button opens the assigned macro in the editor, and the play button previews it with this item's context. The Animations header control appears on SWADE item sheets and on SWADE Folio's sheets, except for items in locked compendiums.

Bulk assignment

Right-click a library entry and choose Assign to…. Pick world items, the items of world actors, one actor, or an unlocked Item or Actor compendium. Filter by item type, by name or SWADE ID, and by action, tick the items you want and press Assign.

Existing assignments stay unless Replace existing assignments is ticked; every other eligible row gets the macro directly. Rows of other action kinds are left alone. The changes are written in batches, so an error partway through can leave some items assigned: check them before you try again.