Skip to content

Instantly share code, notes, and snippets.

@xthesaintx
Created June 13, 2025 21:58
Show Gist options
  • Save xthesaintx/d8a6c467e8b8f782f0bba3ed32a79c54 to your computer and use it in GitHub Desktop.
Save xthesaintx/d8a6c467e8b8f782f0bba3ed32a79c54 to your computer and use it in GitHub Desktop.
Foundry VTT (tested v12) - covert all map notes to tiles, places the icon used as the tile image and links to the journal on a double click using Monk's Active Tiles
const tileSize = 48;
const tileData= canvas.scene.notes.map(e => {
const entryName = e.entry?.name ?? "";
const entryUuid = e.entry?.uuid ?? "";
return {
width: tileSize,
height: tileSize,
x: e.x - tileSize/2,
y: e.y - tileSize/2,
"texture.src": e.texture.src ?? "icons/svg/book.svg",
"flags.monks-active-tiles.name":"",
"flags.monks-active-tiles.active":true,
"flags.monks-active-tiles.record":false,
"flags.monks-active-tiles.restriction":"all",
"flags.monks-active-tiles.controlled":"all",
"flags.monks-active-tiles.trigger":["","dblclick"],
"flags.monks-active-tiles.allowpaused":true,
"flags.monks-active-tiles.usealpha":false,
"flags.monks-active-tiles.pointer":true,
"flags.monks-active-tiles.vision":true,
"flags.monks-active-tiles.active":true,
"flags.monks-active-tiles.pertoken":false,
"flags.monks-active-tiles.minrequired":0,
"flags.monks-active-tiles.cooldown":null,
"flags.monks-active-tiles.chance":100,
"flags.monks-active-tiles.fileindex":-1,
"flags.monks-active-tiles.actions": [{
"action":"openjournal",
"id":foundry.utils.randomID(),
"data.entity.id":entryUuid,
"data.entity.name":entryName,
"data.page": e.pageId ?? "",
"data.subsection":"",
"data.showto":"trigger",
"data.asimage":"false",
"data.permission":"false",
"data.enhanced":"false"
}],
"flags.tagger.tags":"mapnote"
}
});
console.log(tileData)
await TileDocument.createDocuments(tileData, {parent: canvas.scene});
@xthesaintx
Copy link
Author

This will also add the tag "mapnote" to the tiles for added functionality, such as hiding/showing all note tiles.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment