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 .
×

No attribute was found for...

In the following code, Attribute "protectionpointsbonus" is not being read or found...but it somehow record the value...how do I fix this error going forward?  Here is the code for reference and context  <h3>Defense Roll  <button type="action" name="act_defend">Defend</button></h3> <label>Defense Roll:  <input name="attr_chardefenseroll" type="hidden" class="sheet-chardefenseroll"><select name="attr_chardefenseselect" class="sheet-chardefenseselect"> <option value="" selected>None</option> <option value=acrobatics selected>Acrobatics</option> <option value=athletics selected>Athletics</option> <option value=bluff selected>Bluff</option> <option value=diplomacy selected>Diplomacy</option> <option value=endurance selected>Endurance</option> <option value=heal selected>Heal</option> <option value=history selected>History</option> <option value=insight selected>Insight</option> <option value=intimidate selected>Intimidate</option> <option value=nature selected>Nature</option> <option value=perception selected>Perception</option> <option value=religion selected>Religion</option> <option value=stealth selected>Stealth</option> <option value=streetwise selected>Streetwise</option> <option value=thievery selected>Thievery</option> <option value="" selected></option></label> <label> +Protection Points: <input class="skills" type="number" value="0" name="attr_protectionpointsbonus" class="sheet-protectionpointsbonus"></label> <rolltemplate class="sheet-rolltemplate-defend"> <div class="sheet-container"> <div class="sheet-header"> {{#title}}<div class="sheet-title">{{title}}<br><br></div>{{/title}} {{#defenseroll}}<div class="sheet-defenseroll">{{defenseroll}} {{computed::defenseroll}}<br></div>{{/defenseroll}} {{#pptext}}<div class="sheet-pptext">{{pptext}} {{computed::pp}}<br></div>{{/pptext}} {{#modtext}}<div class="sheet-modtext">{{modtext}} {{modifier}}<br></div>{{/modtext}} {{#minustext}}<div class="sheet-minus">{{minustext}} {{computed::minus}}<br></div>{{/minustext}} {{#plustext}}<div class="sheet-plus">{{plustext}} {{computed::plus}}<br></div>{{/plustext}} {{#defenseroll_norm}}<div class="sheet-norm">{{defenseroll_norm}} {{computed::modifier}}</div>{{/defenseroll_norm}} </div> </div> </rolltemplate> on('clicked:defend', () => { getAttrs(['chardefenseselect','protectionpointsbonus','stressrune','focusrune','blightrune','curserune','bleedrune','frenzyrune','fetterrune','blessingrune','poisonrune','serumrune'], values => { const skill = values.chardefenseselect; const pp = parseInt(values.protectionpointsbonus)||0; const stressrune = parseInt(values.stressrune)||0; const focusrune = parseInt(values.focusrune)||0; const blightrune = parseInt(values.blightrune)||0; const curserune = parseInt(values.curserune)||0; const bleedrune = parseInt(values.bleedrune)||0; const frenzyrune = parseInt(values.frenzyrune)||0; const fetterrune = parseInt(values.fetterrune)||0; const blessingrune = parseInt(values.blessingrune)||0; const poisonrune = parseInt(values.poisonrune)||0; const serumrune = parseInt(values.serumrune)||0; const roll_string = `&{template:defend} {{title=Defense Roll}} {{defense_roll=[[3d6]]}} {{protectionpoints=[[@{${pp}}]]}} {{modifier=[[@{${skill}}]]}} {{plus=[[@{focusrune}+@{curserune}+@{frenzyrune}+@{blessingrune}+@{serumrune}]]}} {{minus=[[@{stressrune}+@{blightrune}+@{bleedrune}+@{fetterrune}+@{poisonrune}]]}} {{defenseroll_norm= Total: }} {{defenseroll= 3d6 Roll: }} {{modtext=Skill Bonus: + }} {{minustext= Rune Penalty: }} {{plustext= Rune Buff: }} {{pptext= Protection Points: }}` startRoll(roll_string, roll => { console.log(roll); let defensecheckresult = parseInt(roll.results.defense_roll.result)||0; let pp = parseInt(roll.results.protectionpoints.result)||0; let minus = parseInt(roll.results.minus.result)||0; let plus = parseInt(roll.results.plus.result)||0; let mod = parseInt(roll.results.skill.result)||0; defensechecktotal = defensecheckresult + mod + pp + plus - minus; roll.results.defense_roll.result = defensecheckresult; finishRoll(roll.rollId, { defense_roll: defensecheckresult, modifier: defensechecktotal, minus: minus, plus: plus, pp: pp }); }); }); });
1772734408
vÍnce
Pro
Sheet Author
Is it reading the actual value or using a fallback/default value like "0"? Just a thought, perhaps {{computed::pp}} should be {{computed::protectionpoints}} ?  
1772774236
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
You're trying to call the attribute in your roll string by assembling the attribute ref from the value of the attribute: {{protectionpoints=[[@{${pp}}]]}} But your variable pp holds the value of protectionpointsbonus, so that winds up trying to call an attribute named 1 or 5 or whatever number you have it currently set to. You just don't need the attribute call syntax there, so it should look like: {{protectionpoints=[[${pp}]]}}
1772793037
Mago
Pro
Sheet Author
i would also add a small correction to the input * the input has 2 class attributes, these should be combined into one and separated with a space * the input is improperly closed " <input class="skills"......>" it should be either  <input..../> or  <input.....>< / input>
1772810518
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Good catch on the duplicate class. But the input format Carnal is using is correct. HTML doesn't actually have self closing tags, it has void elements. This means that Html ignores the trailing "/” in  <input..../>, an d that  doing "<input.....></input>" is actually invalid html. If this was xml or svg, then the closing tag or self closing syntax would be needed.
Thank you all.  Turns out there were a few issues to hammer out. The end result is as follows: <label> +Protection Points: <input name="attr_protectionpointsbonus" class="skills" type="number" value="0" class="sheet-protectionpointsbonus"></label> <rolltemplate class="sheet-rolltemplate-defend"> <div class="sheet-container"> <div class="sheet-header"> {{#title}}<div class="sheet-title">{{title}}<br><br></div>{{/title}} {{#defenseroll}}<div class="sheet-defenseroll">{{defenseroll}} {{computed::defense_roll}}<br></div>{{/defenseroll}} {{#pptext}}<div class="sheet-pptext">{{pptext}} {{protectionpoints}}<br></div>{{/pptext}} {{#modtext}}<div class="sheet-modtext">{{modtext}} {{modifier}}<br></div>{{/modtext}} {{#minustext}}<div class="sheet-minus">{{minustext}} {{computed::minus}}<br></div>{{/minustext}} {{#plustext}}<div class="sheet-plus">{{plustext}} {{computed::plus}}<br></div>{{/plustext}} {{#defenseroll_norm}}<div class="sheet-norm">{{defenseroll_norm}} {{computed::defenseroll_norm_total}}</div>{{/defenseroll_norm}} </div> </div> </rolltemplate> on('clicked:defend', () => { getAttrs(['chardefenseselect','protectionpointsbonus'], values => { const skill = values.chardefenseselect; const pp = parseInt(values.protectionpointsbonus)||0; const roll_string = `&{template:defend} {{title=Defense Roll}} {{defense_roll=[[3d6]]}} {{defenseroll_norm_total=[[0]]}} {{protectionpoints=[[${pp}]]}} {{modifier=[[@{${skill}}]]}} {{plus=[[@{focusrune}+@{curserune}+@{frenzyrune}+@{blessingrune}+@{serumrune}]]}} {{minus=[[@{stressrune}+@{blightrune}+@{bleedrune}+@{fetterrune}+@{poisonrune}]]}} {{defenseroll= 3d6 Roll: }} {{modtext=Skill Bonus: +}} {{minustext= Rune Penalty: -}} {{plustext= Rune Buff: +}} {{pptext= Protection Points: +}} {{defenseroll_norm= Total: }}` startRoll(roll_string, roll => { console.log(roll); let defensecheckresult = parseInt(roll.results.defense_roll.result)||0; let protectionpoints = parseInt(roll.results.protectionpoints.result)||0; let minus = parseInt(roll.results.minus.result)||0; let plus = parseInt(roll.results.plus.result)||0; let mod = parseInt(roll.results.modifier.result)||0; const dnt = defensecheckresult + mod + protectionpoints + plus - minus; finishRoll(roll.rollId, { defenseroll_norm_total: dnt }); }); }); });