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 .
×

Technical issue: embedded formulas not working properly with tokens

This very well may be a me issue, but I have spent hours trying to figure this out and it's eluding me. I run an EverQuest tabletop game, for which there is no character sheet programmed into Roll20 (separate issue, I'm also working on this). With the attributes on the default character sheets, I've started using a formula to calculate ability modifiers. It's the same formula as nearly every d20 system ( floor((@{charactername|Stat mod|Max}-10)/2) where the max is the actual ability score and gets changed based on gear and other effects) and this formula has been working perfectly as intended. EQTTRPG uses a mana system with values based on a key ability, and this is where it gets weird. The formula for max Mana is (@{Stat mod}*2*@{Level})+@{Mana from items}. When I was just using values for the modifiers, it worked fine. For some reason, when the attribute @{Stat mod} becomes a formula, it doesn't want to work right for tokens. When I call a @{Mana|Max} attribute for display in the chat, it displays correctly. When I want it to be the max for a token bar, it reads the formula as a negative and adds the addend after. For instance: Rizlin has 20 Int, for a modifier of +5. He has gear that gives him +12 mana total. His modifier formula reads correctly; all rolls with @{Int mod} return the correct value. When his token is on the screen and opened, his Mana bar reads 82/-58 as if one of the values was negative to make it -70 and then added the +12 So I try to take the formula and add a *-1. Sounds like a simple fix, right? With other characters, the formula [((@{Stat mod}*2*@{Level})*-1)+@{Mana from items}] sets the first part of it at 70, no matter what the stat mod actually is. I'm getting very frustrated with it at this point and would appreciate any help anyone can give on this
1786479912

Edited 1786479976
Gauss
Forum Champion
Hi Avariella,  This is not a bug, token bars cannot correctly resolve calculations.  In order to put the result of a calculation into a bar you need either a character sheet with the sheetworker doing the calculation and then pushing the result into another attribute, or you need an API Script that does the same thing. 
Hmm... Then I guess I'm confused as to why the mana bars were working when the stat mod was a value instead of a formula. I'll look into an API
1786494812
Gauss
Forum Champion
Could you supply a screenshot of the token's mana bar setting and of the character's mana attribute?
1786805431

Edited 1786805466
Based on your input, I've altered the sheet slightly. The mana bar still works if the attribute called is a value instead of another attribute or a formula, but here is an example of how I've been doing it. Visible token is the character represented by the token window and character sheet
I was able to figure out that when the Mana|Max formula was [[(@{Stat mod}*2*@{Level})+@{Mana from items}]] and the Stat mod was the stat mod formula, the token was reading the Mana|Max formula and skipping the attribute within the Stat mod formula, essentially giving it a value of zero and causing the max in the token window to look like [[(*2*7)+12]] when the attribute for the bar was changed to Mana, or -70 if the token window was opened with the bar already on Mana. It appeared that the Stat mod formula was being used without the actual value of the stat score, causing the formula of floor((@{Stat score}-10)/2) to return -5. I ultimately became frustrated with it and resigned myself to having a Stat mod formula that works for everything except token bars and a Mana mod attribute that I have to manually change whenever the ability changes