Hi guys, I'm trying to do a pretty simple feature on my sheet (for WFRP 1) which consists in having a display for the hero's HPs juxtaposed to its max, and I want the user to change the HP count using 2 simple buttons. Eventually I'll try to have these buttons do more like ask the user for a number of hit point to recover. I'll also use a similar logic to prompt the user to write a quick comment about where the points are going for more critical stuff like "fate" points. For now though, all my buttons do is either add or remove one HP. (sorry for the double pic. I have no idea why it's printing in double) Here the max value you see is read correctly from the character's stats table. It is itself an expression that cumulates the initial value and a bunch of modifiers. Both the current and max HP fields are disabled, so that they may only be modified by using the buttons. Here's the onion. I want to have a simple condition inside my function that limits the HP from going over the max. on("clicked:heal_hp", function() { getAttrs(["hidden_present_hp", "Max_HP"], function(v) { let hidden_hp = parseFloat(v["hidden_present_hp"]); let max_hp = parseFloat(v["Max_HP"]); let u = {}; if (hidden_hp < max_hp) { u["hidden_present_hp"] = hidden_hp + 1; } setAttrs(u); }); }); simple enough. Here hidden_hp is because I used the trick they give in the doc for modifying a disabled field: """ Note: If you are trying to update a disabled input field with this method you may run into trouble. One option is to use this setAttrs method to set a hidden input, then set the disabled input to the hidden element. In this example we have an attribute named will , and we want to calculate judgement based off 1/2 of the will stat, but not to allow it to exceed 90. See below. < label > Judgment < /label >
< input type = "hidden" name = "attr_foo_judgment" value = "0" / >
< input type = "number" name = "attr_judgment" value = "@{foo_judgment}" disabled = "true" title = "1/2 of will rounded down, 90 max" / > """ Mine looks like this: < td > < input type = "hidden" name = "attr_hidden_present_hp" value = "0" /> < input type = "number" name = "attr_Present_HP" value = "@{hidden_present_hp}" disabled /> </ td > < td >< input type = "number" name = "attr_Max_HP" value = "@{Current_HP}" disabled /></ td > """ My problem is that my if doesn't work. And if I try to display the value of max_hp, I get either a constant number that seems to come from nowhere, or nothing happens at all. If I don't put an if, and just leave it as simplistic as it can be (the "heal" button will add 1 hp no matter what, even if the value exceeds the displayed max), it works. Unfortunately I haven't found out how to output logs from the character sheet sandbox, so that doesn't help. But here's my guess: the "value" attribute for attr_hidden_present_hp is easily convertible to a numerical value. In fact, I know it has to be converted to a number using parseFloat because if I don't do it, the operation hidden_hp + 1 just ends up appending a "1" character and I end up with "01", "011", "0111", etc. But "@{Current_HP}", not so much. And so it returns nonsense or Null or something like that. So... with all that said, how do I obtain a numerical value from the expression in my "value" attribute?