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

Override border color change in number inputs and dice rolls?

I'm overhauling an older character sheet for a game that has a few unusual quirks that don't lend themselves to some of the default R20 behaviors.

  • Abilities are built on a point-buy system with a variety of ways to modify them.  It's possible for minor enhancements or weaknesses to cost 2.5 points, meaning certain number inputs can have decimal values.  R20 doesn't stop this, but it does draw a red box to indicate an error condition.  Is there a way to override this?  I popped up the dev console on my browser but couldn't find where the red was coming from.
  • Task checks are D20 based, but they differ from most games in that lower rolls are better.  So on a natural one, ideally the roll would show up with a green outline instead of red, and vice-versa for a nat 20.  I doubt this can be overridden in general in the chat channel, but might there be a way to do it inside of any custom roll templates attached to my sheet?




May 25 (5 years ago)
Kraynic
Pro
Sheet Author

I'll leave the decimal question for someone who has a clue. 

The red and green are just critical success and critical failure markers.  Those can be changed however you want.  I run a game that using d100 based skills, where you need to roll your skill rating or lower.  You just tell it the success is on the low number and the failure on high.  A d20 roll with reversed green/red highlight would look like this:

d20cs<1cf>20

That is telling the die roller that the critical success is 1 or lower, and a critical failure is 20 or higher. Obviously, you won't get lower than 1 or higher than 20 on a roll, but you can change those numbers as needed to set the threshold where it highlights red or green.


I believe the red outline on the input field is coming from the browser. The base "number" type is for integers only and it sees 2.5 as an invalid entry. One solution is to use the "step" attribute:

<input type="number" step="0.1" name="attr_pointcost" />

HTML 5 might offer other solutions.

May 25 (5 years ago)
GiGs
Pro
Sheet Author
API Scripter

The step=0.1 approach is the solution here. If only intervals of 0.5 are possible, setting step="0.5" is better.