MOD Description: A MOD to add a system of persistent dice rolls to your forum, in the form of a BBCode tag.
MOD Version: 0.4
MOD Download: http://mtg.freeunixhost.com/dice.zip
My provider hates the referrer header, so copy-paste the url into the address bar. Clicking the link won't work.
Demo Board: None (yet!)
Dice rolls are stored in the database according to the type of what contains it (post or private message), the container's id, the number of sides, and the index within the text. This ensures that editing the post does not change a roll. Of course, there are still ways around it (such as deleting your post and retyping it), but for the most part, this should be more than enough to force people to stay honest.
Syntax of [dice] tag:
Hoo boy, this is a doozy.
A [dice] tag may contain any number of comma-delimited rolls. Each roll contains the number of sides to the die, optionally preceded by another number and a 'd' to roll that many (as in "4d6" to roll four six-sided dice). You may also follow the number with a percent sign and a number to drop that many of low dice (so if you write "7d8%2", the result is the sum of seven eight-sided dice, but not counting the lowest two). After the drop specifier, and number of modifiers may be added. A modifier is any character among "+-/*^<>" followed by any number (floating point numbers are supported). Each modifier is evaluated in the order specified. For +, -, * and /, the appropriate mathematical operation is applied to the two numbers (with the current total being the number on. For ^, the current total is raised to the power of the value afterward (the absolute value is taken first, be careful). < makes it so that the total is lowered until equal to or less than the value given; > does just the opposite. Whitespace, including newlines, can occur anywhere except inside a number.
You can also name a dice block by writing the name of the block after an = sign in the opening tag. Individual rolls can be named by putting the name of the roll before the roll's syntax, separated by a colon. Whitespace between the first non-whitespace character of the name and the colon will be retained, except that newlines will be replaced by spaces.
To roll 4d6, dropping the lowest die each time, minimum of 6 (let's say) for the six abilities in D&D, you might write [dice=Ability Scores]Str:4d6%1>6,Dex:4d6%1>6,Con:4d6%1>6,Int:4d6%1>6,Wis:4d6%1>6,Cha:4d6%1>6[/dice]
To roll a 100-sided die, double it, and take the square root, write [dice]100*2^0.5[/dice] (note the use of a fractional exponent).
- Stable release, RC1
- Fixed all bugs
- Comment the regexes
- Add a modifier to raise a number to the exponent of the sum (so, for instance get the nth mersenne number)
- Add a modifier to get a 'score' based on number above a threshold (for instance, how many are above 7?)
- Add a modifier to roll again if you got above a certain score (for instance, reroll and add to the total if you rolled the highest possible)
- Add some other modifiers
- Add an FAQ entry
- Add automation script