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

Method for Setting all Attributes to their Max Value Help (SetAttribute API)

February 06 (6 months ago)

Edited February 06 (6 months ago)

Heya to anyone who can potentially help me with this!


I'm looking for a method using the SetAttribute API to reset all of a characters attribute values back to their maximum. I know there is a brute force method way for doing this (by inputing every attribute to reset manually to the max value) but I was curious if anyone knows of a method to reset all of a character's attributes without manually including all of the potential attributes a character sheet might have. I'm not beyond brute forcing it for each individual character, but if there was a method to do all attributes without having to denote each one it would allow for a much easier time of reseting attributes for characters who have different attributes listed on their character sheets. 


I'm only using the base roll20 character attributes rather than an actual character sheet so there's no need for specific sheet references for this.

February 06 (6 months ago)

Edited February 06 (6 months ago)
Gauss
Forum Champion

Hi Astaria, 

I would use ChatSetAttr for this. Readme for ChatSetAttr.

Something like this should work: 
!setattr --sel --attributename|@{selected|attributename|max}

Note: replace attributename with the name of the attribute. 
You use it by selecting the tokens, then use the command. 

If you'd rather have it hit every character in the game you can use this command: 
!setattr --All --attributename|%attributename_max%

February 07 (6 months ago)
GiGs
Pro
Sheet Author
API Scripter

There's no way to do this without explicitly naming every attribute.

February 07 (6 months ago)

That is unfortunately what I was expecting. Thanks for the responses!

February 07 (6 months ago)
timmaugh
Forum Champion
API Scripter

Or a dedicated script. Shouldn't be hard...

Easy part is ask the user to designate a character and get all attributes that belong to that character; step through those attributes and if there is a max value, set the current to that max.

Hard part is fighting scope creep. =D "Maybe you want to freeze a 'current status' of a character, so that all of the attributes could be dumped to a handout and you could reset the character to this present condition instead of resetting to max?" That sort of thing.