use $lower bcz of "D" mabe that won't work with chr 100
and u have to stop the code after the check of numbers by adding halt, return, or if/else, orelse the loop will continue the execution
Yeah, I considered putting support in for capital D, but that's not really considered a valid format for D&D's dice, which is really what you're talking about when using 2d4 for similar format. I could add in a variety of other checks, such as making it only work if the d4 is a valid dice size. I just did a very basic one to show how it can be done. We could also strip out control codes to avoid those possible problems and a variety of other tweaks depending on how it's being used. I just left it as a basic script as mentioned in the post. It's just a template of how you can do dice before adding in any extras. I probably should have noted all of the potential "options" you can add to it to make it work better depending on the user's situation.
Here are some things that can be added if needed by the user:
*Support for capital D in 2d4
*Different error messages depending on input
*Limit the sides of dice to valid numbers (valid being whatever the rules say for the game the dice are being used in)
*Different output format to allow for a better display
*Set it up in an alias so it can return the dice in a way that can easily be used either with echo/msg/notice/etc or used in a script that makes use of the dice values
*Sort the rolls in a way that makes it easier to look at (for example, Yahtzee would benefit from sorting because you're looking for "pairs" and "runs")
And, yes, I forgot to put in halt/return/else in the check.