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

Custom character sheet not auto-calculating

Hi everyone, I've been trying to solve this issue with the forum and older posts but I can't seems to crack this nut. I'm trying to get a simple value tu be calculated but I think I've written something wrong somewhere. Firstly, I create basic attributes: <a href="https://pastebin.com/KupmVefk" rel="nofollow">https://pastebin.com/KupmVefk</a> Then, I want to auto-calculate something based on these stats. Si I create this code : <a href="https://pastebin.com/LUrhpt2e" rel="nofollow">https://pastebin.com/LUrhpt2e</a> But the item stays gray. What am I missing? PS: Thanks for reading.
1571460196

Edited 1571460380
GiGs
Pro
Sheet Author
API Scripter
Firstly for your attributes, I would make them type="number", and give them a default value, like &lt; input &nbsp; type = "number" &nbsp; name = 'attr_body' &nbsp; class = 'sheet-short' value="10" &gt; Change the value to whatever is an appropriate average for your system, or even 0. For your combined personal defence, you are missing the @ symbol on two of the attributes. I'd also add="true" to disabled (though I'm not sure if its needed - I cant remember ever doing it without.. &lt; input &nbsp; type = "number" &nbsp; name = "attr_combined_personal_defense" &nbsp; value = "(@{resilience} + @{mass_scale} + @{armor_bonus})" &nbsp;disabled="true"&gt; You havent included the code for mass_scale or armour_bonus so I cant tell if those attributes are defined correctly. You could true removing them and just have resilience here for testing purposes to make sure that is working. All that said, your issue is in the resilience attribute. This: &lt; input &nbsp; disabled = true&nbsp; type = "number" &nbsp; name = "attr_resilience" &nbsp; value = "((@{body} + @{will})/2, round up)" &gt; You cant have the text ",round up" in there - it'll be breaking the calculation. This should be &lt; input &nbsp; disabled = true&nbsp; type = "number" &nbsp; name = "attr_resilience" &nbsp; value = "ceil((@{body} + @{will})/2)" &gt; Ceil() is a function that rounds up anything in the brackets.
1571485195
Andreas J.
Forum Champion
Sheet Author
Translator
GiGs said: &lt; input &nbsp; type = "number" &nbsp; name = 'attr_body' &nbsp; class = 'sheet-short' value="10" &gt; What kind of sorcery did you use to get color highlighting in you code?!
1571498360
Wes
Sheet Author
Andreas J. said: GiGs said: &lt; input &nbsp; type = "number" &nbsp; name = 'attr_body' &nbsp; class = 'sheet-short' value="10" &gt; What kind of sorcery did you use to get color highlighting in you code?! Seconded.
1571504373
GiGs
Pro
Sheet Author
API Scripter
Haha, I just copied the code from Guillaume's pastebin, where it was already highlighted. Roll20's chat is built on html, and will keep compatible formatting applied from outside sources if you paste it in.
Everything worked GiGs. Thanks a lot! Learning to code in one night was not enough to spot these errors. :) Thank again.
I have another questions regarding the auto-calculation informations in my custom character sheet. ATM, I can't seem to create attributes with ''Resilience'' and CDP.&nbsp; There is no problem regarding the others attributes (will, body, agility, mind, mass_scale, armor_bonus) but I can't automatically create a resilience &amp; cdp attribute.&nbsp; &lt;div class="3colrow"&gt; &lt;div class="col"&gt; &lt;label&gt;Name:&lt;/label&gt;&lt;input type="text" name="attr_character_name" /&gt; &lt;/div&gt; &lt;div class="col"&gt; &lt;img src="<a href="https://gamepedia.cursecdn.com/inquisitormartyr_gamepedia/6/64/Favicon.ico" rel="nofollow">https://gamepedia.cursecdn.com/inquisitormartyr_gamepedia/6/64/Favicon.ico</a>" /&gt; &lt;/div&gt; &lt;div class="col"&gt; &lt;label&gt;Fudge Points:&lt;/label&gt;&lt;input type="number" name="attr_FP" value="0" /&gt; &lt;/div&gt; &lt;/div&gt; &lt;hr/&gt; &lt;div class="3colrow"&gt; &lt;div class="col"&gt; &lt;h2&gt;Attributes&lt;/h2&gt; &lt;label&gt;Body &lt;/label&gt;&lt;input type="number" name='attr_body' class='sheet-short' value="1"&gt; &lt;button type='roll' name='roll_testattack' value='&amp;{template:default} {{name=@{character_name}}} {{result=[[4df + @{body} + ?{Modificateur ?|0}]]}}'&gt;&lt;/button&gt;&lt;span class='dee'&gt;&lt;/span&gt; &lt;br /&gt; &lt;label&gt;Agility &lt;/label&gt;&lt;input type="number" name='attr_agility' class='sheet-short' value="1"&gt; &lt;button type='roll' name='roll_testattack' value='&amp;{template:default} {{name=@{character_name}}} {{result=[[4df + @{agility} + ?{Modificateur ?|0}]]}}'&gt;&lt;/button&gt;&lt;span class='dee'&gt;&lt;/span&gt; &lt;br /&gt; &lt;label&gt;Mind &lt;/label&gt;&lt;input type="number" name='attr_mind' class='sheet-short' value="1"&gt; &lt;button type='roll' name='roll_testattack' value='&amp;{template:default} {{name=@{character_name}}} {{result=[[4df + @{mind}+ ?{Modificateur ?|0}]]}}'&gt;&lt;/button&gt;&lt;span class='dee'&gt;&lt;/span&gt; &lt;br /&gt; &lt;label&gt;Will &lt;/label&gt;&lt;input type="number" name='attr_will' class='sheet-short' value="1"&gt; &lt;button type='roll' name='roll_testattack' value='&amp;{template:default} {{name=@{character_name}}} {{result=[[4df + @{will}+ ?{Modificateur ?|0}]]}}'&gt;&lt;/button&gt;&lt;span class='dee'&gt;&lt;/span&gt; &lt;br /&gt; &lt;br&gt; &lt;h2"&gt;Skills&lt;/h2&gt; &lt;fieldset class="repeating_skills"&gt; &lt;select name="attr_dtype" class="dtype"&gt; &lt;option value="Acrobat"&gt;Acrobat&lt;/option&gt; &lt;option value="Boucher"&gt;Boucher&lt;/option&gt; &lt;option value="Cambrioleur"&gt;Cambrioleur&lt;/option&gt; &lt;option value="Chimiste"&gt;Chimiste&lt;/option&gt; &lt;option value="Conducteur"&gt;Conducteur&lt;/option&gt; &lt;option value="Démineur"&gt;Démineur&lt;/option&gt; &lt;option value="Dresseur"&gt;Dresseur&lt;/option&gt; &lt;option value="Enquêteur"&gt;Enquêteur&lt;/option&gt; &lt;option value="Érudit (Ecclésiarchie)"&gt;Érudit (Ecclésiarchie)&lt;/option&gt; &lt;option value="Érudit (Guerre)"&gt;Érudit (Guerre)&lt;/option&gt; &lt;option value="Érudit (Imperium)"&gt;Érudit (Imperium)&lt;/option&gt; &lt;option value="Érudit (Pègre)"&gt;Érudit (Pègre)&lt;/option&gt; &lt;option value="Érudit (Technologie)"&gt;Érudit (Technologie)&lt;/option&gt; &lt;option value="Érudit hétérodoxe (Cultes)"&gt;Érudit hétérodoxe (Cultes)&lt;/option&gt; &lt;option value="Érudit hétérodoxe (Démonologie)"&gt;Érudit hétérodoxe (Démonologie)&lt;/option&gt; &lt;option value="Érudit hétérodoxe (Inquisition)"&gt;Érudit hétérodoxe (Inquisition)&lt;/option&gt; &lt;option value="Érudit hétérodoxe (Psykers)"&gt;Érudit hétérodoxe (Psykers)&lt;/option&gt; &lt;option value="Érudit hétérodoxe (Xenos)"&gt;Érudit hétérodoxe (Xenos)&lt;/option&gt; &lt;option value="Escroc"&gt;Escroc&lt;/option&gt; &lt;option value="Fêtard"&gt;Fêtard&lt;/option&gt; &lt;option value="Fusillier (Bolter)"&gt;Fusillier (Bolter)&lt;/option&gt; &lt;option value="Fusillier (Fusil à Pompe)"&gt;Fusillier (Fusil à Pompe)&lt;/option&gt; &lt;option value="Fusillier (Grav)"&gt;Fusillier (Grav)&lt;/option&gt; &lt;option value="Fusillier (Laser)"&gt;Fusillier (Laser)&lt;/option&gt; &lt;option value="Fusillier (Melta)"&gt;Fusillier (Melta)&lt;/option&gt; &lt;option value="Fusillier (Plasma)"&gt;Fusillier (Plasma)&lt;/option&gt; &lt;option value="Fusillier (Stubber)"&gt;Fusillier (Stubber)&lt;/option&gt; &lt;option value="Grenadier"&gt;Grenadier&lt;/option&gt; &lt;option value="Guerrier"&gt;Guerrier&lt;/option&gt; &lt;option value="Guêteur"&gt;Guêteur&lt;/option&gt; &lt;option value="Infiltrateur"&gt;Infiltrateur&lt;/option&gt; &lt;option value="Leader"&gt;Leader&lt;/option&gt; &lt;option value="Médecin"&gt;Médecin&lt;/option&gt; &lt;option value="Orateur"&gt;Orateur&lt;/option&gt; &lt;option value="Pilote"&gt;Pilote&lt;/option&gt; &lt;option value="Pistolier (Bolter"&gt;Pistolier (Bolter&lt;/option&gt; &lt;option value="Pistolier (Grav)"&gt;Pistolier (Grav)&lt;/option&gt; &lt;option value="Pistolier (Laser)"&gt;Pistolier (Laser)&lt;/option&gt; &lt;option value="Pistolier (Melta)"&gt;Pistolier (Melta)&lt;/option&gt; &lt;option value="Pistolier (Plasma)"&gt;Pistolier (Plasma)&lt;/option&gt; &lt;option value="Pistolier (Stubber)"&gt;Pistolier (Stubber)&lt;/option&gt; &lt;option value="Spécialiste des armes lourdes de tir (Bolter)"&gt;Spécialiste des armes lourdes de tir (Bolter)&lt;/option&gt; &lt;option value="Spécialiste des armes lourdes de tir (Grav)"&gt;Spécialiste des armes lourdes de tir (Grav)&lt;/option&gt; &lt;option value="Spécialiste des armes lourdes de tir (Laser)"&gt;Spécialiste des armes lourdes de tir (Laser)&lt;/option&gt; &lt;option value="Spécialiste des armes lourdes de tir (Melta)"&gt;Spécialiste des armes lourdes de tir (Melta)&lt;/option&gt; &lt;option value="Spécialiste des armes lourdes de tir (Plasma)"&gt;Spécialiste des armes lourdes de tir (Plasma)&lt;/option&gt; &lt;option value="Spécialiste des armes lourdes de tir (Stubber)"&gt;Spécialiste des armes lourdes de tir (Stubber)&lt;/option&gt; &lt;option value="Spécialistes des armes spécialisées"&gt;Spécialistes des armes spécialisées&lt;/option&gt; &lt;option value="Survivaliste"&gt;Survivaliste&lt;/option&gt; &lt;option value="Technoadepte"&gt;Technoadepte&lt;/option&gt; &lt;/select&gt; &lt;input type="number" name="attr_skillname" /&gt; &lt;button type='roll' name='roll_testattack' value='&amp;{template:default} {{name=@{character_name}}} {{result=[[4df + @{skillname} + ?{Modificateur ?|0}]]}}'&gt;&lt;/button&gt;&lt;span class='dee'&gt;&lt;/span&gt; &lt;/fieldset&gt; &lt;/div&gt; &lt;div class="col"&gt; &lt;h2&gt;Stats&lt;/h2&gt; &lt;div class="stats"&gt; &lt;label&gt;Mass Scale&lt;/label&gt;&lt;input type="number" name="attr_mass_scale" value="0" /&gt; &lt;label&gt;Armor bonus&lt;/label&gt;&lt;input type="number" name="attr_armor_bonus" value="0" /&gt; &lt;/div&gt; &lt;div class="col"&gt; &lt;h2&gt;Derived Stats&lt;/h2&gt; &lt;div class="derived_stats"&gt; &lt;h3&gt;Resilience&lt;/h3&gt; &lt;input disabled=true type="number" name="attr_resilience" value="ceil((@{body} + @{will})/2)"&gt; &lt;h3&gt;Combined Personnal Defense&lt;/h3&gt; &lt;input type="number" name="attr_combined_personal_defense" value="(@{resilience} + @{mass_scale} + @{armor_bonus})" disabled="true"&gt; &lt;/fieldset&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="col"&gt; &lt;h2"&gt;Gift&lt;/h2&gt; &lt;fieldset class="repeating_gift"&gt; &lt;select name="attr_dtype" class="dtype"&gt; &lt;option value="Agilité féline"&gt;Agilité féline&lt;/option&gt; &lt;option value="Air d'autorité"&gt;Air d'autorité&lt;/option&gt; &lt;option value="Alerte"&gt;Alerte&lt;/option&gt; &lt;option value="Ambidextre"&gt;Ambidextre&lt;/option&gt; &lt;option value="Balèze"&gt;Balèze&lt;/option&gt; &lt;option value="Bonne réputation (doit choisir groupe)"&gt;Bonne réputation (doit choisir groupe)&lt;/option&gt; &lt;option value="Bras musclés"&gt;Bras musclés&lt;/option&gt; &lt;option value="Chanceux"&gt;Chanceux&lt;/option&gt; &lt;option value="Chirurgie de campagne"&gt;Chirurgie de campagne&lt;/option&gt; &lt;option value="Connexion psychique"&gt;Connexion psychique&lt;/option&gt; &lt;option value="Esquive"&gt;Esquive&lt;/option&gt; &lt;option value="Flambeur"&gt;Flambeur&lt;/option&gt; &lt;option value="Gâchette facile"&gt;Gâchette facile&lt;/option&gt; &lt;option value="Haîne (doit choisir race)"&gt;Haîne (doit choisir race)&lt;/option&gt; &lt;option value="Maître du combat (1,2,3)"&gt;Maître du combat (1,2,3)&lt;/option&gt; &lt;option value="Poignet d'acier"&gt;Poignet d'acier&lt;/option&gt; &lt;option value="Réaction rapide"&gt;Réaction rapide&lt;/option&gt; &lt;option value="Résistant"&gt;Résistant&lt;/option&gt; &lt;option value="Sans peur"&gt;Sans peur&lt;/option&gt; &lt;option value="Tolérant"&gt;Tolérant&lt;/option&gt; &lt;/select&gt; &lt;input type="text" name="attr_giftname" placeholder="Définir l'effet" /&gt; &lt;/fieldset&gt; &lt;br&gt; &lt;h2"&gt;Fault&lt;/h2&gt; &lt;fieldset class="repeating_fault"&gt; &lt;select name="attr_dtype" class="dtype"&gt; &lt;option value="Agé"&gt;Agé&lt;/option&gt; &lt;option value="Avare"&gt;Avare&lt;/option&gt; &lt;option value="Code d'honneur"&gt;Code d'honneur&lt;/option&gt; &lt;option value="Cœur tendre"&gt;Cœur tendre&lt;/option&gt; &lt;option value="Curieux"&gt;Curieux&lt;/option&gt; &lt;option value="Don Juan"&gt;Don Juan&lt;/option&gt; &lt;option value="Facilement distrait"&gt;Facilement distrait&lt;/option&gt; &lt;option value="Glouton"&gt;Glouton&lt;/option&gt; &lt;option value="Humanitaire"&gt;Humanitaire&lt;/option&gt; &lt;option value="Indécis"&gt;Indécis&lt;/option&gt; &lt;option value="Jaloux"&gt;Jaloux&lt;/option&gt; &lt;option value="Loyal à ses supérieurs"&gt;Loyal à ses supérieurs&lt;/option&gt; &lt;option value="Mâcho"&gt;Mâcho&lt;/option&gt; &lt;option value="Manque de tact"&gt;Manque de tact&lt;/option&gt; &lt;option value="Naïf"&gt;Naïf&lt;/option&gt; &lt;option value="Obsessif"&gt;Obsessif&lt;/option&gt; &lt;option value="Pointilleux"&gt;Pointilleux&lt;/option&gt; &lt;option value="Soupe au lait"&gt;Soupe au lait&lt;/option&gt; &lt;option value="Susceptible"&gt;Susceptible&lt;/option&gt; &lt;option value="Tête brûlée"&gt;Tête brûlée&lt;/option&gt; &lt;option value="Têtu"&gt;Têtu&lt;/option&gt; &lt;/select&gt; &lt;input type="text" name="attr_faultname" placeholder="Définir l'effet" /&gt; &lt;/fieldset&gt; What would be the issue? Thanks a lot, G
1571541605

