[Script] ChatSetAttr - set character attributes via chat messages


Edited 1492386426
I know this is probably asked a lot but how do I round with this? The following is not working (of course): !setattr --allplayers --evaluate --mod --hit_dice|floor(%hit_dice_max%/2) I tried to find the answer my self but couldn't. All help appreciated.
Im assuming your building a Long rest macro that adds the players hit dice back based on 1/2 their level? I use this macro !setattr --sel --modb --hit_dice|[[floor(@{selected|level}/2)]]
Just so! However, with that system I would have to individually select each character and run the macro, which is what I am trying to avoid. :/
If I cannot round without using @selected, could I perhaps set a separate attribute beforehand? eg: !setattr --sel --replace --hit_dice_add|floor(`{selected|level}/2) !setattr --modb --allplayers --hit_dice|%hit_dice_add% However the above example simply results in "nothing to do for character".

Edited 1492394392
Well without the selected I dont know how the macro would determine each players level (assuming they were diff levels). I use the one I mentioned as a Token macro for each PC, I also add other stuff based on class. Works great for me. I make it a Token Macro bc then, they are all ready selected :)
Try this (after taking the necessary precautions): !setattr --allplayers --evaluate --modb --hit_dice|Math.floor(%hit_dice_max%/2)
I am try to get !setattr to work with resource name instead of @{repeating_resource_$0_resource_left} So something like !setattr --name @{selected|character_name} --mod --Potion of Healing|-1 --silent

Edited 1492487496
You could do this: Add an Attribute to your Character named Potion of Healing Give that Attribute a Current value of repeating_resource_$0_resource_left (or repeating_resource_ RowID _resource_left) Then, you could use this: !modbattr --silent --name @{character_name} --@{Potion of Healing}|-1

Edited 1492643799
Silvyre said: Try this (after taking the necessary precautions): !setattr --allplayers --evaluate --modb --hit_dice|Math.floor(%hit_dice_max%/2) This works perfectly, though I elected to use Math.round() instead of Math.floor() so as to avoid level 1 characters regenerating no Hit Die. Thank you for replying. :)