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

How can I store a dice roll into a character sheet attribute?

Hi. I'm making my first sheet. This one is for a D&D Battle System game. I have a button on the character sheet that I want players to click on to calculate the number of troops on a token or a sheet (I would prefer to learn how to do both). I got the dice roll work as a roll displayed in chat.  It's the updating of the attr_troops that I'm struggling with. Any help is appreciated.       <b>Unit Size:</b> <select name="attr_unit_size" class="sheet-wide">             <option value="250d6+1000">Infantry (small) 250d6+1000</option>             <option value="200d6+800">Infantry (medium) 200d6+800</option>             <option value="100d6+400">Infantry (large) 100d6+400</option>             <option value="100d6+400">Cavalry (mounted) 100d6+400</option>             <option value="100d4+100">Light Enigines 100d4+100</option>             <option value="20d6+80">Medium Engines 20d6+80</option>              <option value="10d6+40">Heavy Engines 10d6+40</option>             <option value="50d4+100">Canon 100d4+100</option>             <option value="100d20">Special Forces 100d20</option>             <option value="50d6+200">Monsters (Huge) 50d6+200</option>             <option value="50d4+44">Monsters (Gargantuan) 50d4+44</option>             <option value="100d10">Special Forces</option>       </select> <b>Total Troops:</b><input type="text" name="attr_troops">" <b>Calculate number of Troops</b><button type="roll" name="Generate Troops" value="&{template:default} {{name=Generate Troops }} {{Selected|attr_troops=[[@{unit_size}]] }}>"> </button><br />
1528233235

Edited 1528233248
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Without using an api script, the sheet cannot change attributes based on a roll. You could have the sheet do the dice roll internally (not sent to chat) and set the attribute to that, but to emphasize - this would not send anything to chat.
Thanks. Not what I wanted to hear but I'll work around it.If I had time I would delve into API land.