add MATT request macros
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
// This will request rolls from the tile's current collection, assuming
|
||||
// that collection is tokens.
|
||||
// call this from MATT's Run Macro with the following arguments,
|
||||
// 1. roll type: "attribute" or "skill" (in double quotes)
|
||||
// 2. roll description: attribute or skill name as you want
|
||||
// it to appear in the request title (in double quotes), eg "Strength"
|
||||
// or "Common Knowledge"
|
||||
// 3... paired arguments, each pair a modifier and a description,
|
||||
// eg: '-2 "Noxious Fog" +1 "Bless Aura"'
|
||||
// so an entire arguments box in MATT may look like this:
|
||||
// "skill" "Common Knowledge" -2 "Ugly Wallpaper" +1 "Rousing Speech"
|
||||
|
||||
const requestRollFromTokens = game.modules.get('swade-mb-helpers').api.requestRollFromTokens
|
||||
const tokens = arguments[0].value.tokens.map(t => canvas.tokens.get(t.id))
|
||||
const rolldata = args
|
||||
|
||||
async function main () {
|
||||
if (tokens.length < 1) {
|
||||
return
|
||||
}
|
||||
const rollType = rolldata.shift()
|
||||
const rollDesc = rolldata.shift()
|
||||
const options = { targetNumber: 4 }
|
||||
const mods = []
|
||||
while (rolldata.length > 0) {
|
||||
const value = Number(rolldata.shift())
|
||||
const label = rolldata.shift()
|
||||
mods.push({ label, value })
|
||||
}
|
||||
if (mods.length > 0) {
|
||||
options.mods = mods
|
||||
}
|
||||
|
||||
requestRollFromTokens(tokens, rollType, rollDesc, options)
|
||||
}
|
||||
|
||||
main()
|
||||
Reference in New Issue
Block a user