Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Success and Fail Macro

1598122889

Edited 1598123139
I know so please don't hate me. I've scoured almost every thread the deals with this type of thing so I'm almost convinced its not possible. With that, here is my issue. I've been using the 1d6 >5! (obviously without the space before >) to show a 5 and 6 being a success while the 6 explodes into another dice. This part is fine. What I'm trying to figure out is how can I have the failures, which in this case are 1's to counter act the successes and show without having to scroll over the roll? Any tips or ideas? I.E. Say I roll 4d6 >5! and out of this I get 6,6,5,4,1,1. What would I need to place in the formula to show just 1 success instead of the 3 and ignoring the 1's? Thanks in advance for any help. ^.^
1598125229
GiGs
Pro
Sheet Author
API Scripter
That's covered in the dice reference:&nbsp; <a href="https://wiki.roll20.net/Dice_Reference#Failures_.28B.2CF.29_-_fCP_2" rel="nofollow">https://wiki.roll20.net/Dice_Reference#Failures_.28B.2CF.29_-_fCP_2</a> /roll {4d6!}&gt;5f&lt;1
GiGs said: That's covered in the dice reference:&nbsp; <a href="https://wiki.roll20.net/Dice_Reference#Failures_.28B.2CF.29_-_fCP_2" rel="nofollow">https://wiki.roll20.net/Dice_Reference#Failures_.28B.2CF.29_-_fCP_2</a> /roll {4d6!}&gt;5f&lt;1 I must have been out of it or just drain bamaged at this point. Thank you for the reference. I do have another aspect of this as well if you can help. Is there a way to be able to ignore a set amount of 1's or is that not possible?
1598128819
GiGs
Pro
Sheet Author
API Scripter
Don't feel bad! I'd been referring to that page for years before I realised you could do this :) As to your question, unfortunately that's not possible. You'd have to look into getting a custom API script. If youre the GM, as a Pro user you can add API scripts to your campaign.
Sadly I'm not very knowledgeable with API scripts. Slowly learning a few things but not enough that'll help. I do appreciate the help
1598131565

Edited 1598148680
GiGs
Pro
Sheet Author
API Scripter
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', () =&gt; { const getdice = (msg) =&gt; _.pluck( (msg.inlinerolls &amp;&amp; msg.inlinerolls[0].results.rolls[0].results) || [], 'v'); on('chat:message', msg =&gt; { 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 =&gt; x &gt;= 5).length; let ones = dice.filter(x =&gt; x === 1).length; ones = ignoreones ? Math.max(0, ones - ignoreones) : ones; let result = successes - ones; let output = `&amp;{template:default} {{name=${name}}} {{roll=${dice.map(d =&gt; `${(d &gt;= 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.
Mind if I PM you? It's a complicated yet sensitive situation
1598142009
GiGs
Pro
Sheet Author
API Scripter
what a strange statement. Go ahead