vBulletin Mods

The Official vBulletin Modifications Site
https://www.vbulletin.org/forum/showthread.php?t=325017

Bbcode dice roller with image and customizable 02 May 2017 21:00

I'd like to have a dice roller that can show images of dice face
i search also a customizable one
i explain:
if i write [ roll=xx] 2d6 [/ roll]
i want the output will show 2 images of customized dices.
if i write [ roll=yy] 2d6 [/ roll]
i want the output will show 2 images of other customized dices.

someone can do it?

MarkFL 02 May 2017 23:30

Yep...give me a couple of days, and I'll put something together for you. :)

MarkFL 03 May 2017 04:18

1 Attachment(s)
Okay...here is a preliminary product for you to test.

Download the attached .ZIP file, and upload the contents of the "upload" folder to your forum's root...this contains a set of images for the standard six sided die.

Once you have the images uploaded, and the .XML file imported, your users can then use something like:

[roll=1]5d6[/roll]

in their posts. The above will display five 6-sided die images (from the default defined image set), randomly generated.

If you have any questions about the use of this product (such as how to add more sets of images), please feel free to ask. If you have any suggestions for improvement, please let me know. :)

[email protected] 03 May 2017 10:19

Thank you SO MUCH! :D

--------------- Added 03 May 2017 at 10:37 ---------------

Quote:

Originally Posted by MarkFL (Post 2586143)

If you have any questions about the use of this product (such as how to add more sets of images), please feel free to ask. If you have any suggestions for improvement, please let me know. :)


Thank you i will write here all i have in my mind:
1)i'd like to use different dices for different games.
if il play monopoly i use regular 1d6
if i play Star wars Imperial assoult i use this type of dice:
https://www.vbulletin.org/forum/external/2017/05/1.png

So i have to discrimiate them using [ dice=swia] for imperial assault

2) i'd like to have also the way to use different dices as 1d4 1d8 1d20 1d100 and how much i want 3d8, 2d4 10d100

3) a way to not let the user change the roll he has done.

4) can sum the rolls example: [sroll]3d6 and have in output 6-3-1 tot= 10

5) can change the output from images to numbers

6) is it possible also to customize/create dices via admincp?

MarkFL 03 May 2017 17:45

Quote:

Originally Posted by [email protected] (Post 2586146)
1)i'd like to use different dices for different games.

2) i'd like to have also the way to use different dices as 1d4 1d8 1d20 1d100 and how much i want 3d8, 2d4 10d100

What you need to do if create/find or otherwise obtain sets of images that show each face of an individual die. For each set, the image file names need to begin with the same string of text and end with a number corresponding to the value of the face.

You may have noticed that the default set I include had the names:
  • dice-1.png
  • dice-2.png
  • dice-3.png
  • dice-4.png
  • dice-5.png
  • dice-6.png

In the product settings, I gave this set the identifier "1" by including the line:

1|dice-*.png

This means your users can use the following code:

[roll=1]5d6[/roll]

to get 5 six-sided dice randomly generated.

So, to use other sets, you need to upload the image set, with the files appropriately named, to the folder "images/dice" on your server, and then include the identifier string in your settings.

Quote:

Originally Posted by [email protected] (Post 2586146)
3) a way to not let the user change the roll he has done.

The only way I know to do that is to prevent your users from being able to edit their posts. I will add a setting that allows you to make this product active only in selected forums, and then for those forums, you will need to edit the forum permissions for each usergroup you don't want editing their posts.

Quote:

Originally Posted by [email protected] (Post 2586146)
4) can sum the rolls example: [sroll]3d6 and have in output 6-3-1 tot= 10

I can make that an option, and display the output in tabular format.

Quote:

Originally Posted by [email protected] (Post 2586146)
5) can change the output from images to numbers

Do you mean once the post has been made, you want the ability to change the post so that numbers are shown rather than the images?

I'll wait until we get all these issues sorted out before updating the product. :)

[email protected] 03 May 2017 18:32

1) 2) Ok i understood!
3) ok. i use as it is. if i see modified post i'll ban! :D
4) yes as an option is the best way.
5) Not after but before

example:
if i type [noparse][niroll=1]3d6[/niroll][noparse] i will see 2/6/4 instead of thee images.

I renew my thanks to help me.
You made a great mod!

MarkFL 03 May 2017 18:42

Quote:

Originally Posted by [email protected] (Post 2586163)
...3) ok. i use as it is. if i see modified post i'll ban! :D

Depending on your settings, your users may be able to quickly edit their post without it showing it has been edited. :)

Quote:

Originally Posted by [email protected] (Post 2586163)
4) yes as an option is the best way.

Okay, I will add that.

Quote:

Originally Posted by [email protected] (Post 2586163)
5) Not after but before

example:
if i type [niroll=1]3d6[/niroll] i will see 2/6/4 instead of thee images.

I renew my thanks to help me.

That sounds like it would be almost the same as the "sroll" option, except without the sum. I will add that as an option as well.

I will also go ahead and add the option to select forums in which the product is active. Look for the update within the next 24 hours. :)

Dave 03 May 2017 18:57

You're way too nice Mark. :^)

MarkFL 04 May 2017 02:03

1 Attachment(s)
I have attached the updated product .XML file...give that a go and let me know what you think. :)

MarkFL 04 May 2017 03:49

1 Attachment(s)
Here is a version that is more "tamper-proof"...when a user posts a dice roll, the text "Legitimate Dice Roll" will appear above the roll (you can change this text by editing the phrase "markfl_diceroll_legittext").

If a user tries to cheat and construct their own dice roll by entering the appropriate image/table BBCodes with that text above it, the text will be removed. If the post is edited, that text will also be removed. :)

[email protected] 04 May 2017 07:57

Tks i'll test it :D

MarkFL 07 May 2017 06:26

Quote:

Originally Posted by [email protected] (Post 2586181)
Tks i'll test it :D

I have published a more robust version of this product here:

Dice Roll

I have cited you as a co-author since this was your idea/request. :)

[email protected] 07 May 2017 07:22

HAhahah thank you :D


All times are GMT. The time now is 08:19.

Powered by vBulletin® Version 3.8.14
Copyright © 2020, MH Sub I, LLC dba vBulletin. All Rights Reserved. vBulletin® is a registered trademark of MH Sub I, LLC
Copyright ©2001 - , vbulletin.org. All rights reserved.