I have below macro in FoundryVTT13. When I execute it, I'm getting rendered list of…
- User
I have below macro in FoundryVTT13. When I execute it, I'm getting rendered list of rolls, instead of list of numbers (parameters:
content). When I removerolls: rolled,from chat message data, I'm getting list of numbers, but DiceSoNice doesn't show animation. How to get just list of number and rolled dice? - Assistant
Here is the pattern I ended up using to get 1) a simple
<ul><li>…</li></ul>list of the raw die‐results in chat and 2) a DiceSoNice animation, without Foundry printing its full breakdown for you:(async() => { // 1) Roll your dice const myRoll = await new Roll("6d6").evaluate({async:true}); // 2) Kick off the Dice So Nice animation if (game.dice3d) await game.dice3d.showForRoll(myRoll); // 3) Extract just the numbers you care about // (We assume the first term is a single "6d6" pool here.) const results = myRoll.terms[0].results.map(r => r.result); // 4) Build a UL/LI for your chat content const listHtml = ` <ul> ${results.map(n => `<li>${n}</li>`).join("")} </ul>`.trim(); // 5) Post the chat message await ChatMessage.create({ user: game.user.id, speaker: ChatMessage.getSpeaker(), type: CONST.CHAT_MESSAGE_TYPES.ROLL, // tells Foundry this is a “roll” message roll: myRoll, // passes the Roll to the message (but does NOT use `rolls:`!) content: listHtml // your custom HTML }); })();–– Why this works ––
• By calling
game.dice3d.showForRoll(myRoll)yourself, Dice So Nice animates.
• By passing the roll in the singularroll:key (instead of arolls:array), Foundry will not override yourcontentwith its full breakdown template.
• You have 100% control overcontent, so you can print whatever you like (an<ul>, CSV, whatever).
If you really don’t want to manually call
game.dice3d.showForRoll(…)every time, you can also flip on the DSN “auto show” flag in your module settings. But the recipe above will always work, even if that flag is off.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.