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 - HTML access to Max attribute ?

Bubz ! I searched in the forum but I didn't find any topic about my problem. In "Attributes & Abilities" page, we have the current and max values of something "health", "mana" etc... <a href="http://puu.sh/oZRCO/c5f8033077.png" rel="nofollow">http://puu.sh/oZRCO/c5f8033077.png</a> I made my own character sheet for my campaign and in HTML I can ask or put a value to the CURRENT area, but how can I do it do the MAX ? Even if I'm a beginner in HTML/CSS, I have made this (for example, and yes I'm french :D) : <a href="http://puu.sh/oZRQY/80e441a301.png" rel="nofollow">http://puu.sh/oZRQY/80e441a301.png</a> In fact, I would like to input a value in CURRENT HP (by default in Roll20) AND in the max, not to be forced to do it myself (or by players) each time.. Or, is it possible in HTML to have a command depending of an entered value (like the number entered in HP) that could be linked to the MAX (I think I'm not understandable XDD) ? Thanks for your help !
1463848461

Edited 1463848490
Lithl
Pro
Sheet Author
API Scripter
Current hp: &lt;input type="number" name="attr_hp"&gt; Max hp: &lt;input type="number" name="attr_hp_max"&gt; HP percentage: &lt;input type="number" name="attr_hp-percent" disabled="disabled" value="round(@{hp} / @{hp|max})"&gt; That will correctly fill in both fields of the attribute. You can also see an example of using both in an autocalc field with @{hp-percent} above.
Oh thanks for your answer, but it need me to ask 2 times about the HP, so it's impossible to use the SAME input for 2 values, isn't it ? In fact, I would like to use the same field in the character sheet ( <a href="http://puu.sh/p0vsv/0d83ecdb84.jpg" rel="nofollow">http://puu.sh/p0vsv/0d83ecdb84.jpg</a> ) (so here 21HP) to complete both values CURRENT and MAX in the attribute sheet ( <a href="http://puu.sh/p0vuq/36796b0d33.png" rel="nofollow">http://puu.sh/p0vuq/36796b0d33.png</a> ) (so here 21/21). Is it possible in HTML or should I really have 2 different fields (and so inputs) in my character sheet ? I'm really sorry if my question could be stupid, even a little bit, but I really like Roll20 and it's systems and I really want to improve my HTLM.. ^-^"
1463907223
Lithl
Pro
Sheet Author
API Scripter
I don't think one field to set HP and HP_max makes very much sense. However, you could do it using a sheet worker. &lt;script type="text/worker"&gt; on('change:hp', function() { getAttrs(['hp'], function(values) { setAttrs({ hp_max: values.hp }); }); }); &lt;/script&gt; &lt;input type="number" name="attr_hp"&gt; &lt;input type="number" name="attr_hp_max" readonly="readonly"&gt;
1463911903
Finderski
Pro
Sheet Author
Compendium Curator
I agree with Brian. &nbsp;Though if you do use the sheet worker solution, I would recommend having them set the max and have that update hp on change. Because if you do the hp updating max, whenever someone takes damage, the max value would update as well. &nbsp;If you do that, though, don't set the hp field to readonly, you'd need it leave it editable, so the players could update the hp field whenever they take damage or heal.&nbsp;
1463939708
Lithl
Pro
Sheet Author
API Scripter
G V. said: I agree with Brian. &nbsp;Though if you do use the sheet worker solution, I would recommend having them set the max and have that update hp on change. Because if you do the hp updating max, whenever someone takes damage, the max value would update as well. &nbsp;If you do that, though, don't set the hp field to readonly, you'd need it leave it editable, so the players could update the hp field whenever they take damage or heal.&nbsp; At which point, you've got 2 fields again for HP and HP_max, you're just adding a sheet worker to heal you when you update your max HP. Which is exactly the sort of reason you and I agree one field to set both doesn't make sense. =)
1464262935

Edited 1464307343
Hem okay, thanks for your answers (and sorry for the time I answer you) ! That was just for a character sheet filling ease but well, I just thought today and realized that just doing name="hp_max" was really enough and let me decide of the life of my players at the beginning.... But I still have a question : In fact, I'm doing a list with &lt;select&gt;&lt;option&gt; for players to choose their armor, like this : <a href="http://puu.sh/p6mON/de2a12b02e.jpg" rel="nofollow">http://puu.sh/p6mON/de2a12b02e.jpg</a> I would like to use 1 choice "plate armor" for example. What I want is to input "Plate armor" in the current value AND with this choice, to input the value of THIS armor in the MAX attribute. Do you think it would be possible ? (if the answer is still about a sheet worker, I still don't really understand what's this, exactly, or how to use it... :/) Thank you for the "_max" and sorry (really) for my... newbie questions ? X)