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

Is there a way to set a minimum AND maximum function?

I know you can set minimum functions and maximum functions using (X,Y)dl1 and (X,Y)dh1, but I'm in a situation where my code needs to set a minimum and a maximum function to work. I need to create an equation that produces a 0 from level 1-7, a 1 from level 8-11, a 2 from level 12-15. and 3 from level 16-20. I have found that if I take floor(CL/4-1), I can produce the number range I need. But I need to set a minimum of 0 and a maximum of 3, else the code goes out of bounds at level 20. The current out-of bounds code is as follows: [[4+{floor((@{spellclass-0-level-total}/4)-1), 0}dl1]] An attempt to add a maximum produces an error: [[4+{{floor((@{spellclass-0-level-total}/4)-1), 0}dl1, 3}dh1]] I am looking for a solution to set a maximum and a minimum on a function.
1620110246
vÍnce
Pro
Sheet Author
Try this; [[ [[ { [[ {floor((@{spellclass-0-level-total}/4)-1), 0}dl1 ]], 3}dh1]] ]]
Thanks, worked perfect
1620112362
vÍnce
Pro
Sheet Author
+1