mfi
mfi
Importing an npm package into a foundry system
Browserify was just the easiest thing to instanty use without any config. I haven't worked with Vita but might take a look.
13 replies
Importing an npm package into a foundry system
I've had some files that refused to be imported when referenced, even when within the modules folder. I was following the same export pattern, haven't been able to deduce why it was occurring.
13 replies
Importing an npm package into a foundry system
For the time being, and since this system is more home-brew than anything, I am going to go with a browserify setup. I was under the impression that FoundryVTT would (in its backend) handle hosting npm code up as necessary to the frotnend, but I was wrong. Oh well
13 replies
Importing an npm package into a foundry system
@Eranziel Thank you for the pointers/advice
13 replies
Dialog Box Auto-Closing Upon Opening 2nd Time
We decided to go forward using prompt() for the time being
9 replies
Dialog Box Auto-Closing Upon Opening 2nd Time
Can anyone assist with this? We've been stuck for over a month which means we aren't gettign the value out of the product. Here's the code so that you can repeat the issue:
async function openTextareaDialog() {
return new Promise((resolve, reject) => {
// Create a unique ID for the textarea to avoid conflicts
const textAreaId = `input-text-${Date.now()}`;

const template = `
<form>
<div class="form-group">
<textarea id="${textAreaId}" name="input-text"></textarea>
</div>
</form>
`;

let d = new Dialog({
title: "Input Text",
content: template,
buttons: {
ok: {
icon: '<i class="fas fa-check"></i>',
label: "Submit",
callback: html => {
const text = html.find(`#${textAreaId}`).val();
resolve(text);
}
},
cancel: {
icon: '<i class="fas fa-times"></i>',
label: "Cancel",
callback: () => reject(new Error('Dialog cancelled'))
}
},
default: "ok",
close: () => {
// Reject the promise if the dialog is closed without submission
reject(new Error('Dialog closed'));
}
});

// Render the dialog
d.render(true);
});
}


/* Custom */
Hooks.on("chatMessage", async (chatLog, messageText, chatData) => {
if (messageText === "!showdialog") {
try {
// Open the dialog and wait for the user to submit
const enteredText = await openTextareaDialog();

// Output the entered text to the console
console.log('Entered dialog:', enteredText);
} catch (error) {
console.error('Dialog error:', error);
}
}
async function openTextareaDialog() {
return new Promise((resolve, reject) => {
// Create a unique ID for the textarea to avoid conflicts
const textAreaId = `input-text-${Date.now()}`;

const template = `
<form>
<div class="form-group">
<textarea id="${textAreaId}" name="input-text"></textarea>
</div>
</form>
`;

let d = new Dialog({
title: "Input Text",
content: template,
buttons: {
ok: {
icon: '<i class="fas fa-check"></i>',
label: "Submit",
callback: html => {
const text = html.find(`#${textAreaId}`).val();
resolve(text);
}
},
cancel: {
icon: '<i class="fas fa-times"></i>',
label: "Cancel",
callback: () => reject(new Error('Dialog cancelled'))
}
},
default: "ok",
close: () => {
// Reject the promise if the dialog is closed without submission
reject(new Error('Dialog closed'));
}
});

// Render the dialog
d.render(true);
});
}


/* Custom */
Hooks.on("chatMessage", async (chatLog, messageText, chatData) => {
if (messageText === "!showdialog") {
try {
// Open the dialog and wait for the user to submit
const enteredText = await openTextareaDialog();

// Output the entered text to the console
console.log('Entered dialog:', enteredText);
} catch (error) {
console.error('Dialog error:', error);
}
}
9 replies
Dialog Box Auto-Closing Upon Opening 2nd Time
@Farling That's possible - I'm not familiar with how the internals work in terms of scoping. However, the FIRST render stays in-scope. Why would the second one suddenly not?
9 replies
ERROR: actors is not a valid embedded Document within the Token Document
I dont have that link permissions, but based on our debugger explorations, I concur. We cant hit a breaking point. Its internal to common.js and foundry.js. Ive recloned etc and had same issues.
21 replies
ERROR: actors is not a valid embedded Document within the Token Document
No description
21 replies
ERROR: actors is not a valid embedded Document within the Token Document
it's a CSCharacterActor, which inherist from CSActor, which inherits from ACtor
21 replies
ERROR: actors is not a valid embedded Document within the Token Document
That particular error does not occur in V10
21 replies
ERROR: actors is not a valid embedded Document within the Token Document
The error ONLY occurs on actors created
21 replies
ERROR: actors is not a valid embedded Document within the Token Document
It's v11
21 replies
ERROR: actors is not a valid embedded Document within the Token Document
Is that bad?
21 replies
ERROR: actors is not a valid embedded Document within the Token Document
@Zhell It's within the public repository. Here's an instance of that function call on the csCharacterActorSheet.js: https://github.com/3darkman/foundryvtt-chroniclesystem/blob/c6232f4c3f1ef5ebb3fafe9f0dc16502a087ad21/module/actors/sheets/csCharacterActorSheet.js#L353
21 replies