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 .
Advertisement Create a free account Compendium in Game, Join Today

Min/Max in auto calc field?

1464269534

Edited 1464269985
DXWarlock
Pro
Sheet Author
API Scripter
I tried I search but didn't turn anything up that seemed to be what I'm trying to do. I have an auto calc field, that I need to turn into a max of 98 The line I have is: <input class="sheet-sdinputbox" type="text" style="width:40px;" name="attr_OCCTs" value="@{SECSKp}+(@{SECSKpl}*(@{LEVEL}-@{SECSKLV}))" disabled="true"> This figures out their percentage on a skill based on: BASE+(PER LEVEL * (LEVEL - LEVEL LEARNED)) Problem is that can calculate to over 98, and the max a skill can get is 98% Is there a way to tell an auto calc to set itself to X, if total is > X? (If there is a way to do min too, that would solve another issue I have).
1464279340

Edited 1464279453
chris b.
Pro
Sheet Author
API Scripter
you could try { (your equation), 98}kl1   which I thought used to work, but i can't get that working anymore on a sheet. I am tempted to open a bug report because I swear I used to be able to do it. kl1 , "keep the lowest one of these 2 numbers", is equivalent to "max" kh1, "keep the highest one of these 2 numbers" is equivalent to "min" if it doesn't work on the page for that field, you can have it be part of a rollbutton macro instead and it should work.  something like: type="roll" value="{(@{OCCTs}),98}kl1" 
1464372669
DXWarlock
Pro
Sheet Author
API Scripter
Hmm that would work for the rolls. But the sheet will still look strange :( I tried the kl in the sheet calc, your correct it doesnt work, it leaves the field blank.
1464396134
Brian
Sheet Author
API Scripter
CSS Wizardry has you covered ! <input type="hidden" disabled="true" name="attr_max_xy" value="(((@{x} + @{y}) + abs(@{x} - @{y})) / 2)" /> <input type="hidden" disabled="true" name="attr_min_xy" value="(((@{x} + @{y}) - abs(@{x} - @{y})) / 2)" />
1464551570
DXWarlock
Pro
Sheet Author
API Scripter
whoo! that did it. took me a minute to figure out how to use it, but it sorted it all out. What would I do without you guys.