Begin working on an attempt to make the required setting, but be blocked by Foundry for listening to open/close events on the prose-mirror editor
This commit is contained in:
parent
703dc83681
commit
f8c21ac8d8
6 changed files with 82 additions and 1 deletions
34
scripts/macros/testRequest.mjs
Normal file
34
scripts/macros/testRequest.mjs
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
const rolls = {};
|
||||
|
||||
const response = await taf.QueryManager.query(
|
||||
{
|
||||
id: `test-data-request`,
|
||||
question: `Test Data`,
|
||||
inputs: [
|
||||
{
|
||||
type: `input`,
|
||||
inputType: `number`,
|
||||
key: `statBase`,
|
||||
label: `Stat Base`,
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
onSubmit: async (userID, answers) => {
|
||||
|
||||
rolls[userID] = [];
|
||||
|
||||
const diceHTML = [];
|
||||
for (let i = 0; i < answers.statBase; i++) {
|
||||
const rolled = Math.floor(Math.random() * 6) + 1;
|
||||
rolls[userID].push(rolled);
|
||||
diceHTML.push(`<li class="roll dice d6">${rolled}</li>`);
|
||||
};
|
||||
|
||||
const content = `Rolls:<div class="dice-tooltip"><ol class="dice-rolls">${diceHTML.join(`\n`)}</ol></div>`;
|
||||
|
||||
await taf.QueryManager.notify(userID, content);
|
||||
},
|
||||
}
|
||||
);
|
||||
console.log({ response, rolls });
|
||||
Loading…
Add table
Add a link
Reference in a new issue