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

[Help] Rest Script not working

I'm using the script I saw someone wrote for long rests (5e) and while it seems to be working fine for most things I find it is not resetting the Ki (class resource) like it should. I am using: !longrest @{selected|character_name} !setattr --silent --sel --hp|@{selected|hp|max} !setattr --silent --sel --class_resource|@{selected|class_resource|max} &{template:npcaction} {{name=@{selected|character_name}}} {{rname=Long Rest}} {{description=Reset HP, Spell Slots, @{selected|class_resource_name}}} What am I missing?
1608407780
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Assuming this is the D&D 5th Edition by Roll20 Companion. I don't believe it touches resources. There are three Rest scripts in the API that will cover them, though.
1608418006
Oosh
Sheet Author
API Scripter
@{class_resource} is the left resource field on the top row. If the Ki points are anywhere else, they won't be restored. The right hand resource is @{other_resource}, then the rest of the rows are part of a repeating field: @{repeating_resource_$0_resource_left} and @{repeating_resource_$0_resource_right} would be the second row, with the $0 increasing by 1 for each row after that. ChatSetAttr is just following the Attribute name, there's nothing stopping someone from tracking their rations with the "class_resource" Attribute. There might be a more specialised rest script that searches the names of the resource section, but if you're using chatSetAttr you need to point it to the right location. It also has a shortcut for setting a field to its max value: !resetattr --silent --sel --other_resource would set the top right resource to its max value. If the Ki points are already in the right place, maybe they don't have a valid max value set?
1608424359

Edited 1608425190
It's in the class resource field (other resource is arrows, don't want to reset that) and has 5 in the top box (with 3 current).  I'm just at a loss
1608434135
Oosh
Sheet Author
API Scripter
So you get the correct values by typing @{selected|class_resource} and @{selected|class_resource|max} into chat? Does the !resetattr syntax work? Maybe get rid of --silent as well: !resetattr --sel --class_resource and try a direct reference to the character id, and a flat integer too: !setattr --charid @{bob|character_id} --class_resource|5 Any difference?
I appreciate all the help (thank you all a lot), I may end up going back to some of those options if we end up with unusual resources.  What I'm doing now is running the Rest-and-Recovery script combined with !setattr --silent --sel --hp|@{selected|hp|max} and that seems to be doing the job more or less for now, with some wonkiness with where Wild Shape is referenced, but I've made it work more or less.