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

Spellcasting DC \ Difficulty autocalc

1589902179

Edited 1589902331
Chomik
Pro
Sheet Author
So I have this formula for counting characters Spells DC - I suspect I cannot reference spell_ability value to use modifier from it by using formula like  @{@{spell_ability}_mod} ? <div class="sheet__spell">       <h2>          Spells       </h2>   Spellcasting Ability  <select id="spell_ability">   <option value="null">None</option>       <option value="int">Intelligence</option>   <option value="wis">Wisdom</option>   <option value="cha">Charisma</option>   </select> </br>      Spells Difficulty <input class="input" type="number" disabled="true" name="attr_spells_dif" value="8+@{@{spell_ability}_mod}+@{prof}" />
1589902641

Edited 1589902801
GiGs
Pro
Sheet Author
API Scripter
You cant built up attributes like that, due to oll20's order of operations. You must always supply the full attribute name. What you can do is put the attribute call in the select options: <div class="sheet__spell">     <h2>         Spells     </h2>     Spellcasting Ability     <select id="spell_ability">         <option value="0">None</option>         <option value="@{int_mod}">Intelligence</option>         <option value="@{wis_mod}">Wisdom</option>         <option value="@{cha_mod}">Charisma</option>     </select> </br>     Spells Difficulty <input class="input" type="number" disabled="true" name="attr_spells_dif" value="8 +@{spell_ability} +@{prof}" />
1589905900
Chomik
Pro
Sheet Author
Stupid me! However, it not transferred what we wanted... :(
1589906204
GiGs
Pro
Sheet Author
API Scripter
The problem is most likely this line <select id="spell_ability"> It should be <select name="attr_spell_ability">
1589906605
Chomik
Pro
Sheet Author
Thanks - changed to your proposed lines - and it worked. ;) Each time you change Spell Ability, it makes other number - even with chosen option 'None'. But I can live with it, if this is unavoidable.
1589908970
GiGs
Pro
Sheet Author
API Scripter
Depending on how you using values, this might work <select id="spell_ability">         <option value="0">None</option>         <option value="8 + @{int_mod}+@{prof}">Intelligence</option>         <option value="8 + @{wis_mod}+@{prof}">Wisdom</option>         <option value="8 + @{cha_mod}+@{prof}">Charisma</option>     </select> </br>     Spells Difficulty <input class="input" type="number" disabled="true" name="attr_spells_dif" value=" @{spell_ability} " />
1589911209
Chomik
Pro
Sheet Author
Not working this solution... :/
1589939210

Edited 1589939226
GiGs
Pro
Sheet Author
API Scripter
I forgot to correct the name, which I'd mentioned in the previous post.     <select name="attr_spell_ability">         <option value="0">None</option>         <option value="8 + @{int_mod}+@{prof}">Intelligence</option>         <option value="8 + @{wis_mod}+@{prof}">Wisdom</option>         <option value="8 + @{cha_mod}+@{prof}">Charisma</option>     </select> </br>     Spells Difficulty <input class="input" type="number" disabled="true" name="attr_spells_dif" value=" @{spell_ability} " />
1590037793
Chomik
Pro
Sheet Author
Thanks, this setting solves all the problems I have. Once more, thank you for support here! :)
1590039204
GiGs
Pro
Sheet Author
API Scripter
Great! and thank you :)