4
bind / nd6 · GitLab
gitlab.com
external-link
The world's best dice roller.

Dice rolling programs take too long.

Some demand syntax like /roll 2d6+2, and I think 'you should know that 2d6 is a roll without my typing /roll, and also everything I roll has been d6’s, so obviously if I type just 3, I mean ‘3d6’.

So I wrote one with defaults. This is my second python project, so the code isn’t pretty, but it does the job.

You write:

“”

 2d6
Result: 5

d8

2d8
Result: 12

3+1

3d8+1
Result: 8

If you give it a target number (TN), all rolls will tell you whether or not you’ve reached that TN.

If you give it a difficulty, it’ll tell you how many dice have landed on that number or above.

You can input these things in any reasonable format:

tn=18

TN 12

difficulty = 4

dif 9

Sandra
link
fedilink
11Y

I made one that uses a full infix expression parsing library so we can do arbitrary math like (3d6+4d8)*100+2d6

https://idiomdrottning.org/dicebot

@Ghast
creator
link
fedilink
11Y

This is really cool! But do I have to make an XMPP account to use it?

I don’t know why so many dice rollers insist on that awkward /roll syntax, instead of just listening to anything of the form xDy.

Sandra
link
fedilink
11Y

We’ve occasionally have had crashes when it heres us say like an URL or something and it happens to contain 30d0 in a longer string of line noise.

@Ghast
creator
link
fedilink
21Y

I handed nd6 to my gf, and she immediately crashed it with 3d0. I’ve ended up with rather a lot of sanity checks and a test command.

Ooh - and I added a new feature a couple of days ago. Type att = 2d6+1, and thereafter if you type att, it rolls that attack pool. Might be useful, but might be a headache for a multi-user program.

Sandra
link
fedilink
21Y

Great idea, I wanna add that feature, too! Would solve a problem for us.

Sandra
link
fedilink
21Y

Yeah, it’s for xmpp (my group, #boatmode, plays ocer xmpp) but, if you wanna snarf stuff from the source code, go ahead ♥

RPG
!rpg
Create a post

Discussion of table top roleplaying games.

  • 1 user online
  • 11 users / day
  • 46 users / week
  • 48 users / month
  • 65 users / 6 months
  • 847 subscribers
  • 107 Posts
  • 240 Comments
  • Modlog