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

Calculated values - dynamic references?

1487207408

Edited 1487207482
Ada L.
Marketplace Creator
Sheet Author
API Scripter
I'd like to set up a calculated attribute in a character sheet to calculate its value based on a dynamically resolved attribute name. E.g.: <input type='number' name='myComplicatedAttr' disabled='true' value='@{@{abilityScoreAttributeName}} + @{BaseAttackBonus}' /> In the above example, @{@{abilityScoreAttributeName}} would resolve to the current value of @{strengthModifier} if @{abilityScoreAttributeName} were "strengthModifier". Is this even possible, and if it is, is there a clean way to do it? My backup plan is to just do all the math in a worker script and abandon auto-calculated attributes altogether.
1487210465
Silvyre
Forum Champion
Might work if you replace the first @{ with an Attribute call that has a Current value of @{ e.g. if that Attribute's name is prefix_attr; replace @{@{abilityScoreAttributeName}} with @{prefix_attr}@{abilityScoreAttributeName}} If that doesn't work, try @{prefix_attr}@{character_name}|@{abilityScoreAttributeName}}
1487212378
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Afraid that's not going to working for my use case as I don't have any sort of prefix I'm using for these dynamic attributes, and that would just wind up concatenating strings anyways without resolving them to an attribute value. I got it working using worker script math though.
1487212433
Silvyre
Forum Champion
Ah, good to know. (It works outside of sheet applications.)