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

Help with making a sheet that rolls 2d6 take-the-lowest when you have 0 in an attribute

I'm writing a character sheet for a game called Bubblegum Wizards 2. It is feature complete, but it doesn't have roll buttons. The game's system has you roll a number of d6s equal to your attribute unless you have a 0 in that attribute, at which point it rolls 2d6 and you take the lower. I've heard this is done using Sheet Handler(?) but I'm not really a coder and don't have an easy time parsing the code. Could someone help me? I could post the sheet code but I'm not sure how to do that, I'm very green.
1690168916
GiGs
Pro
Sheet Author
API Scripter
I think you'll need to use code (custom roll parsing to be precise) for that. That's very tricky - it's probably the hardest roll20 feature. You could do it with a macro asking how big the attribute is, and a query, like /roll ?{Attribute Score?| 0,2d6dh1| 1,1d6|, 2,2d6}
So, This is how I think I'd make a button that rolls a number of d6s equal to the Cool attribute. <input type="number" name="attr_cool_current" /> <button type="roll" value="[[@{cool_current)d6]]" name'roll_cool'>Roll Cool</button> But how would I insert this macro into my code? /roll ?{Attribute Score?| 0,2d6dh1| 1,1d6|, 2,2d6}
1690172405

Edited 1690172462
GiGs
Pro
Sheet Author
API Scripter
<button type="roll" value="[[?{Is Your Score 0?|Yes,2d6dh1|No,@{cool_current)d6}]]" name'roll_cool'>Roll Cool</button> This will ask people if their score is zero, and roll for that; otherwise it will roll the proper amount of dice. You probably want to put it in a rolltemplate, which might look like this: <button type="roll" value="&{template:default} {{name=Cool Roll}} {{[[?{Is Your Score 0?|Yes,2d6dh1|No,@{cool_current)d6}]]}}" name'roll_cool'>Roll Cool</button>
So, when I put the top version in as a button, it returns this: No attribute was found for @{Benihana "Bonus" Chock|cool_current)d6} SyntaxError: Expected "(", ".", "[", "abs(", "ceil(", "d", "floor(", "round(", "t", "{", [ |\t], [+|\-] or [0-9] but "?" found. Benihana is the name of the character. After correcting the ) to a } in the no clause, the second one worked, but it's a little clunky, hmm.. Is there a way to center the result within the box it's displayed in?
1690176951
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
yes, but that will require a custom roll template
1690204008
GiGs
Pro
Sheet Author
API Scripter
Sorry about that ) typo. Yes, there's a lot you can do to manipulate the layout, but as Scott says, this will require learning how to write a rolltemplate (and some knowledge of HTML and CSS).
No worries! I was about to post about the error before I noticed one of the }s looked a little too round. I do have some knowledge of HTML and CSS. Can you point me at any guides or anything?
1690334259

Edited 1690334378
GiGs
Pro
Sheet Author
API Scripter
Have I got a link for you! My site: <a href="https://cybersphere.me/roll20-sheet-author-master-list/" rel="nofollow">https://cybersphere.me/roll20-sheet-author-master-list/</a> HTML, CSS, and Javascript - how you need to write specifically for Roll20. Thats focussed on sheet authoring. If you are asking about more general stuff, the Roll20 Wiki is an invaluable resource.