Edited 1571541713
GiGs
Pro
Sheet Author
API Scripter
You hve an error in your html on line 36, an unneeded " inside the h2 element turning everything from lines 36-122 into an unparseable string. This line &lt;h2"&gt;Skills&lt;/h2&gt; Should be &lt;h2&gt;Skills&lt;/h2&gt; When you fix that, you'll have a similar issue on line 122 &lt;h2"&gt;Gift&lt;/h2&gt; Then again on line 156 &lt;h2"&gt;Fault&lt;/h2&gt;
GiGs said: You hve an error in your html on line 36, an unneeded " inside the h2 element turning everything from lines 36-122 into an unparseable string. This line &lt;h2"&gt;Skills&lt;/h2&gt; Should be &lt;h2&gt;Skills&lt;/h2&gt; I both love and hate coding. Thanks a lot! :)
1571541771
GiGs
Pro
Sheet Author
API Scripter
You replied too quickly, haha, i edited my reply to point out other lines. You can see these errors in the way the code turns yellow, instead of the proper syntax highlighting.
1571542136

Edited 1571542315
-G-
Pro
GiGs said: You replied too quickly, haha, i edited my reply to point out other lines. You can see these errors in the way the code turns yellow, instead of the proper syntax highlighting. I've fixed the errors you've highlighted but I can't seem to get the attributes for ''resilience'' or''combined personal defense'' to show up on the attributes &amp; abilities page. EDIT: Strangely, I can refer to these attributes in marco though. But it will not show itself into the Attributes &amp; Abilities page. Didn't read enough roll20 documentation to know if it's normal or not.&nbsp;
1571542329
GiGs
Pro
Sheet Author
API Scripter
The attributes part of that page should be ignored when you're building a character sheet. It's primarily meant for people who arent using character sheets. In any case, autocalculated attributes will never show up there. They do exist, as you should be able to see on the character sheet tab.