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

Having issues with calculating in custom character sheet

November 29 (4 years ago)

Hello everyone! I've been working on a custom character sheet and I've seemed to have run into an issue with my html, maybe someone can point out what I'm not seeing or understanding here. I essentially have my players Max HP be "(Constitution*2)+(Level*2)", but it's not outputting anything other than a blank square at all times. I've successfully done something similar with critical and dodge chances but I can't seem to locate the problem.

Script part in question:

Level: <input name="attr_level" type="number" value="0"> <br><br>
Max Health: <input name="attr_maxhp" type="number" value="(@{level}*2)+(@{constitution}*2)" disabled=true style="width:70px">
Constitution: <input name="attr_constitution" type="number" value="0"><button type="roll" value='/roll 1d20 + @{constitution}'></button>

And for comparison, the dodge/crit equations:

Critical Chance: <input name="attr_crit" type="number" value="(round(@{dexterity}*2))+@{excrit}" disabled=true><br><br>
Dodge: <input name="attr_dodge" type="number" value="(round(@{dexterity}*1.75))+@{exdodge}" disabled=true><button type="roll" value='/roll 1d100 + @{dodge}'></button><br><br>

November 29 (4 years ago)

Edited November 29 (4 years ago)
vÍnce
Pro
Sheet Author

Hi Diogo,

"but it's not outputting anything other than a blank square at all times."

What do you mean exactly?  If you call @{selected|maxhp} in chat do you get a value?  I'm guessing that you're referring to the token's max field for linking attributes?


the code looks fine in and of itself... but, a recommended practice for including an attribute's max value is to use "_max" appended to an existing attribute name ie name="attr_hp_max" so that linking tokens will automatically recognize the max value for the token bars.

So for example, you might have an input for HP @{hp} as

<input type="number" name="attr_hp" value="0" />

and it's max attribute @{hp|max} as 

<input type="number" name="attr_hp_max" value="(@{level}*2)+(@{constitution}*2)" disabled="true" />

I think that should solve a blank max field on linked token attributes.  If that's not the case... apologies if I misinterpreted the issue. ;-)

November 29 (4 years ago)

Problem ended up solving itself somewhat. Turns out it was just a preview sheet bug, as I tested some other functions in the sheet itself ingame, it was working as intended, thanks anyways tho!

November 29 (4 years ago)
vÍnce
Pro
Sheet Author

"Preview"  Enough said.  ;-)

November 29 (4 years ago)
Andreas J.
Forum Champion
Sheet Author
Translator

Diogo P. said:

Turns out it was just a preview sheet bug, as I tested some other functions in the sheet itself ingame, it was working as intended, thanks anyways tho!

Not as much a bug as a well-known problem with the preview, which is unreliable and should be trusted for checking anything than the most superficial changes.

Number 4 on the list: https://wiki.roll20.net/Building_Character_Sheets#Common_Mistakes