That's a weird failure rule. It seems like Critical Failure would be more common that Failure. The script is below, with install instructions. To use it, just use this macro: !srdice @{selected|token_name} [[?{Würfelpool}d6]] 1 It will give output like this If you leave off that 1 at the end, it wont show the dice line. So !srdice @{selected|token_name} [[?{Würfelpool}d6]] instead of !srdice @{selected|token_name} [[?{Würfelpool}d6]] 1 There's a section at the start of the script you can alter to change the labels. This section: const HITS = 'Erfolge';
const FUMBLES = 'Patzer';
const DICE = 'dice';
const RESULT = 'result';
const CRITICALFAIL = 'Critical Failure';
const FAILURE = 'Failure';
const POSSIBLE = ''; By default, the result line shows only when it is a Failure or Critical Failure, and not its neither a Failure ot Crit Fail. If you want to show something like "Possible Success", just enter that label on the POSSIBLE line, like, say const POSSIBLE = 'Possible Success'; Here's the script. To install it, go to your campaign launch page, click the settings button, select API Scripts, and paste this into the New Script page. give the script a name and save it: // !srdice @{selected|token_name} [[?{Würfelpool}d6]] showdice
on('ready', () => {
on('chat:message', (msg) => {
if ('api' === msg.type && msg.content.startsWith('!srdice')) {
const HITS = 'Erfolge';
const FUMBLES = 'Patzer';
const DICE = 'dice';
const RESULT = 'result';
const CRITICALFAIL = 'Critical Failure';
const FAILURE = 'Failure';
const POSSIBLE = '';
const args = msg.content.split(/\s+/);
const token = args[1] || '';
const showdice = args[3] || 0;
let hits = 0;
let fumbles = 0;
let dice = [];
(msg.inlinerolls || []).forEach(r => {
((r.results || {}).rolls || []).forEach(r2 => {
(r2.results || []).forEach(r3 => {
hits += ((r3.v || 0) >= 5 ? 1 : 0);
fumbles += ((r3.v || 0) === 1 ? 1 : 0);
dice.push(r3.v || 0);
});
});
});
//const result = (hits === 0 && fumbles > 0) ? CRITICALFAIL : (fumbles > (dice.length/2) ? FAILURE : POSSIBLE);
let result = POSSIBLE;
if(hits === 0 && fumbles > 0) result = CRITICALFAIL;
else if(fumbles > (dice.length/2)) result = FAILURE;
let output = `&{template:default} {{name=${token}}} `;
if(showdice) output += `{{${DICE}=${dice.join(' ')} }} `;
output += `{{${HITS}=${hits}}} `;
if(fumbles > 0) output += `{{${FUMBLES}=${fumbles} }} `;
if(result) output += `{{${RESULT}=${result}}} `;
sendChat('', output);
}
});
}); Credit goes to The Aaron for the dice counting part of the script. If you want the script tweaked, let me know.