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 .
×

Checking Against a Previous Die in a Roll

Hi, So I have picked up a lot the last few hours in these forums and the extensive wiki pages. I have bumped into an issue that I am not sure can be solved with my ability, and maybe with this system in general. The code is at the bottom. It is a button that rolls a 1d6 for the Success Die and compares it to the char_grit attribute, and rolls another 1d6 for the Danger Die. In this game you have to roll under the attribute to succeed. I set the cs to <0 on the Success Die so it doesn't show green ever, and set the cf to >@{char_grit} so that it shows red when they fail by rolling equal to or over the attribute. This all works great. The issue is, in the game, the Danger Die is compared to the result of the Success Die. If the Danger Die result is lower than the Success Die result, then a complication happens in the game. What I am trying to do is set a cf on the Danger Die in comparison to the result of the roll on the Success Die. I do realize they could just look and math it out themselves, but I am trying to dummy proof the experience. Is there a way to do a call to compare this second roll versus the first roll and set it in the cf? Thanks! CriticalMist <button type="roll" value="&{template:default} {{name=Grit}} {{Success Die=[[1d6cs<0cf>@{char_grit}]]}} {{Danger Die=[[1d6]]}}" name="roll_gritcheck"></button>
1645168458

Edited 1645168613
Andreas J.
Forum Champion
Sheet Author
Translator
Generally, the answer to Checking Against a Previous Die in a Roll? is Custom Roll Parsing(CRP) , which mean you'd need to write sheetworkers . I'm not familiar enough with CRP to address the specifics of your question, but that's at least a starting point until some who knows this better comes around to answer your question. Alternatively, it might be possible to use Reusing Rolls to achieve the same thing, but doing CRP is the smart choice in the long run, as "Reusing Rolls" is a hack, and not guaranteed to work in the long run if Roll20 makes changes to the dice engine.
Thanks! I’ll take a look at CRP. I haven’t used the sheetworkers stuff at all, I’ve just been using html and roll20’s weird markdown stuff. I guess I’ll have to dive in. Also, it might be a time/benefit analysis on this one.   Andreas J. said: Generally, the answer to Checking Against a Previous Die in a Roll? is Custom Roll Parsing(CRP) , which mean you'd need to write sheetworkers . I'm not familiar enough with CRP to address the specifics of your question, but that's at least a starting point until some who knows this better comes around to answer your question. Alternatively, it might be possible to use Reusing Rolls to achieve the same thing, but doing CRP is the smart choice in the long run, as "Reusing Rolls" is a hack, and not guaranteed to work in the long run if Roll20 makes changes to the dice engine.
Here is the code example from Custom Roll Parsing from the Wiki. Using a format like this, could I get a roll for the Success Die, which has a CF/CS based on an attribute like I did before, and then a second roll for the Danger Die that compares CF/CS to the roll of the Success Die? < button type = "action" name = "act_test" > Click me < /button > < rolltemplate class = "sheet-rolltemplate-test" > < div class = "sheet-template-container" > < h1 > {{name}} < /h1 > < div class = "sheet-results" > < h4 > Result = {{roll1}} < /h4 > < h4 > Custom Result = {{computed::roll1}} < /h4 > < /div > < /div > < /rolltemplate > < script type = "text/worker" > on ( 'clicked:test' , (info) = > { startRoll ( "&{template:test} {{name=Test}} {{roll1=[[1d20]]}}" , (results) = > { const total = results.results.roll1.result const computed = total % 4 ; finishRoll ( results.rollId, { roll1: computed } ); }); }); < /script >