Skip to content

Macros and API

Eric Teninty edited this page Dec 2, 2026 · 1 revision

Hotbar macros

Drag any of these onto Foundry's macro hotbar to make a macro:

  • an item, which uses it;
  • an attack row, which rolls the attack;
  • an action row, which uses the action.

Shift-click a macro to skip the roll dialog.

Each user gets a macro of their own, so a player's hotbar never holds the GM's macro. They are script macros: a player whose role lacks Foundry's Use Script Macros permission gets a warning instead. The GM can allow it under Configure Permissions.

game.crawlspace

Script macros can call the system through game.crawlspace:

Function Does
useAttack(actorUuid, rowId, {fast}) Rolls an Attacks row. fast: true skips the dialog. Hotbar macros for attack rows call this.
useAction(actorUuid, rowId, {fast}) Uses an Actions row.
declareAttack() Opens the mob attack declaration for the current combat.
openUpkeep(actor?) Opens upkeep: Party Upkeep, or one crawler's upkeep.
performUpkeep(uuids, kind, hours = 1, skipTime = false) GM only. Runs an upkeep action for the crawlers with these UUIDs. kind is one of short, long, full, hourly, safeRoom, session or floor. Rests advance the clock unless skipTime is true.
rest(actor, kind, hours = 1, {advance}) One crawler's rest recovery.
openTime() Opens Time & Timers.
advanceTime(seconds) GM only, outside combat. Advances the world clock.
settleTime() Waits for recovery triggered by the last clock change to finish.
openGrinding(actors, hours = 1) Opens grinding for these crawlers.
openAwards(actors) Opens Crawler Awards for these crawlers.
openBuilder() Opens the character builder.
importFile(file) Imports a CrawlSpace export from a File, Blob or bytes.
importCharacter(json) Imports one CrawlSpace character from its parsed JSON.
importHomebrew(json, fileName?) GM. Imports homebrew races, classes, skills and spells with their rules (see Importing homebrew).
fillActorDamage(actor) Fills missing skill and spell damage from the compendiums.
calibrateGrid(scene?) Starts grid calibration on a scene (the viewed one by default).
startBossBattle() GM. Shows the boss battle splash to everyone (see Boss Battles).
openHeadshotMaker(actor) Opens the headshot maker for an actor.
openTokenMaker(actor, {source, foreground, pixelArt}) Opens the token maker. source is the image to start from. foreground is the same picture on transparency, used as the creature's own layer for pop-out art. pixelArt: true starts it in pixel-art mode (otherwise only GIF images do).
openParties() GM. Opens the Parties window.
openNeighborhoodBuilder() Opens the neighborhood builder (see Atlas Journals).
createBlankJournal(tier, folderId?) Makes a blank neighborhood, borough, city, province, country or floor page.
compileFieldGuide(boroughPage) Compiles a borough's Field Guide journal and item.
openCrafting(actor?) Opens the crafting window, for this crawler or the user's own.
openBestiary(actor?) Opens the bestiary. Given an actor, its cards can set that actor's portrait or token.
bestiary.registerSource(source) For modules: adds a source of creatures to the bestiary, with its own toggle. bestiary.sources() lists them.
encounter.open() Opens the Encounter Tuner.
encounter.mobCount(partySize, threat) Mobs for a fight: threat is weak, moderate, strong or overwhelming. encounter.partySize() is the players' party size, encounter.enabled() whether the tool is on.
skillCreator.open({actor}) Opens the Skill Creator. With an actor, the skill goes onto that crawler, and its owner may use it; without one, GM only. skillCreator.randomHobby() picks a hobby.
leaderboard.open() Opens Leaderboard & Population.
leaderboard.announcePopulation(floor) Posts the crawlers-remaining card for a floor.
minimapMarker.of(token) What a token shows as on the minimap: {category, shape, color}.
config The system's configuration: damage types, debuffs, phases and so on.

Example: a long rest for every selected crawler token.

const uuids = canvas.tokens.controlled.map((token) => token.actor?.uuid).filter(Boolean)
await game.crawlspace.performUpkeep(uuids, 'long')

The easiest way to get a row macro is to drag the row to the hotbar, then edit the macro it makes.

Actors and items are ordinary Foundry documents. Use Foundry's API for everything else: actor.update, actor.createEmbeddedDocuments, fromUuid and so on. Owned items also have item.use({fast}), which is what item hotbar macros call.

Clone this wiki locally