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

Checkbox Value not being taken.

1513032691

Edited 1513035628
I am frustrated beyond all reason right now.  My code won't work even though I'm 100% certain I've done everything right. <table>         <tr>             <th colspan="10" align="center"><b>PRIMARY WEAPON</b></th>         </tr>         <tr>             <td rowspan="2"><button type="roll" name="roll_primary" value="&{template:default}{{name= Attack!}}{{character= @{character_name}}}{{Attack= [[1d20cs>@{primary-crit}cf<@{primary-fail}+]]}}" style="width:50px; height:50px;"></button></td>             <td><input type="text" name="attr_primary-name" placeholder="Weapon Name" style="width:150px;"/><br>Name</td>             <td align="center"><input type="text" name="attr_primary-ttldmg" value="@{primary-dmg}+@{primary-basedmg}" style="width:50px;" disabled="true"/><br>Total</td>             <td align="center"><input type="number" name="attr_primary-dmg" value="0" style="width:50px;"/><br>Damage</td>             <td align="center"><input type="text" name="attr_primary-basedmg" value="@{basedmg}*@{primary-range}" style="width:50px;" disabled="true"/><br>Base</td>             <td align="center"><input type="number" name="attr_primary-miscdmg" value="0" style="width:50px;"/><br>Misc</td>             <td align="center"><select name="attr_primary-atktype" style="width:75px;">                 <option value="@{strmod}">STR</option>                 <option value="@{dexmod}">DEX</option>             </select>             <br>Attack</td>             <td align="center"><input type="text" name="attr_primary-atk" value="@{primary-atkbonus}+@{primary-miscatkbonus}" style="width:50px;" disabled="true"/><br>Total</td>             <td align="center"><input type="text" name="attr_primary-atkbonus" value="@{primary-atktype}" style="width:50px;" disabled="true"/><br>Bonus</td>             <td align="center"><input type="number" name="attr_primary-miscatkbonus" value="0" style="width:50px;"/><br>Misc</td>         </tr>         <tr>             <td colspan="6"><textarea name="attr_primary-desc" wrap="soft" placeholder="Details" style="width:450px; height:40px;"></textarea></td>             <td align="center"><input type="number" name="attr_primary-crit" value="20" max="20" style="width:50px;"/><br>Crit</td>             <td align="center"><input type="number" name="attr_primary-fail" value="1" min="1" style="width:50px;"/><br>Fail</td>             <td align="center"><input type="checkbox" checked="true" name="attr_primary-range" value="1"/><br>Ranged?</td>         </tr>     </table> The checkbox "attr_primary-range" is supposed to be set to 1 when it's checked, and 0 when it isn't, right? Then why the hell won't it do that in the calculation for attr_primary-basedmg?  It just... won't work.  If I uncheck it, it won't multiply @{basedmg} by 0.  It just completely ignores it. The code is incomplete because I want to figure out this Checkbox error first.
I would recommend using sheetworkers to do these calculations, but what do you get when you query the value @{primary-range} in chat when primary-range is unchecked?
1513049113

Edited 1513049203
Actually, scratch my last  advice. Line 10: <td align="center"><input type="text" name="attr_primary-basedmg" value=" @{basedmg} *@{primary-range}" style="width:50px;" disabled="true"/><br>Base</td> This @{basedmg} attribute is undefined.
Rabulias said: Actually, scratch my last  advice. Line 10: <td align="center"><input type="text" name="attr_primary-basedmg" value=" @{basedmg} *@{primary-range}" style="width:50px;" disabled="true"/><br>Base</td> This @{basedmg} attribute is undefined. Basedmg is fine.  It's defined in the regular sheet.  If you define @{basedmg} as anything the calculation won't work.  I have no idea why it won't work.
1513056950

Edited 1513057133
Diana P
Pro
Sheet Author
Is @{basedmg} a calculated value?  If so, try wrapping it in parentheses (@{basedmg})*@{primary-range} so you eliminate the possibility that the last value of the calculated basedmg is the only thing being multiplied by the primary-range. Edit: otherwise, I'm stumped; it looks a lot like my checkbox/calculation pairs which do work.  The only difference that I can see is that my checkbox starts unchecked but that shouldn't make the difference afaik.
Diana P said: Is @{basedmg} a calculated value?  If so, try wrapping it in parentheses (@{basedmg})*@{primary-range} so you eliminate the possibility that the last value of the calculated basedmg is the only thing being multiplied by the primary-range. Edit: otherwise, I'm stumped; it looks a lot like my checkbox/calculation pairs which do work.  The only difference that I can see is that my checkbox starts unchecked but that shouldn't make the difference afaik. That could be a thing happening thanks!
It worked!
1513088318
Diana P
Pro
Sheet Author
Excellent!