vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=245)
-   -   Miscellaneous Hacks - Dice Roller [BBCode] (https://vborg.vbsupport.ru/showthread.php?t=245192)

DragonBlade 06-23-2010 10:00 PM

Dice Roller [BBCode]
 
1 Attachment(s)
Original:
https://vborg.vbsupport.ru/showthread.php?t=113972
https://vborg.vbsupport.ru/showpost....&postcount=167

With tuxz0r's permission, I have ported his version of his dice roll mod for vb 4.0. This also fixes the first post issue.

Shameless copy paste from tuxz0r's post:
This mod uses the standard AdX+B notation where

A = the number of dice to roll (1 if not present)
X = the number of faces on the dice
B = represents a modifier, usually a + or - but also a divides or multiply.

I also need it to do certain things like, only show the sum/result of the roll or show all the die results and the sum of the roll. I also wanted the ability to do open rolls, e.g. if you roll 6, six sided die, you keep rerolling any dice that come up a 6.

So, basically, I have concocted three different bbcodes in one product:
[roll]1d4[/roll] - for rolling and showing only the results or sum
[rollv]1d4[/rollv] - for rolling and seeing the result of each dice as well as the sum
[rollo]1d4[/rollo] - for open rolls

Each of these takes and optional label for the roll, to be included in the tag after the '=' sign, e.g. [roll=to hit]4d6[/roll] and so forth. It is, however, optional as the actual notation for the roll is displayed before the results in the final posting.

So, for example, you can enter rolls like the following:

[roll]4d6[/roll] to get the sum of 4 six sided die.
[roll]d%[/roll] for a percentage roll (same as 1d100)
[roll]4d6b3[/roll] to roll 4 six sided dice and only sum the "best" three results

Installation:
1. Upload class_dice.php into vb's includes folder.
1. Import product-dice.xml.

sulasno 06-24-2010 10:31 AM

tagged and thanks

what can I do with this Mod ?

thunder28 06-24-2010 11:49 AM

Its fine for roleplaying sites:-)

if is possible i can see the results for each dice?
I roll 3d10 the output is: 3,6,9, = 18

thx for this mod.

Daryn 06-24-2010 04:58 PM

I seem to have found a small bug. If you add another roll to an existing post it will not do the roll but only shows the bbcode. You can do multiple rolls in one post, but you can't seem to add additional rolls to an existing one.

It also doesn't seem to work if I forget to add a roll into a post I made and then edit the post and add the roll.

Also, there is no way for me to explain how to use the bbcode on the forum because the Code, HTML, do not show the code, but instead show [roll0,1,2,3,4] depending on how many rolls are in that post.

DragonBlade 06-24-2010 10:19 PM

Quote:

Originally Posted by thunder28 (Post 2058758)
Its fine for roleplaying sites:-)

if is possible i can see the results for each dice?
I roll 3d10 the output is: 3,6,9, = 18

thx for this mod.

Yes, use [rollv]1d4[/rollv]

Quote:

Originally Posted by Daryn (Post 2058918)
I seem to have found a small bug. If you add another roll to an existing post it will not do the roll but only shows the bbcode. You can do multiple rolls in one post, but you can't seem to add additional rolls to an existing one.

It also doesn't seem to work if I forget to add a roll into a post I made and then edit the post and add the roll.

Also, there is no way for me to explain how to use the bbcode on the forum because the Code, HTML, do not show the code, but instead show [roll0,1,2,3,4] depending on how many rolls are in that post.

I believe the previous mod never supported adding in edited rolls and the bbcode parses, ignoring other bbcodes like noparse. I could change this later but for now, I just wanted to port this over for vb4.0

Daryn 06-25-2010 01:43 AM

Quote:

Originally Posted by DragonBlade (Post 2059078)
Yes, use [rollv]1d4[/rollv]



I believe the previous mod never supported adding in edited rolls and the bbcode parses, ignoring other bbcodes like noparse. I could change this later but for now, I just wanted to port this over for vb4.0

Oh I totally appreciate the port. I just thought that I would post what I ran across in my tests.

Scathefire 07-28-2010 06:20 PM

I like this.

Would it be difficult to adjust for 3.8.x? I've not moved to the 4 series yet.

Willy T 08-20-2010 12:38 AM

I'm having a bit of issue with the dice, namely the 2d6b1, as it always rolls a "0"

it SHOULD be rolling 2 6-sided dice, and picking the better of the two results...

if you can assist with a fix or tell me what I am doing wrong, I would greatly appreciate it.

Kodai Okuda 09-20-2010 05:53 AM

This hack does not work in vB 4.0.6.

I've tried the original code by Eikinskjaldi and it doesn't work either.

Not that that's surprising considering it was for vB 3.4/3.5.

My question is, does anyone have an updated version of this particular dice roller that will work in version 4.0.6/4.0.7

I ask because the current versions are far too buggy to be useful and I really need a dice roller for my free online RPG system.

Thanks in advance.

Eq4bits 02-12-2011 09:28 PM

*installed*
works fine in 4.08
yeah I need to upgrade but haven't had the time to =S

Mv.c9 05-06-2011 07:44 AM

does it work for 4.1.3 ?

MissSavitri 05-22-2011 11:09 AM

I have 4.1.3 and every time I use any of the above codes, it comes back with an error.
For instance, I copy and pasted the above and when I posted it on my forums, it came out with the following:

[roll0] - for rolling and showing only the results or sum
[roll1] - for rolling and seeing the result of each dice as well as the sum
[roll2] - for open rolls

So, for example, you can enter rolls like the following:

[roll4] to get the sum of 4 six sided die.
[roll5] for a percentage roll (same as 1d100)
[roll6] to roll 4 six sided dice and only sum the "best" three results

Eq4bits 06-27-2011 01:33 AM

Works perfectly on my vB4.1.4 board, no errors

LuMiS! 08-05-2011 11:31 PM

Works fine for me in 4.1.5 ... :)

Lemrith 04-12-2015 05:33 PM

still works damn fine in 4.2.2pl4 :)

just a side question - how to get [rollv] to show the induvidial dices without the sum?

justasiam 05-13-2015 05:24 PM

Is there any way to make this work in vB5?

ProfC 10-17-2015 12:09 PM

It works well enough on vb4.2.2 pl4, but for some reason doesn't work when being edited into posts.


All times are GMT. The time now is 07:14 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01350 seconds
  • Memory Usage 1,753KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (17)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete