PDA

View Full Version : [Feature Addition] Dice Rolling in Posts


synkr0nized
10-16-2013, 05:34 PM
Do you run a forum-based RP that would benefit from having easy access to dice while posting? Do you want to be "that guy" and make dice-related jokes and rolls in your posts? Do you like scripts that do random stuff?!

NPF now is making use of a dice rolling mod put together by "tuxz0r" on the vBulletin forums back in 2006.

There are three bbcode additions that will roll dice in a post.

All roll commands use the following format:
XdY+N

X is the number of dice to use.
Y is the total sides of the die type being rolled.
N is used for modifiers (I guess, like, if you have a +1 to hit rolls, for example)

roll -- shows just the sum of what's rolled

rollv -- should show the result of each die as well as the total

rollo -- open rolls; author has example of "4d6b3" giving the best 3 rolls out of the four

When using these bbcodes, you can add a label to any roll with an = in the tag, such as 3d6.

After rolling, the output in the post will look something like this:
roll: (2d10)[11]
rollv: (3d6)[3][6][6](15)


Things to Note
The opening/initial post of a thread WILL NOT correctly parse roll commands. This is why you don't see any examples in this post.

If you double-post and it gets auto-merged, rolls made in the auto-merged post WILL NOT work. The original author likely did not expect the auto-merge modification.

If you are EDITING A POST, you cannot add new rolls. The rolls are made server-side when the initial post/reply is created and stored in the database. This is by design, and prevents cheating.


