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

Inventory weight calculation?

So I'm looking for the 5e weight calculations for inventory (trying to make my own for another game sheet) and I don't understand how this "calculates" because there is no mathematical formula used at all. Could someone explain this to me? How does it know to tally the weight of each item and multiply it by the quantity of items; IE: 1 potion = 1 lbs,  3 potions = 3 lbs, et cetura. I don't see this in the code. <fieldset class="repeating_inventory"> <input type="hidden" class="equippedflag" name="attr_equipped"> <div class="item"> <input class="weight" type="text" name="attr_itemcount" value="1"> <input class="name" type="text" name="attr_itemname"> <input class="weight" type="text" name="attr_itemweight"> <input class="inventorysubflag" type="checkbox" name="attr_inventorysubflag"><span>i</span> <div class="subitem"> <input class="equipped" type="checkbox" name="attr_equipped" value="1" checked="checked"> <span class="equippedlabel" data-i18n="equipped-u">EQUIPPED</span> <input class="equipped" type="checkbox" name="attr_useasresource" value="1"> <span class="equippedlabel" data-i18n="use-as-resource-u">USE AS A RESOURCE</span> <input class="equipped" type="checkbox" name="attr_hasattack" value="1"> <span class="equippedlabel" data-i18n="has-attack-u">HAS AN ATTACK</span> <span class="label" data-i18n="prop:-u">PROP:</span> <input class="subfield" type="text" name="attr_itemproperties"> <span class="label" data-i18n="mods:-u">MODS:</span> <input class="subfield" type="text" name="attr_itemmodifiers"> <textarea class="subtextarea" name="attr_itemcontent"></textarea> </div> <input type="hidden" name="attr_itemattackid"> <input type="hidden" name="attr_itemresourceid"> </div> </fieldset> <div class="weighttotal"> <span class="label" data-i18n="total-weight-u">TOTAL WEIGHT</span> <input type="text" name="attr_weighttotal" value="0"> <input type="hidden" class="encumberance" name="attr_encumberance"> <span class="encumb immobile" data-i18n="immobile-u">IMMOBILE</span> <span class="encumb heavily" data-i18n="heavily-encumbered-u">HEAVILY ENCUMBERED</span> <span class="encumb encumbered" data-i18n="encumbered-u">ENCUMBERED</span> <span class="encumb over" data-i18n="over-carrying-cap-u">OVER CARRYING CAPACITY</span> </div>
1678999286

Edited 1678999421
GiGs
Pro
Sheet Author
API Scripter
I havent looked at the sheet, but I guess it's in the sheet worker section. Look for script type="text/worker Everything after that is automation, that can watch attributes for changes, and update other attributes as a result. I'd add that the 5e sheet is not a good sheet to look at for beginners. It's a very complex sheet and isn't written in a wayt hat iwll be easy to understand. If you want to understand the basics of sheet workers, look here: <a href="https://cybersphere.me/anatomy-of-a-sheet-worker/" rel="nofollow">https://cybersphere.me/anatomy-of-a-sheet-worker/</a> The forum wiki has a lot of helpful articles too,
1679005569

Edited 1679005676
Can you publish the code of the sheet where you want to do this ? If you make this we can help you to make the code for the weight calculation.
1679005690
GiGs
Pro
Sheet Author
API Scripter
I'm not sure the 5e sheet code can be published.
1679008030

Edited 1679008099
He say he want to make this for his own character sheet. I ask if it's possible to publish his own code not the 5e sheet code (I think too it's not possible). If he publish his code, I can help him. I use a inventory weight calculation in my sheet.
1679012993

Edited 1679013050
GiGs
Pro
Sheet Author
API Scripter
Every sheet authpr can publish their own code, and if they submit a sheet to roll20 (via the github repo) it will be published autotmtically. Sheets developed by Roll20 themselves (the ones that have "By Roll20 " in the name), are not usually public, and the 5e sheet is even more private than other sheets. I was referring to that. But nothign is stopping your sheet author from releasing his code. PS: for an inventury calculation, look up repeatingSum on the wiki.
I use repeatingSum :D