mfi
mfi
Importing an npm package into a foundry system
import minimist from 'minimist'; That line alone when included in my module's hook file is resulting in the system breaking. Do we need to include webpack/Vite/or something of the sort? Why isn't the software handling this automatically? Is there a tutorial we can follow?
13 replies
Dialog Box Auto-Closing Upon Opening 2nd Time
I've been appending custom functionality to the simple worldbuilding system. At this time, I'm trying to loop over all actors and then use and their items to add things up and perform rolls. To add modifiers, I want to make a dialogue box pop up wherein I can type in additional modifiers/etc, such as +1att (give the attacker +1 advantage to their role under value) The first time, it works! It prints verbose. That is the "building block" string for me to build additional logic on top of. The 2nd time, the dialogue just instantly returns "" and then it doesn't print verbose.
if (messageText === "/combatcheck") {
// Prompt for additional input
// Define a function to display the dialog and return the input
async function getAdditionalInput() {
return new Promise((resolve) => {
// Unique identifier for the input
const uniqueId = `additional-input-${new Date().getTime()}`;

let dialog = new Dialog({
title: "Additional Input",
content: `<p>Enter additional flags/commands:</p><input type='text' id='${uniqueId}'/>`,
buttons: {
ok: {
icon: "<i class='fas fa-check'></i>",
label: "Submit",
callback: (html) => resolve(html.find(`#${uniqueId}`).val())
},
cancel: {
icon: "<i class='fas fa-times'></i>",
label: "Cancel",
callback: () => resolve(null)
}
},
default: "ok",
close: () => resolve(null)
});

// Render the dialog
dialog.render(true);
});
}
const additionalInput = await getAdditionalInput();
const verboseMode = additionalInput.includes("verbose");
if (verboseMode) {
console.log(`Verbose mode enabled!`);
}

// Keep doing stuff down here...
if (messageText === "/combatcheck") {
// Prompt for additional input
// Define a function to display the dialog and return the input
async function getAdditionalInput() {
return new Promise((resolve) => {
// Unique identifier for the input
const uniqueId = `additional-input-${new Date().getTime()}`;

let dialog = new Dialog({
title: "Additional Input",
content: `<p>Enter additional flags/commands:</p><input type='text' id='${uniqueId}'/>`,
buttons: {
ok: {
icon: "<i class='fas fa-check'></i>",
label: "Submit",
callback: (html) => resolve(html.find(`#${uniqueId}`).val())
},
cancel: {
icon: "<i class='fas fa-times'></i>",
label: "Cancel",
callback: () => resolve(null)
}
},
default: "ok",
close: () => resolve(null)
});

// Render the dialog
dialog.render(true);
});
}
const additionalInput = await getAdditionalInput();
const verboseMode = additionalInput.includes("verbose");
if (verboseMode) {
console.log(`Verbose mode enabled!`);
}

// Keep doing stuff down here...
Has anyone else had issues with Dialogues behaving so oddly? Why is my new Dailog instantly closing with no value?
9 replies
ERROR: actors is not a valid embedded Document within the Token Document
No description
21 replies