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 .
×

Setting max HP using ChatSetAttr

I am trying to set up a macro to set HP automatically, using ChatSetAttr and the Shadowdark RPG sheet. Here's how the hp boxes look in the sheet code:                                         <label for="pc_hp_current" title="Hit Points">HP</label> <input type="text" class="sd-num" name="attr_hp" title="@{hp}" id="pc_hp_current" placeholder="HP"> <span>/</span> <input type="text" class="sd-num" name="attr_hp_max" title="@{hp_max}" id="pc_hp_max" placeholder="Max"> The macro appears to work correctly. This message pops up in chat: And the hp attribute is indeed set to 5. But it does not actually set hp_max to 5. A hp_max attribute appears with the correct value on the Attributes & Abilities tab, but the hp_max box on the sheet itself stubbornly refuses to change to anything other than 1. This isn't something specific to the way I wrote the rolls in the macro. Just using something like: !setattr --sel --hp_max|5 does the same thing. Can anyone see what I'm doing wrong?
1777135409

Edited 1777135601
Gauss
Forum Champion
Hi Jan K.,  Try this:  !setattr --sel --hp||5 The base attribute name is hp, not hp_max.  It can be a bit confusing because sometimes someone names things attribute_something else so it might be attribute_max.  But Roll20 also uses _max or |max as part of the basic structure for an attribute.  ChatSetAttr uses the following structure:  --attributename|current|max where |current is the value you want to place in current and |max is the value you want in max. 
Gauss said: Hi Jan K.,  Try this:  !setattr --sel --hp||5 The base attribute name is hp, not hp_max.  It can be a bit confusing because sometimes someone names things attribute_something else so it might be attribute_max.  But Roll20 also uses _max or |max as part of the basic structure for an attribute.  ChatSetAttr uses the following structure:  --attributename|current|max where |current is the value you want to place in current and |max is the value you want in max.  That works. Perfect, thank you.