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

[40kRPGs] Creating a total, XP spent, XP to spend, etc. for Character Sheets

Here's an image to explain and represent what I desire! ^_^ How would a sheet creator go about implementing this? (To clarify, I mean themselves, not the GitHub/push process.)
FYI he is talking about extracting information out of the <Feildset> variable.
so, if I'm understanding correctly, you want to pull values from a repeating fieldset to make a macro? You'll need the specific name of each attribute, but, it will be setup @{repeating_fieldsetname_$numberofrow_nameofattribute} Bear in mind, rows start at 0, so if it's the first generated row, you'l want, @{repeating_fieldsetname_$0_nameofattribute} Alternatively, if you need each character's section pulled to a macro that is not housed inside their sheets, you need to use @{charactername|repeating_fieldsetname_$0_nameofattribute}
1489645124
Lithl
Pro
Sheet Author
API Scripter
You would need a sheet worker script for this. You can do it from scratch, but  TheAaronSheet makes it very simple. TAS.repeatingSimpleSum('fieldset_name', 'a', 'c'); // c = SUM(a) getAttrs(['b', 'c'], function(values) { setAttrs({ d: parseInt(values.b, 10) - parseInt(values.c, 10) }); });
Brian said: You would need a sheet worker script for this. You can do it from scratch, but  TheAaronSheet makes it very simple. TAS.repeatingSimpleSum('fieldset_name', 'a', 'c'); // c = SUM(a) getAttrs(['b', 'c'], function(values) { setAttrs({ d: parseInt(values.b, 10) - parseInt(values.c, 10) }); }); Do you need pro for this to be used if its on the sheet?
1489696626
Lithl
Pro
Sheet Author
API Scripter
No. While you need Pro in order to edit a custom sheet (which is needed for accurately testing changes to a sheet), sheet worker scripts are part of a sheet and can be used by anyone once the sheet has been submitted to the GitHub repo and processed.
1489706239

Edited 1489706720
Samuel L.
Sheet Author
Brian said: No. While you need Pro in order to edit a custom sheet (which is needed for accurately testing changes to a sheet), sheet worker scripts are part of a sheet and can be used by anyone once the sheet has been submitted to the GitHub repo and processed. So I have been trying to get this to work for the past few hours and now I am stuck on this. I am trying to add up 3 different values (advancementRe1xp advancementRe2xp advancementRe3xp) and then get it to add up into the XPSpent area. <div class="sheet-2colrow">             <div class="sheet-fate">     <!-- Left Column (Experience) -->                 <br></br>                 <h3>Experience</h3>                 <div class="sheet-row">                     <div class="sheet-item" style="width:12%">                         <label>XP to Spend:</label>                     </div>                     <div class="sheet-item" style="width:22%">                         <input name="attr_XPtoSpend" type="number">                     </div>                     <div class="sheet-item" style="width:1%"></div>                     <div class="sheet-item" style="width:10%">                         <label>Total Spent:</label>                     </div>                     <div class="sheet-item" style="width:24%">                         <input name="attr_XPSpent" type="number" value="0">                     </div>                     <div class="sheet-item" style="width:1%"></div>                     <div class="sheet-item" style="width:5%">                         <label>Total:</label>                     </div>                     <div class="sheet-item" style="width:25%">                         <input name="attr_XPTotal" type="number">                     </div>                 </div>             </div>         </div>         <label>Advancements Taken:</label>         <fieldset class="repeating_advancements">             <div class="sheet-row">                 <div class="sheet-item" style="width:26%;">                     <input name="attr_advancementRe1" type="text">                 </div>                 <div class="sheet-item sheet-puny sheet-center sheet-brackets sheet-armourblock">                     <input name="attr_advancementRe1xp" type="number" value="0">                 </div>                 <div class="sheet-item" style="width:26%;">                     <input name="attr_advancementRe2" type="text">                 </div>                 <div class="sheet-item sheet-puny sheet-center sheet-brackets sheet-armourblock">                     <input name="attr_advancementRe2xp" type="number" value="0">                 </div>                 <div class="sheet-item" style="width:26%;">                     <input name="attr_advancementRe3" type="text">                 </div>                 <div class="sheet-item sheet-puny sheet-center sheet-brackets sheet-armourblock">                     <input name="attr_advancementRe3xp" type="number" value="0">                 </div>             </div>         </fieldset> on('change:repeating_advancements', function(){     TAS.repeating('advancements')  //< set the repeating group we are using         .attrs('XPSpent')  //< specify we want access to the total_weight attribute         .fields('advancementRe1xp','advancementRe2xp', 'advancementRe3xp') //< specify we want the item and weight repeating fields         .reduce(function(memo, row))         {             return memo + (row.I.advancementRe1xp + row.I.advancementRe2xp + row.I.advancementRe3xp);         },0,function(memo, row, attrSet)         {             attrSet.I.XPSpent = memo;         }         .execute(); });
1489731954
Lithl
Pro
Sheet Author
API Scripter
At a glance, you've got an extra ) on your reduce line, and missing a ) before .execute.
Brian said: At a glance, you've got an extra ) on your reduce line, and missing a ) before .execute. Even after fixing that it still does not work.
1489796965
Lithl
Pro
Sheet Author
API Scripter
Are you getting any error messages?
Heyya! Had it figured out. If you're interested, you should be able to see it once the new sheet is pushed through. Thanks for your help everybody!