I'd have included a sample api script. but the problem is API scripts are built to the precise specification needed. It's hard to write one for you without knowing everything about how you make rolls in your game. For example, here's a short script to calculate what you appear to need. Add it to the API Scripts section of your campaign. Call it by typing (or creating a macro) something like this: !failures [[4d6!]] --Title --1 The number of dice can be a query or attribute value, like !failures [[?{How Many Dice?|4}d6!]] --Title --1 The title can be any text (maybe avoid commas) !failures [[?{How Many Dice?|4}d6!]] --This is the name of my roll --1 the final but is the number of ones to ignore. if it's 0, it can be left off. !failures [[?{How Many Dice?|4}d6!]] --This is the name of my roll The script code is below on('ready', () => {
const getdice = (msg) => _.pluck( (msg.inlinerolls && msg.inlinerolls[0].results.rolls[0].results) || [], 'v');
on('chat:message', msg => {
if (msg.type !== "api") {
return;
}
if (msg.content.startsWith('!failures')) {
let args = msg.content.split(/\s+--/);
let name = args[1] || 'A Roll';
let ignoreones = parseInt(args[2]) || 0;
let dice = getdice(msg);
let successes = dice.filter(x => x >= 5).length;
let ones = dice.filter(x => x === 1).length;
ones = ignoreones ? Math.max(0, ones - ignoreones) : ones;
let result = successes - ones;
let output = `&{template:default} {{name=${name}}} {{roll=${dice.map(d => `${(d >= 5 || d ===1) ? `**[[${d}]]**` : `[[${d}]]`}`).join(' ')}}} {{result=**${result}**}}`;
sendChat('test', output);
}
});
}); As you can see, api scripts for even simple-ish rolls can be very complex.