PDA

View Full Version : vBulletin 4 Request - Bbcode dice roller with image and customizable


Tri@de
05-02-2017, 07:00 PM
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
05-02-2017, 09:30 PM
Yep...give me a couple of days, and I'll put something together for you. :)

MarkFL
05-03-2017, 02:18 AM
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:

5d6

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. :)

Tri@de
05-03-2017, 08:19 AM
Thank you SO MUCH! :D

--------------- Added 1493807827 at 1493807827 ---------------



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://vborg.vbsupport.ru/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
05-03-2017, 03:45 PM
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:

5d6

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.

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.

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.

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. :)

Tri@de
05-03-2017, 04:32 PM
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]3d6[noparse] i will see 2/6/4 instead of thee images.

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

MarkFL
05-03-2017, 04:42 PM
...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. :)

4) yes as an option is the best way.

Okay, I will add that.

5) Not after but before

example:
if i type 3d6 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
05-03-2017, 04:57 PM
You're way too nice Mark. :^)

MarkFL
05-04-2017, 12:03 AM
I have attached the updated product .XML file...give that a go and let me know what you think. :)

MarkFL
05-04-2017, 01:49 AM
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. :)

Tri@de
05-04-2017, 05:57 AM
Tks i'll test it :D

MarkFL
05-07-2017, 04:26 AM
Tks i'll test it :D

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

Dice Roll (https://vborg.vbsupport.ru/showthread.php?t=325048)

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

Tri@de
05-07-2017, 05:22 AM
HAhahah thank you :D