Main Menu

Anwyn

Novus 2nd Edition

Novus 1st Edition

Author Topic: Dice Roller added to Forum  (Read 579 times)

0 Members and 1 Guest are viewing this topic.

Offline Rasyr

  • Administrator
  • Hero Member
  • *****
  • Posts: 2395
  • Karma: +3/-0
    • View Profile
Dice Roller added to Forum
« on: December 20, 2021, 04:41:53 PM »
This mod allows users to roll dice. They can use the preview function to preview dice rolls to make sure they have it right for what they want, but once they press Post, the dice rolls are embedded in the post, meaning that the only way they can change is if the post is edited, but a warning is issued if that is attempted.

It starts from a [roll] tag, and outputs a This dice roll has been tampered with!
 tag (implemented just for the mod) - trying to use the blockquote tag outside of [roll] circumstances (such as quoting the post, or better, editing the post) generates a visible warning.

There are a variety of options you can have inside the roll tag:
Please not that all the examples have an extra space between the "[" and the "/" in the closing tag so that they do nto actually roll until after the "might result in" lines

[roll]1d6[ /roll] - rolls 1 6-sided dice.
Might result in:
Rolled 1d6 : 5, total 5


[roll]2d12+5[ /roll] - roll 2 12-sided dice and add 5 to the result
Might result in:
Rolled 2d12+5 : 8, 5 + 5, total 18


[roll]2d20^10[ /roll] - roll 2 20-sided dice, re-rolling any result necessary so that the dice rolls are greater than 10.
Might result in:
Rolled 2d20^10 : 7 10 2 15, 11, total 26


[roll]2d20v10[ /roll] - roll 2 20-sided dice, re-rolling any result necessary so that the dice rolls are less than 10.
Might result in:
Rolled 2d20v10 : 18 12 15 6, 1, total 7


[roll]2d20<10[ /roll] - roll 2 20-sided dice, discarding any result where the roll was not less than 10
Might result in:
Rolled 2d20<10 : 18, 16, total 0


[roll]2d20>10[ /roll] - roll 2 20-sided dice, discarding any result where the roll was not greater than 10.
Might result in:
Rolled 2d20>10 : 5, 8, total 0


Normally it will add the word 'Rolled' in front - you can customise this. For example, a spell that does some serious damage in a game, so [roll]{Freezing} 1d10 {Fire} 1d20[ /roll]
Might result in:
 
Freezing 1d10 : 7, total 7
Fire 1d20 : 7, total 7



You can also nest the requirements, with the proviso of stating the things as they are in order here.
[roll]{Uberdamage} 15d100+10^10v90<80>20[ /roll] - 15 100-sided dice, adding 10 to the result, rerolling anything 10 or less, rerolling anything 90 or higher, and if after that, you have values 20 or less, or 80 or higher, they get dropped.
Might result in:
Uberdamage 15d100+10^10v90<80>20 : 83, 30, 85, 28, 1 34, 36, 17, 32, 77, 42, 59, 80, 90 68, 24, 68 + 10, total 508


Lastly you can also have an iterator at the end:
[roll]2d6x3[ /roll] - roll 2d6 3 times and display the results overall
Might result in:
Rolled 2d6 : 1, 3, total 4
Rolled 2d6 : 5, 6, total 11
Rolled 2d6 : 3, 2, total 5



BBcode is not supported anywhere inside the [roll] tag.

There are also limitations to prevent abuse; the most dice that can be used at once is 20, and the highest value of dice is 1000-sided.