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

Can Api change every character in a game.

I have a friend wanting to make a age stat go up one on every sheet in his game with one button or command, He has to many sheets to wanna do each separate, when I year in the game is done, but really wants to keep track of age for game reasons. 
1674093297
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Where does he want to store the stat? If it is an existing sheet attribute (i.e. one that displays on the main sheet, then it could be done with a script. In this case, a script is needed to add an attribute to all existing sheets in the game. ChatSetAttr would be the script for this. If he just wants to return the age to chat upon running a macro, that would be easier. The second one could be done by adding a custom attribute called "birthdate" or somesuch, and then storing the current year on a specific sheet, let's call it "Calendar". Then he could run a macro while selecting the character token, like: /w gm Character is [[@{Calendar|year}-@{selected|birthdate}]] years old. Setting each character's date could also be done using ChatSetAttr, using a query for the year. If not all characters have tokens, it could need to be more manual.
1674093698
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
If you don't want to have a calculation, create the Campaign year attribute as above. Lets say, "1893". Then give each character an attribute called "years" that has the formula: [[@{Campaign|year}-1500]] Where "1500" is the character's birth year. then you can just return the value with @{Charactername|years}  Or do a selected token with @{selected|years}  This would give each character a static birth year, and only require the GM to update the Calendar|year attribute.
The same as  this post ?
1674094430
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Looks like it. Two posters from same campaign? Anyway, it looks like we both gave pretty much the same answer. :D
Thanks for the info on it, I can probably do something with this then. I didn't know he had posted as well, I apologize for that.
1674104321
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
No worries! It's just funny.
1674105541
GiGs
Pro
Sheet Author
API Scripter
Note that if you have an existing numerical attribute, you can use the chatSetAttrs script and change the value of that attribute on every character at once. It does need to be stored as an attribute, not something on the Bio tab.
1674109807
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
GiGs said: Note that if you have an existing numerical attribute, you can use the chatSetAttrs script and change the value of that attribute on every character at once. Each character would need to have a unique birth year, though. You could create an identical attribute for each, and then just manually edit the result, saving a step.