As a result of the roll security above, when editing or quoting a post with rolls made in it, you will only see a placeholder for the roll in the format of [roll#]. The actual roll data is stored server-side in a separate column from the post content.


I hope you folks who run RPs and the like will be able to make use of this. Test it out. If you have any problems, feel free to post about them here or message me!

Red Mage Black
10-16-2013, 05:47 PM
This is just a test post by me. I'll be using the different roll codes for demonstration purposes:

Result only:
[roll0]

For seeing the result of each die, plus the result:
[roll1]

Open rolls:
[roll2]

Edit: Not much difference between the second and third, I'll admit. Not sure what it means by 'open rolls'.
Secondary Note/Edit: When you edit after you've already rolled, the code will change to [roll#].

synkr0nized
10-16-2013, 05:51 PM
Another for "open rolls", using the mod author's example of 4d6b3:
[roll0]


I am not really clear what he intended, either, yet.

Red Mage Black
10-16-2013, 05:55 PM
I'll give it a shot using a different code and see if I can figure it out:

[roll0]

Edit: I'm wondering where that 11 comes from, since it showed up in both of our rolls.

synkr0nized
10-16-2013, 05:59 PM
I had a 14 in one when I tested before using d10.

[roll0]

Red Mage Black
10-16-2013, 06:12 PM
Labeling is good, but the open roll function looks bugged. It has the odd habit of adding in a number not associated to the dice being rolled, then includes it with the highest rolls. Might be better off ignoring the open roll tags and just settling with the first and second functions.

The link in the authors post where it explains the roller better is broken and has probably been broken for a while.

Note: I found a site that claims to have fixed the 'first post' issue, if you want to take a look at it (http://vbwarez.net/showthread.php/6275-Dice-Roller-BBCode), Synk.

Edit: Hm, maybe not? Looks like just downloading the forum mod requires registration.

synkr0nized
10-16-2013, 06:53 PM
Note: I found a site that claims to have fixed the 'first post' issue, if you want to take a look at it (http://vbwarez.net/showthread.php/6275-Dice-Roller-BBCode), Synk.

Edit: Hm, maybe not? Looks like just downloading the forum mod requires registration.

Yeah, I've already come across that one over at vBulletin's forums. It's for vBulletin 4x, and we're still using 3.8.5. Slight differences in the vBulletin backend (specifically how it calls and references templates to render threads and posts) prevents me from both just applying that version or copying the relevant code over, as it's not compatible with vBulletin 3, AFAIK currently.

It doesn't look like that author made any changes to tux0rz's "open roll" idea, anyway. In both cases, all that happens is that for any die that rolls the maximum value it can (i.e. a 6 for a d6, 10 for a d10, etc.) it gets rolled again and adds that value to the max. If it were to equal the max again, it would roll again and add that as well. So on a d10 that hit 10, it rolls again. If it was, say, 2, the sum for that die becomes 12; if it was 10 again, it would temporarily be 20 and roll a third time.

This is not what is described as the behavior, at least as far as I interpret what the original coder claims should happen. I don't know enough about tabletop mechanics to know if something like this is supposed to happen.

So perhaps it is best to ignore that command?

Wizardcat
10-16-2013, 07:31 PM
In both cases, all that happens is that for any die that rolls the maximum value it can (i.e. a 6 for a d6, 10 for a d10, etc.) it gets rolled again and adds that value to the max. If it were to equal the max again, it would roll again and add that as well. So on a d10 that hit 10, it rolls again. If it was, say, 2, the sum for that die becomes 12; if it was 10 again, it would temporarily be 20 and roll a third time.

This is not what is described as the behavior, at least as far as I interpret what the original coder claims should happen. I don't know enough about tabletop mechanics to know if something like this is supposed to happen.

So perhaps it is best to ignore that command?
That's how an open roll (also known as exploding dice) works, yes. It's not a 'best of' roll - they're two different things.

[roll0]
[roll1]

Edit: Huh. Previewing kills the rolls. Whoops.

Aldurin
10-16-2013, 07:32 PM
Yeah, our forum isn't entirely optimized for dice rolling with the post-merge feature. But this does tempt me to run an actual D&D game on the forum.

Wizardcat
10-16-2013, 07:40 PM
There's actually one already going, though it's done on the forum's chat and not the forum itself. http://edupad.ch/ShiftingSeasDnD3point5 is used for coordinating for it and the like, if interested.

synkr0nized
10-16-2013, 07:40 PM
That's how an open roll (also known as exploding dice) works, yes. It's not a 'best of' roll - they're two different things.


Oh, OK. "Exploding dice" makes sense to me, given its current behavior. I guess I read too much into what the coder had reported in his description:
[roll0] to roll 4 six sided dice and only sum the "best" three results
So I put emphasis on the "best" part, when I shouldn't have. I take it the idea behind it is to award max-value rolls with a bonus roll?

Is there a concise/typical way to describe the open roll behavior? Maybe it just should read "rollo -- open rolls, awarding a bonus die roll for any die that rolls the max value"?
I'd like to amend the description in the OP so that it's correct.

Aldurin
10-16-2013, 08:44 PM
There's actually one already going, though it's done on the forum's chat and not the forum itself. http://edupad.ch/ShiftingSeasDnD3point5 is used for coordinating for it and the like, if interested.

Well, yeah. But chat games require committing to a schedule, which isn't always possible. Doing it in a forum thread allows you to scream FUCK YOUR SCHEDULE BULLSHIT, IMMA POST ANYTIME OF DA DAY!

Red Mage Black
10-16-2013, 09:34 PM
Ah, that's pretty interesting. I know 'exploding die' occurs in Legend of the Five Rings and Anima, the latter of which I should have taken the hint from 'open rolls'.

Well, yeah. But chat games require committing to a schedule, which isn't always possible. Doing it in a forum thread allows you to scream FUCK YOUR SCHEDULE BULLSHIT, IMMA POST ANYTIME OF DA DAY!

That was basically my reasoning behind suggesting it. It would eliminate suspicion behind 'honor rolls' and help prevent cheating.

EDIT: Which reminds me. Thanks again, Synk.

Bells
10-17-2013, 07:06 AM
We are coming up 2007 so hard =D

This is actually really nice, an interesting feature that adds stuff without being on the way of anybody nor anything else. Thanks!