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

[Help] Starfinder (simple) - AC Calculations

1576687751

Edited 1576687768
Phillip G.
Sheet Author
So, looking for some help or thoughts on this one. I have an extreme calculation devised for the character sheet. It takes into account whether or not armor and shields are equipped or not. The problem I have run into is that when only armor is equipped the calculation yields a 0 within the sheet, but when the attributed is called for in the chat, the correct value is returned. This is the code I am using for the calculation of attribute Dex-armor ((((floor(([[((floor(([[@{DEX-mod}]] + @{armor-max-dex}) - (abs([[@{DEX-mod}]] - @{armor-max-dex}))) * @{armor-equipped}) / 2) + (@{shield-max-dex} * (1 - (@{armor-equipped})))]] + [[((floor(([[@{DEX-mod}]] + @{shield-max-dex}) - (abs([[@{DEX-mod}]] - @{shield-max-dex}))) * @{shield-equipped}) / 2) + (@{armor-max-dex} * (1 - (@{shield-equipped})))]]) - (abs([[((floor(([[@{DEX-mod}]] + @{armor-max-dex}) - (abs([[@{DEX-mod}]] - @{armor-max-dex}))) * @{armor-equipped}) / 2) + (@{shield-max-dex} * (1 - (@{armor-equipped})))]] - [[((floor(([[@{DEX-mod}]] + @{shield-max-dex}) - (abs([[@{DEX-mod}]] - @{shield-max-dex}))) * @{shield-equipped}) / 2) + (@{armor-max-dex} * (1 - (@{shield-equipped})))]])))) * ([[ceil((@{armor-equipped}/2) + (@{shield-equipped}/2))]]))/2) + ([[@{DEX-mod}]] * (1 - ([[ceil((@{armor-equipped}/2) + (@{shield-equipped}/2))]])))) You can see an example below:
1576693853
vÍnce
Pro
Sheet Author
Hi Phillip, Does the sheet already auto-calculate the Dex-armor attribute?  If so, how are you using your formula on/within the sheet?  Custom sheet?  Also, usually you wouldn't include inline rolls for on-sheet calculations since all values need to resolve without a roll. 
Hey Vince, I had hoped you'd see this. This is the sheet's auto-calculate for the Dex-armor attribute. I am working on the sheet, not a player macro. I only included the inline rolls to help me follow the results a little easier. Regardless, I am getting the same results with or without the inline rolls.
1576701077

Edited 1576701687
vÍnce
Pro
Sheet Author
Gotcha.  I would start by simplifying your macro on the sheet.  Either start small and build to it or substitute numbers for the attribute calls and see if you can isolate if it's an attribute issue or syntax. Also, is the Dex-armor calc handled using sheet workers or within the HTML?  Are any of the attributes in the formula being handled using sheet workers?  If so, you may need to make change/additions to the sheet worker code.
There are no sheet workers for the Starfinder (simple) sheet. I just could never figure out how to use them. I'd like to simplify the code, but I can't see anyway to do so and achieve the desired result.  With regard to my original question, is there any reason the sheet would return a 0 value for all inputs while the chat returns the expected value for any given input? If I follow the math, the equation works. (And not toot my own horn, but it is pretty beautiful.) The problem is that it is not outputting correctly within the sheet.
I think I got it figured. There were some issues in the grouping of terms that my brain was finally able to puzzle out. I still feel that this is a truly beautiful equation: (((floor((((floor((@{DEX-mod} + @{armor-max-dex}) - (abs(@{DEX-mod} - @{armor-max-dex}))) * @{armor-equipped}) / 2) + (@{shield-max-dex} * (1 - (@{armor-equipped}))) + ((floor((@{DEX-mod} + @{shield-max-dex}) - (abs(@{DEX-mod} - @{shield-max-dex}))) * @{shield-equipped}) / 2) + (@{armor-max-dex} * (1 - (@{shield-equipped})))) - (abs((((floor((@{DEX-mod} + @{armor-max-dex}) - (abs(@{DEX-mod} - @{armor-max-dex}))) * @{armor-equipped}) / 2) + (@{shield-max-dex} * (1 - (@{armor-equipped})))) - (((floor((@{DEX-mod} + @{shield-max-dex}) - (abs(@{DEX-mod} - @{shield-max-dex}))) * @{shield-equipped}) / 2) + (@{armor-max-dex} * (1 - (@{shield-equipped}))))))) * (ceil((@{armor-equipped}/2) + (@{shield-equipped}/2))))/2) + (@{DEX-mod} * (1 - (ceil((@{armor-equipped}/2) + (@{shield-equipped}/2))))))
1576778285

Edited 1576778333
vÍnce
Pro
Sheet Author
Phillip G. said: I think I got it figured. There were some issues in the grouping of terms that my brain was finally able to puzzle out. I still feel that this is a truly beautiful equation: (((floor((((floor((@{DEX-mod} + @{armor-max-dex}) - (abs(@{DEX-mod} - @{armor-max-dex}))) * @{armor-equipped}) / 2) + (@{shield-max-dex} * (1 - (@{armor-equipped}))) + ((floor((@{DEX-mod} + @{shield-max-dex}) - (abs(@{DEX-mod} - @{shield-max-dex}))) * @{shield-equipped}) / 2) + (@{armor-max-dex} * (1 - (@{shield-equipped})))) - (abs((((floor((@{DEX-mod} + @{armor-max-dex}) - (abs(@{DEX-mod} - @{armor-max-dex}))) * @{armor-equipped}) / 2) + (@{shield-max-dex} * (1 - (@{armor-equipped})))) - (((floor((@{DEX-mod} + @{shield-max-dex}) - (abs(@{DEX-mod} - @{shield-max-dex}))) * @{shield-equipped}) / 2) + (@{armor-max-dex} * (1 - (@{shield-equipped}))))))) * (ceil((@{armor-equipped}/2) + (@{shield-equipped}/2))))/2) + (@{DEX-mod} * (1 - (ceil((@{armor-equipped}/2) + (@{shield-equipped}/2)))))) You really just wanted everyone to see your beautiful formula.  lol