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 roll on a custom sheet

I am trying to make new fields in my sheet for crafting. I want to make a variable that is set in one field, a checkbox for proficency, and a auto roll when you click the button much like skills normally do. The problem I am hitting is I am not seeing any good documentation to explain how the auto roll feature works. This is what I am working with right now. The alch bonus seems to be breaking it so I am not sure what I am doing wrong. <div class="alchemist-container">                     <div class="CSC">                         <button type='roll' name='roll-alchemist' value='@{wtype}&{template:simple} {{rname=^{alchemist-u}}}                         {{mod=@{alch_bonus}}}                         {{r1=[[@{d20}+@{alch_bonus}@{pbd_safe}]]}}                         '>                                                     <span class="label" style="width: 80px;" data-i18n="alchemist-u">Alcemist</span></button>                         <span style="width: 36px;"> <input type="checkbox" name="attr_ASP" title= "Alch_Pro" /> </span>                         <span style="width: 60px;"> <input type="number" name="attr_AS" placeholder="0" title="alch_bonus" /> </span>                     </div>
1554782122

Edited 1554782231
Finderski
Plus
Sheet Author
Compendium Curator
You don't have a field (at least in what you've shared) for alch_bonus, instead the field is AS. <input type="number" name="attr_AS" placeholder="0" title="alch_bonus" /> Try this: <button type='roll' name='roll-alchemist' value='@{wtype}&{template:simple} {{rname=^{alchemist-u}}} {{mod=@{AS}}} {{r1=[[@{d20}+@{AS}@{pbd_safe}]]}}'></button> EDIT: I also don't know what pbd_safe is, so...that may cause problems as well.  There's no mathematical operator separating it and the AS field...so, just be aware, that may cause some weirdness...
Thanks a lot. knowing taking off the attr part would make it work. I thought adding the title with the name alch_bonus was how to got that field. One other thing how do I add proficency mod based on if the checkbox attr_ASP is checked?
1554784546

Edited 1554784898
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Not sure what your proficiency mod values could be, or what you are calling it, but for this example, I'll call it pb with a value of 2. Additionally, you've got some extraneous html code that isn't serving any purpose. I'm going to remove it for this example as well. <div class="alchemist-container">                     <div class="CSC">                         <button type='roll' name='roll-alchemist' value='@{wtype}&{template:simple} {{rname=^{alchemist-u}}}                          {{mod=@{alch_bonus}}}                          {{r1=[[@{d20}+@{ASP}*@{pb}+@{alch_bonus}@{pbd_safe}]]}}                         '></button> <!-- you'd also forgotten the closing button tag -->                                                      <span class="label" style="width: 80px;" data-i18n="alchemist-u">Alcemist</span></button>                         <input type="checkbox" style="width:36px;" name="attr_ASP" title= "Alch_Pro" value="1" /><!--I've added a default value here so that when it's checked it has a value of 1 instead of "On" so that we can use it as a boolean. Additionally, I've removed the spans surrounding these inputs because there's no reason to use them. -->                         <input type="number" style="width:60px;" name="attr_AS" placeholder="0" title="alch_bonus" />                         <input type="number" name="attr_pb" value="2">                     </div> EDIT: Note that if you were surrounding your inputs with spans to get them to look like spans, the better way to do this is via CSS (if you want them to be editable) or by using attribute backed spans (<span name='attr_as' value='0'>0</span>) if they are just for display and you're going to use sheetworkers to update them. Additionally, I would highly recommend not using capitalization in your attribute names. Attribute references are case insensitive, and if you ever decide to use sheetworkers they respond to lowercased versions of the attribute names anyways. These two things together mean that it can just make your code confusing if you have capitalization in the html, but then don't (or can't) use it elsewhere.