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

input link between token and custom sheet

1587650249

Edited 1587729262
I try to link an input (hit points and nonlethal damage ) in the sheet to the token, but I got a strange behavior  with a standard input no problem : <input name="attr_hit_points" type="number" value="" label="" /> <input name="attr_hit_points_max" type="number" value="" label="" /> but I had some difficulties with an input using calculated value, I tried this first : <input name="attr_hit_points" type="number" value="@{var1}+@{var2}" disabled="disabled" label="" /> <input name="attr_hit_points_max" type="number" value="@{var3}+@{var4}" disabled="disabled" label="" /> but with no succes at a point I have tried something like  : <input name="attr_hit_points" type="number" value="@{hit_points_base}" label="" /> <input name="attr_hit_points_max" type="number" value="@{hit_points_max_base}" label="" /> <input name="attr_hit_points_base" type="hidden" value="@{var1}+@{var2}" disabled="disabled" label="" /> <input name="attr_hit_points_max_base" type="hidden" value="@{var2}+@{var3}" disabled="disabled" label="" /> And now I got one token linked correctlty and the others don't ( in a same game ) I retried the previous point with no succes ; I am not able to repeat the manipulation :( for the records, the name contains some underscore but without I have the same issue some one got a similar situation ?
1587651839

Edited 1587652019
Andreas J.
Forum Champion
Sheet Author
Translator
Firstly, you need to have "attr_" at the start of the attribute names so that they will be saved properly to the sheet: <a href="https://wiki.roll20.net/Building_Character_Sheets#Common_Mistakes" rel="nofollow">https://wiki.roll20.net/Building_Character_Sheets#Common_Mistakes</a> I'm not sure about the how the linking sheet stats to tokens by defaults is done, and your attempted process is unfamiliar to me, I think whatever you're attempting to do should likely be done in a completely different way. Someone else might know better.
1587653092

Edited 1587728613
damned I miss the attr_ prefix ( not in my game but here for the example, I change that ), thank you for the remark
I think there is a current bug where you cannot link autocalculated fields to tokens.
1587670284
GiGs
Pro
Sheet Author
API Scripter
autocalc attributes have never worked great with token bars - especially since as soon as you edit them, it breaks the link with the sheet (since it doesnt match the calculation any more). If you want to link a calculated attribute to a token bar, you need to calculate it with a sheet worker. Iwas going to suggest a sheet worker to do this, then noticed your hit points and hp_max attributes are calculated differently: &nbsp; &nbsp;&lt;input name="attr_hit_points_base" type="hidden" value="@{var1}+@{var2}" disabled="disabled" label="" /&gt; &nbsp;&nbsp; &lt;input name="attr_hit_points_max_base" type="hidden" value="@{var2}+@{var3}" disabled="disabled" label="" /&gt; is that intentional? Also, i hope var1, var2, and var3 arent the actual names for these values. They should be something more descriptive, like "health" or "constitution".
1587718614

Edited 1587720431
@rabulias If it's a bug, And when I am sure I didn't make a code mistake, I will report this @GiGs for this example I simplified the code ( I sticking to xhtml as an habitude since years ^^ ) For further explications of my code, I code a Pathfinder sheet and I try to show in a header the current health ( hit-points, nonlethal damage, wound, vigor), the calcul are shown in the body. For hit-points in particular I have : hit_points = hit_points_base + hit_points_miscelleanous + hit_points_temporary + hit_points_status hit_points_max = hit_points_ceiling + hit_points_status all value are number inputs, exept hit_points_status is calculed with a ECMAscript function the code sample you give correspond to my second example, but it's dont work, so far : link a number input to a token work link a number input with attribute disabled to a token don't work link a hidden input with attribute disabled to a token don't work link a hidden input with attribute disabled link to a number input to a token don't work remove underscore in name don't change a bit remove the text/worker code change nothing I made some other test, I tried to link to the token some inputs : for number input with value="" it's ok ( ok with or without attributes min, max or step ) for text input (with number value ) it's&nbsp; work only on changing the bar variable ( not updated after that ) for number input with value calculated it's not working ( exept one time but I am not able to repeat that ) so a dirty solution is to use an number input with attribute readonly , link it to a token, and change the value with the a ECMAscript code