{ "name": "Request Roll (MATT)", "type": "script", "scope": "global", "author": "Aqnn9hCDQPbyTWiq", "img": "icons/sundries/gaming/dice-runed-tan.webp", "command": "// This will request rolls from the tile's current collection, assuming\n// that collection is tokens.\n// call this from MATT's Run Macro with the following arguments,\n// 1. roll type: \"attribute\" or \"skill\" (in double quotes)\n// 2. roll description: attribute or skill name as you want\n// it to appear in the request title (in double quotes), eg \"Strength\"\n// or \"Common Knowledge\"\n// 3... paired arguments, each pair a modifier and a description,\n// eg: '-2 \"Noxious Fog\" +1 \"Bless Aura\"'\n// so an entire arguments box in MATT may look like this:\n// \"skill\" \"Common Knowledge\" -2 \"Ugly Wallpaper\" +1 \"Rousing Speech\"\n\nconst requestRollFromTokens = game.modules.get('swade-mb-helpers').api.requestRollFromTokens\nconst tokens = arguments[0].value.tokens.map(t => canvas.tokens.get(t.id))\nconst rolldata = args\n\nasync function main () {\n if (tokens.length < 1) {\n return\n }\n const rollType = rolldata.shift()\n const rollDesc = rolldata.shift()\n const options = { targetNumber: 4 }\n const mods = []\n while (rolldata.length > 0) {\n const value = Number(rolldata.shift())\n const label = rolldata.shift()\n mods.push({ label, value })\n }\n if (mods.length > 0) {\n options.mods = mods\n }\n\n requestRollFromTokens(tokens, rollType, rollDesc, options)\n}\n\nmain()", "folder": null, "ownership": { "default": 0, "R9ZgY0IvWl8ovIuT": 3, "Aqnn9hCDQPbyTWiq": 3 }, "flags": { "core": {} }, "_stats": { "systemId": "swade", "systemVersion": "3.2.5", "coreVersion": "11.315", "createdTime": 1700430548162, "modifiedTime": 1707686618258, "lastModifiedBy": "Aqnn9hCDQPbyTWiq" }, "_id": "LuCxWluGiG354nP3", "sort": 400000, "_key": "!macros!LuCxWluGiG354nP3" }