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

Unable to print out an Attribute value via Macro?

January 24 (8 years ago)
I want to print out a character's Action Point value in the same roll template used to attack and to parry. AP is a value that decreases each time you take an action in a combat round, and a round continues until every participant has reached 0. After that everyone's AP resets and a new round begins. Ideally, I want to take a character's current value and subtract it by one before printing it out but it seems I'm not allowed to do that. Am I doing something wrong or is this a feature I need a Pro subscription to use?



January 24 (8 years ago)

Edited January 24 (8 years ago)
The Aaron
Pro
API Scripter
From the first image, it looks like your action_points attribute only has a value in the max field.  Try using:
@{selected|action_points|max}

Changing the value of an attribute can only be automated with the API, which is a Pro Subscriber Perk.
January 24 (8 years ago)

Edited January 24 (8 years ago)
Your suggestion returned this in the chat:
Rolf has ((ceil(((13+0)+(14+0))/12)+0)+0) left.

action_points has four different variables used for calculations in the character sheet, action_points, action_points_std, action_points_temp and fatigue_action_points. As I understand it, action_points is the maximum value derived from std + temp * fatigue. std is the value derived from character attributes, temp is a box you can input whatever in the sheet and fatigue is a modifier that screws over your character with several levels.

Looking inside the html for the sheet there are also a different set called attr_action_points etc and a unique attr_action_points_max but they all return a "No attribute was found for" error.

EDIT:
selecting action_points_std in the token puts the value in the other field, but putting it in the macro returns ceil(((13+0)+(14+0))/12), removing the two parenthesis before ceil. SOrry for double editing, it's 4am and my eyes are swimming
January 24 (8 years ago)
The Aaron
Pro
API Scripter
No worries.  So, that attribute is a formula attribute, you just need to surround it in [[ ]] to evaluate it into the value:
[[@{selected|action_points|max}]]
January 24 (8 years ago)
Thank you, that worked. Even if I can't automatically alter the value it's a good reminder to have. I already change it manually for every token so now it should be easier to catch when I do forget.

I have been sitting with the wiki documentation all night and I am very sure that I haven't seen any mention of formula attributes or any examples resembling what you just showed me. If it actually isn't there perhaps it should be added.
January 24 (8 years ago)
The Aaron
Pro
API Scripter
That's a good point.  It's sort of hard to know where to put it.  The fact that it's a formula is a function of the character sheet, so putting it there makes sense.  But If you don't know about them (I guess, technically it's called and "auto-calc field"), you wouldn't know to look there.  Probably somewhere with attribute references would make sense to just note it.
January 24 (8 years ago)
The Aaron
Pro
API Scripter
Added it here: https://wiki.roll20.net/Macros#Attributes_and_Char...