diff --git a/packs/macros-misc.db b/packs/macros-misc.db index 6d86136..ea302a7 100644 --- a/packs/macros-misc.db +++ b/packs/macros-misc.db @@ -22,7 +22,7 @@ {"_id":"fdXN3rcX29ZkRRL2","name":"Tile Toggle Locked Status","type":"script","author":"y5gmtwxmW3A5ZuOP","img":"icons/svg/dice-target.svg","scope":"global","command":"//Simple macro to loop through ALL SELECTED TILES and toggle their locked status.\n//In other words:\n //If an individual tile is unlocked, this macro will lock it.\n //If an individual tile is locked, this macro will unlock it.\n\nconst tiles = canvas.background.controlled.length ? canvas.background.controlled : canvas.foreground.controlled;\nconst updates = tiles.map(tile => ({ _id: tile.id, locked: !tile.data.locked }));\ncanvas.scene.updateEmbeddedDocuments(\"Tile\", updates);","folder":null,"sort":0,"permission":{"default":0,"y5gmtwxmW3A5ZuOP":3},"flags":{}} {"name":"Scale Grid Size To Inches","permission":{"default":0,"y5gmtwxmW3A5ZuOP":3},"type":"script","flags":{},"scope":"global","command":"/**\nAuthor: @stan#1549 (github.com/janssen-io)\n\nDescription:\nThe first time you click the macro, it will prompt you for your screen size (diagonal).\nClicking the macro a second time will automatically scale to 1\"/grid unit (square/hex).\nShift-click the macro to update this value.\n\nNote:\nThe screen size is saved per client. So opening the macro on another device for the first time, will make it prompt for the screen size again.\n */\n\nfunction showDialog(inches, resolve) {\n new Dialog({\n content: `Screen size (inches): `,\n default: 'scale',\n buttons: {\n scale: {\n label: 'Scale',\n callback: html => resolve(+html.find('input').val())\n }\n }\n }).render(true);\n}\n\nfunction scale(screenSizeInches) {\n const diagonal = Math.sqrt(screen.width ** 2 + screen.height ** 2);\n const ppi = diagonal / screenSizeInches;\n console.log(`PPI: ${screenSizeInches}\" screen | ${canvas.grid.size}px per grid unit | ${ppi}px per inch | Scaling to: ${ppi / canvas.grid.size}`);\n canvas.animatePan({ scale: ppi / canvas.grid.size });\n}\n\nconst key = 'stan#1549.scale.screenSize';\nconst storedScreenSize = localStorage.getItem(key);\nconst shouldUpdatePPI = !storedScreenSize || event.shiftKey;\n\nconst getScreenSize = new Promise(resolve => {\n if (shouldUpdatePPI) {\n showDialog(storedScreenSize || 42, resolve);\n } else {\n resolve(storedScreenSize);\n }\n});\n\ngetScreenSize.then(inches => {\n scale(inches);\n localStorage.setItem(key, inches);\n});\n\n\n","author":"y5gmtwxmW3A5ZuOP","img":"icons/svg/dice-target.svg","actorIds":[],"_id":"gq8UDK94ykfMViNT"} {"_id":"iLlJKBjrtOMNxlv6","name":"Tile Toggle Hidden Status","type":"script","author":"y5gmtwxmW3A5ZuOP","img":"icons/svg/dice-target.svg","scope":"global","command":"// Simple macro to loop through ALL SELECTED TILES and toggle whether or not they are hidden.\n// Uncomment line 8 or 9 to change behavior to hide / show all tiles instead of toggle\nconst tiles = canvas.background.controlled.length ? canvas.background.controlled : canvas.foreground.controlled;\nconst updates = tiles.map(tile => {\n let v;\n v = !tile.data.hidden; // Toggle visibility for each tile\n // v = false; // Hide all selected tiles\n // v = true; // Show all selected tiles\n return{ _id: tile.id, hidden: v };\n});\ncanvas.scene.updateEmbeddedDocuments(\"Tile\", updates);","folder":null,"sort":0,"permission":{"default":0,"y5gmtwxmW3A5ZuOP":3},"flags":{}} -{"name":"Rebind Token Actors","type":"script","author":"y5gmtwxmW3A5ZuOP","img":"icons/svg/dice-target.svg","scope":"global","command":"// Rebinds the actor for all selected tokens.\n// Requirements: \n// - the actor must be present in the \"Actor Directory\"\n// - actor name can't contain either '/' or '.'\n\n// Any Token with an altered name and an img path attached \n// will look up the default actor name via provided URL.\n// Very useful when using eg. Plutonium in combination with\n// 5e.tools for importing creatures or other actors.\nlet tname, results, str, arr;\n\nconst dir = new ActorDirectory();\n\nfor (const token of canvas.tokens.controlled) {\n tname = token.name;\n results = dir.documents.filter(obj => {if(obj.data.name === tname){return obj;}})\n if(results.length === 0){\n if(token.data.img){\n// Possible optimization: regEx look-up for any word character pre '.' and post '/'\n str = token.data.img;\n arr = str.split('/');\n tname = arr[arr.length-1].split('.')[0];\n results = dir.documents.filter(obj => {if(obj.data.name === tname){return obj;}})\n }\n }\n if(results.length > 0){\n await token.update({'actorId':results[0].data._id});\n }\n}","folder":null,"sort":0,"permission":{"default":0,"y5gmtwxmW3A5ZuOP":3},"flags":{"core":{"sourceId":"Macro.T6rBYAF9cEQs1Tvj"}},"_id":"ie5zQi7onuxJezxN"} +{"name":"Rebind Token Actors","type":"script","author":"y5gmtwxmW3A5ZuOP","img":"icons/svg/dice-target.svg","scope":"global","command":"// Rebinds the actor for all selected tokens.\n// Requirements: \n// - the actor must be present in the \"Actor Directory\"\n// - actor name can't contain either '/' or '.'\n\n// Any Token with an altered name and an img path attached \n// will look up the default actor name via provided URL.\n\nconst dir = new ActorDirectory();\n\nfor (const token of canvas.tokens.controlled) {\n tname = token.name;\n results = dir.documents.filter(obj => {if(obj.data.name === tname){return obj;}})\n if(results.length === 0){\n if(token.data.img){\n// Possible optimization: regEx look-up for any word character pre '.' and post '/'\n str = token.data.img;\n arr = str.split('/');\n tname = arr[arr.length-1].split('.')[0];\n results = dir.documents.filter(obj => {if(obj.data.name === tname){return obj;}})\n }\n }\n if(results.length > 0){\n await token.update({'actorId':results[0].data._id});\n }\n}","folder":null,"sort":0,"flags":{"core":{"sourceId":"Macro.T6rBYAF9cEQs1Tvj"}},"_id":"ie5zQi7onuxJezxN","ownership":{"default":0,"y5gmtwxmW3A5ZuOP":3},"_stats":{"systemId":"dnd5e","systemVersion":"2.0.3","coreVersion":"10.291","createdTime":null,"modifiedTime":1670654636695,"lastModifiedBy":"QMyNqXGlX06pnWfY"}} {"_id":"lPEdDL4uqxRFfW9x","name":"Format All Scene Notes","type":"script","author":"y5gmtwxmW3A5ZuOP","img":"icons/svg/dice-target.svg","scope":"global","command":"const updates = canvas.notes.placeables.map(n => ({\n _id: n.id,\n \n /* READ THIS MESSAGE!**format_all_scene_notes.js**\nconst updates = canvas.notes.placeables.map(n => ({\n _id: n.id,\n \n /* READ THIS MESSAGE!\n Define new note properties\n double right-click a map pin for a list of valid fonts, icons, etc. \n remove the // from front of the line to allow that setting to be updated. \n */\n\n //fontFamily: \"Signika\", \n //fontSize: 48,\n //icon: \"icons/svg/anchor.svg\", // replace the name of the icon, for example, the anchor would be \"icons/svg/anchor.svg\" \n //iconSize: 40,\n //iconTint: null, // if not white hex code like: \"#AB8345\"\n //textAnchor: CONST.TEXT_ANCHOR_POINTS.CENTER, // textAnchor controls the location of the text in relation to the icon. other options are .BOTTOM, .TOP. LEFT . RIGHT\n //textColor: \"#FFFFFF\",\n //x: 2450, // absolute location on the canvas.\n //y: 1250, // absolute location on the canvas.\n}));\ncanvas.scene.updateEmbeddedDocuments(\"Note\", updates);\n Define new note properties\n double right-click a map pin for a list of valid fonts, icons, etc. \n remove the // from front of the line to allow that setting to be updated. \n */\n\n //fontFamily: \"Signika\", \n //fontSize: 48,\n //icon: \"icons/svg/anchor.svg\", // replace the name of the icon, for example, the anchor would be \"icons/svg/anchor.svg\" \n //iconSize: 40,\n //iconTint: null, // if not white hex code like: \"#AB8345\"\n //textAnchor: CONST.TEXT_ANCHOR_POINTS.CENTER, // textAnchor controls the location of the text in relation to the icon. other options are .BOTTOM, .TOP. LEFT . RIGHT\n //textColor: \"#FFFFFF\",\n //x: 2450, // absolute location on the canvas.\n //y: 1250, // absolute location on the canvas.\n}));\ncanvas.scene.updateEmbeddedDocuments(\"Note\", updates);","folder":null,"sort":0,"permission":{"default":0,"y5gmtwxmW3A5ZuOP":3},"flags":{"core":{"sourceId":"Macro.yBeuLYd6wNuX6JHQ"}}} {"_id":"mzkDNKmsOb9WwpIO","name":"Fine Tile Control","type":"script","author":"y5gmtwxmW3A5ZuOP","img":"icons/svg/dice-target.svg","scope":"global","command":"// Fine Tile Control //\n\n// This is a series of 6 macros that you must paste individually into a new\n// Hot Bar Macro Sheet and save. The Hot Bar number is used to activate the macro.\n// Hold down the Control key to halve the distance increment from 1 to 0.5.\n// CAUTION: If the ctrl key doesn‘t check your operating system and/or move the\n// macro to another cell.\n// NOTE: Any locked tiles are ignored.\n\n// Move Up\n// By @cole$9640\n\nconst amount = event.ctrlKey ? -0.5 : -1;\nconst tiles = canvas.background.controlled.length === 0 ? canvas.foreground.controlled : canvas.background.controlled;\nif (tiles.length) {\n const updates = tiles\n .filter((tile) => !tile.data.locked)\n .map((tile) => ({\n _id: tile.id,\n y: tile.y + amount,\n }));\n canvas.scene.updateEmbeddedDocuments(\"Tile\", updates);\n} else {\n ui.notifications.notify(\"Please select at least one tile.\");\n}\n\n// Move Down\n// By @cole$9640\n\nconst amount = event.ctrlKey ? 0.5 : 1;\nconst tiles = canvas.background.controlled.length === 0 ? canvas.foreground.controlled : canvas.background.controlled;\nif (tiles.length) {\n const updates = tiles\n .filter((tile) => !tile.data.locked)\n .map((tile) => ({\n _id: tile.id,\n y: tile.y + amount,\n }));\n canvas.scene.updateEmbeddedDocuments(\"Tile\", updates);\n} else {\n ui.notifications.notify(\"Please select at least one tile.\");\n}\n\n// Move Right\n// By @cole$9640\n\nconst amount = event.ctrlKey ? 0.5 : 1;\nconst tiles = canvas.background.controlled.length === 0 ? canvas.foreground.controlled : canvas.background.controlled;\nif (tiles.length) {\n const updates = tiles\n .filter((tile) => !tile.data.locked)\n .map((tile) => ({\n _id: tile.id,\n x: tile.x + amount,\n }));\n canvas.scene.updateEmbeddedDocuments(\"Tile\", updates);\n} else {\n ui.notifications.notify(\"Please select at least one tile.\");\n}\n\n// Move Left\n// By @cole$9640\n\nconst amount = event.ctrlKey ? -0.5 : -1;\nconst tiles = canvas.background.controlled.length === 0 ? canvas.foreground.controlled : canvas.background.controlled;\nif (tiles.length) {\n const updates = tiles\n .filter((tile) => !tile.data.locked)\n .map((tile) => ({\n _id: tile.id,\n x: tile.x + amount,\n }));\n canvas.scene.updateEmbeddedDocuments(\"Tile\", updates);\n} else {\n ui.notifications.notify(\"Please select at least one tile.\");\n}\n\n// Rotate Left\n// Original by @Norc$5108, updated and refined by @cole$9640 & @Drunemeton$7955\n\nconst amount = event.ctrlKey ? -0.5 : -1;\nconst tiles = canvas.background.controlled.length === 0 ? canvas.foreground.controlled : canvas.background.controlled;\nif (tiles.length) {\n const updates = tiles\n .filter((tile) => !tile.data.locked)\n .map((tile) => ({\n _id: tile.id, \n rotation: tile.data.rotation + amount \n }));\n canvas.scene.updateEmbeddedDocuments(\"Tile\", updates);\n} else {\n ui.notifications.notify(\"Please select at least one tile.\");\n}\n\n// Rotate Right\n// Original by @Norc$5108, updated and refined by @cole$9640 & @Drunemeton$7955\n\nconst amount = event.ctrlKey ? 0.5 : 1;\nconst tiles = canvas.background.controlled.length === 0 ? canvas.foreground.controlled : canvas.background.controlled;\nif (tiles.length) {\n const updates = tiles\n .filter((tile) => !tile.data.locked)\n .map((tile) => ({\n _id: tile.id, \n rotation: tile.data.rotation + amount \n }));\n canvas.scene.updateEmbeddedDocuments(\"Tile\", updates);\n} else {\n ui.notifications.notify(\"Please select at least one tile.\");\n}","folder":null,"sort":0,"permission":{"default":0,"y5gmtwxmW3A5ZuOP":3},"flags":{}} {"_id":"qcWEVrOYfJAOa5Rr","name":"Rolltables","type":"script","author":"y5gmtwxmW3A5ZuOP","img":"icons/svg/dice-target.svg","scope":"global","command":"/* \n * Macro: GeekDad's Table Roller\n * Version: 2\n * Updated: 23-12-2021 by Freeze\n * Description: A nice friendly Better Tables compatible table roller that can draw mass quantities from tables much faster than the UI.\n*/\n\nfunction getTableNames() {\n let tables = [];\n game.tables.forEach(table => {\n tables.push({ key: table.id, name: table.name });\n });\n\n return tables;\n}\n\nasync function rollOnTable(tableKey, numRolls, betterTableState) {\n let table = game.tables.get(tableKey);\n await table.reset();\n if (game.betterTables) {\n let tableType = table.getFlag(\"better-rolltables\", \"table-type\");\n let originalAmount = table.data[\"loot-rolls-amount-input\"];\n await table.update({\"loot-rolls-amount-input\": numRolls});\n switch (betterTableState) {\n case 1:\n await game.betterTables.generateLoot(table);\n break;\n case 2:\n await game.betterTables.addLootToSelectedToken(table);\n break;\n default:\n if (tableType === \"loot\") {\n await game.betterTables.generateChatLoot(table);\n } else {\n await game.betterTables.betterTableRoll(table);\n }\n break;\n }\n await table.update({\"loot-rolls-amount-input\": originalAmount});\n } else {\n table.drawMany(numRolls);\n }\n}\n\nlet tables = getTableNames();\n\nlet content = `
\n \n


`\n\nif (game.betterTables) {\n content += `

Better Tables Options

\n \n
\n \n
\n \n
\n`\n}\n\ncontent += `

`\n\n new Dialog({\n title: `GeekDad's Table Roller`,\n content: content,\n buttons: {\n yes: {\n icon: \"\",\n label: \"Roll it\",\n callback: (html) => {\n let tableKey = html.find(\"select[name='output-tableKey']\").val();\n let numRolls = html.find(\"input[name='output-numberRolls']\").val();\n let betterTableState = 0;\n if (html.find(\"input[name='output-addToActor']:checked\").length > 0) {\n let radioVal = html.find(\"input[name='output-addToActor']:checked\").val();\n betterTableState = radioVal == \"onlyToChat\" ? 0 : \"tableActor\" ? 1 : 2;\n }\n rollOnTable(tableKey, numRolls, betterTableState);\n }\n },\n no: {\n icon: \"\",\n label: 'Cancel'\n }\n },\n default: \"yes\"\n }).render(true);","folder":null,"sort":0,"permission":{"default":0,"y5gmtwxmW3A5ZuOP":3},"flags":{"core":{"sourceId":"Macro.u3zoCoIPIcBWb0wO"}}} @@ -33,4 +33,3 @@ {"name":"Show Modules","permission":{"default":0,"y5gmtwxmW3A5ZuOP":3},"type":"script","flags":{},"scope":"global","command":"/**\n * Show Modules - Shows currently installed modules in foundry. Added on behalf of @vance\n */\nlet mods = '';\ngame.modules.forEach(m => {\n let a = m.active ? 'Enabled' : 'Disabled';\n mods = mods.concat(`${m.id}: ${a}\\n`);\n});\n\nlet d = new Dialog({\n title: `Enabled Mods`,\n content: ``,\n buttons: {\n copy: {\n label: `Copy to clipboard`,\n callback: () => {\n $(\"#modslist\").select();\n document.execCommand('copy');\n }\n },\n close: {\n icon: \"\",\n label: `Close`\n },\n },\n default: \"close\",\n close: () => {}\n});\n\nd.render(true);","author":"y5gmtwxmW3A5ZuOP","img":"icons/svg/dice-target.svg","actorIds":[],"_id":"u71xIHwO8uVaLS8o"} {"_id":"wosXzUFEMQLD84so","name":"Ambient Light Quick Edit","permission":{"default":0,"y5gmtwxmW3A5ZuOP":3},"type":"script","flags":{},"scope":"global","command":"let macroName = \"AmbientLight QuickEditor\"\nlet macroEndLog = \"---------------------------------------------\"\n\nlet i=0;\nlet lights = canvas.lighting.objects.children;\nlet lightSelected = lights[0];\nlet selectOptions = \"\";\nlet lightSelectedAngle = 0;\nlet lightSelectedBright = 0;\nlet lightSelectedDim = 0;\nlet lightSelectedRotation = 0;\nlet lightSelectedTintAlpha = 1;\nlet lightSelectedTintColor = \"\";\n\nconsole.log(\"---------------------------------------------\");\nconsole.log(`${macroName} by PaperPunk`);\nconsole.log(\"---------------------------------------------\");\nconsole.log(`${macroName} | Start`);\n\nconst drawingDetails = {\n author: game.user._id,\n fillAlpha: 0,\n fillColor: \"#808080\",\n fillType: 1,\n fontFamily: \"FontAwesome\",\n fontSize: 24,\n height: 48,\n hidden: false,\n locked: false,\n rotation: 0,\n strokeAlpha: 1,\n strokeColor: \"#000000\",\n strokeWidth: 2,\n text: i,\n textAlpha: 1,\n textColor: \"#ffffff\",\n type: \"r\",\n width: 48,\n //x: 250,\n x: lightSelected.x-24,\n //y: 250\n y: lightSelected.y+25\n};\n\n//let d = Drawing.create(drawingDetails);\n//d.update({\"x\": lights[i].x-24, \"y\": lights[i].y+25, \"text\": i});\n\nfor (i= 0; i< lights.length; i++) {\n selectOptions += ``;\n}\n\nconst htmlLightSelection = `\n
\n

Select your light.

\n
\n \n \n
\n
\n `;\n\nlet dialogSelector = new Dialog({\n title: `${macroName}`,\n content: htmlLightSelection,\n buttons: {\n confirm: {\n icon: \"\",\n label: `Confirm`,\n callback: htmlLightSelection => { \n lightSelected = (htmlLightSelection.find('[name=\"light-selector\"]')[0].value)\n lightSelectedAngle = lights[lightSelected].data.angle;\n lightSelectedBright = lights[lightSelected].data.bright;\n lightSelectedDim = lights[lightSelected].data.dim;\n lightSelectedRotation = lights[lightSelected].data.rotation;\n lightSelectedTintAlpha = lights[lightSelected].data.tintAlpha;\n lightSelectedTintColor = lights[lightSelected].data.tintColor;\n //console.log(`${macroName} | lightSelected = ${lightSelected}`);\n //console.log(`${macroName} | lightSelectedBright = ${lightSelectedBright}`);\n dialogEditor.render(true);\n }\n },\n cancel: {\n icon: \"\",\n label: `Cancel`,\n callback: () => {\n console.log(`${macroName} | Goodbye`);\n console.log(macroEndLog);\n }\n },\n },\n default: \"cancel\",\n //close: () => console.log(\"AmbientLight QuickEditor | Dialog Window Closed\")\n});\n\nlet dialogEditor = new Dialog({\n title: `${macroName}`,\n content: `

Edit your light.

\n

Emission Angle: ${lightSelectedAngle}

\n

Bright light distance: ${lightSelectedBright}

\n

Dim light distance: ${lightSelectedDim}

\n

Rotation CW from down: ${lightSelectedRotation}

\n

Tint Alpha: ${lightSelectedAngle}

\n

Tint Color HexCode: ${lightSelectedAngle}

`,\n buttons: {\n rot5cw: {\n icon: \"\",\n label: `Rotate 5* CW`,\n callback: () => { \n let rot = lights[lightSelected].data.rotation;\n lights[lightSelected].update({\"rotation\":rot+5});\n dialogEditor.render(true);\n }\n },\n rot15cw: {\n icon: \"\",\n label: `Rotate 15* CW`,\n callback: () => { \n let rot = lights[lightSelected].data.rotation;\n lights[lightSelected].update({\"rotation\":rot+15});\n dialogEditor.render(true);\n }\n },\n rot45cw: {\n icon: \"\",\n label: `Rotate 45* CW`,\n callback: () => { \n let rot = lights[lightSelected].data.rotation;\n lights[lightSelected].update({\"rotation\":rot+45});\n dialogEditor.render(true);\n }\n },\n rot5ccw: {\n icon: \"\",\n label: `Rotate 5* CCW`,\n callback: () => { \n let rot = lights[lightSelected].data.rotation;\n lights[lightSelected].update({\"rotation\":rot-5});\n dialogEditor.render(true);\n }\n },\n rot15ccw: {\n icon: \"\",\n label: `Rotate 15* CCW`,\n callback: () => { \n let rot = lights[lightSelected].data.rotation;\n lights[lightSelected].update({\"rotation\":rot-15});\n dialogEditor.render(true);\n }\n },\n rot45ccw: {\n icon: \"\",\n label: `Rotate 45* CCW`,\n callback: () => { \n let rot = lights[lightSelected].data.rotation;\n lights[lightSelected].update({\"rotation\":rot-45});\n dialogEditor.render(true);\n }\n },\n brightup: {\n icon: \"\",\n label: `Increase Bright by 5`,\n callback: () => { \n let bright = lights[lightSelected].data.bright;\n lights[lightSelected].update({\"bright\":bright+5});\n dialogEditor.render(true);\n }\n },\n brightdown: {\n icon: \"\",\n label: `Decrease Bright by 5`,\n callback: () => { \n let bright = lights[lightSelected].data.bright;\n lights[lightSelected].update({\"bright\":bright-5});\n dialogEditor.render(true);\n }\n },\n brightoff: {\n icon: \"\",\n label: `Remove Bright Light`,\n callback: () => { \n lights[lightSelected].update({\"bright\":0});\n dialogEditor.render(true);\n }\n },\n dimup: {\n icon: \"\",\n label: `Increase Dim by 5`,\n callback: () => { \n let dim = lights[lightSelected].data.dim;\n lights[lightSelected].update({\"dim\":dim+5});\n dialogEditor.render(true);\n }\n },\n dimdown: {\n icon: \"\",\n label: `Decrease Dim by 5`,\n callback: () => { \n let dim = lights[lightSelected].data.dim;\n lights[lightSelected].update({\"dim\":dim-5});\n dialogEditor.render(true);\n }\n },\n dimoff: {\n icon: \"\",\n label: `Remove Dim Light`,\n callback: () => { \n lights[lightSelected].update({\"dim\":0});\n dialogEditor.render(true);\n }\n },\n emit15: {\n icon: \"\",\n label: `Emission Angle 15*`,\n callback: () => { \n lights[lightSelected].update({\"angle\":15});\n dialogEditor.render(true);\n }\n },\n emit45: {\n icon: \"\",\n label: `Emission Angle 45*`,\n callback: () => { \n lights[lightSelected].update({\"angle\":45});\n dialogEditor.render(true);\n }\n },\n emit90: {\n icon: \"\",\n label: `Emission Angle 90*`,\n callback: () => { \n lights[lightSelected].update({\"angle\":90});\n dialogEditor.render(true);\n }\n },\n emit180: {\n icon: \"\",\n label: `Emission Angle 180*`,\n callback: () => { \n lights[lightSelected].update({\"angle\":180});\n dialogEditor.render(true);\n }\n },\n emit270: {\n icon: \"\",\n label: `Emission Angle 270*`,\n callback: () => { \n lights[lightSelected].update({\"angle\":270});\n dialogEditor.render(true);\n }\n },\n emit360: {\n icon: \"\",\n label: `Emission Angle 360*`,\n callback: () => { \n lights[lightSelected].update({\"angle\":360});\n dialogEditor.render(true);\n }\n },\n back: {\n icon: \"\",\n label: `Back`,\n callback: () => dialogSelector.render(true)\n },\n close: {\n icon: \"\",\n label: `Close`\n },\n },\n default: \"close\",\n close: () => {\n console.log(`${macroName} | Goodbye`);\n console.log(macroEndLog);\n }\n});\n\ndialogSelector.render(true);\n","author":"y5gmtwxmW3A5ZuOP","img":"icons/svg/dice-target.svg","actorIds":[]} {"_id":"zsAzgwdGPAeArcIJ","name":"Lock All Doors","type":"script","author":"y5gmtwxmW3A5ZuOP","img":"icons/svg/dice-target.svg","scope":"global","command":"/**\n * Locks all closed doors on the canvas\n * Author: orcnog\n */\n \nawait canvas.walls.updateAll(w => ({ds: w.data.ds === CONST.WALL_DOOR_STATES.CLOSED ? CONST.WALL_DOOR_STATES.LOCKED : CONST.WALL_DOOR_STATES.CLOSED}), w => w.data.door === CONST.WALL_DOOR_TYPES.DOOR && (w.data.ds === CONST.WALL_DOOR_STATES.LOCKED || w.data.ds === CONST.WALL_DOOR_STATES.CLOSED));","folder":null,"sort":0,"permission":{"default":0,"y5gmtwxmW3A5ZuOP":3},"flags":{"core":{"sourceId":"Macro.sSGS2FhGOqiTIpRV"}}} -{"name":"Rebind Token Actors","type":"script","author":"y5gmtwxmW3A5ZuOP","img":"icons/svg/dice-target.svg","scope":"global","command":"// Rebinds the actor for all selected tokens.\n// Requirements: \n// - the actor must be present in the \"Actor Directory\"\n// - actor name can't contain either '/' or '.'\n\n// Any Token with an altered name and an img path attached \n// will look up the default actor name via provided URL.\n\nconst dir = new ActorDirectory();\n\nfor (const token of canvas.tokens.controlled) {\n tname = token.name;\n results = dir.documents.filter(obj => {if(obj.data.name === tname){return obj;}})\n if(results.length === 0){\n if(token.data.img){\n// Possible optimization: regEx look-up for any word character pre '.' and post '/'\n str = token.data.img;\n arr = str.split('/');\n tname = arr[arr.length-1].split('.')[0];\n results = dir.documents.filter(obj => {if(obj.data.name === tname){return obj;}})\n }\n }\n if(results.length > 0){\n await token.update({'actorId':results[0].data._id});\n }\n}","folder":null,"sort":0,"flags":{"core":{"sourceId":"Macro.T6rBYAF9cEQs1Tvj"}},"_id":"ie5zQi7onuxJezxN","ownership":{"default":0,"y5gmtwxmW3A5ZuOP":3},"_stats":{"systemId":"dnd5e","systemVersion":"2.0.3","coreVersion":"10.291","createdTime":null,"modifiedTime":1670654636695,"lastModifiedBy":"QMyNqXGlX06pnWfY"}}