vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.5 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=113)
-   -   Dice Roller Hack [BBCode] (https://vborg.vbsupport.ru/showthread.php?t=113972)

akanevsky 05-27-2006 11:24 AM

Although I see no practical use for me, this is a very nice hack technical-wise.

Eq4bits 05-27-2006 02:42 PM

Quote:

Originally Posted by cclaerhout
Well, here is a preview of "RPG DiceRoller". I still have to work on the user interface.

You want to play a D4 ?
[dice=1]4[/dice]

You want to play a D6 ?
[dice=1]6[/dice]

You want to play a D8 ?
[dice=1]8[/dice]

You want to play a D10 ?
[dice=1]10[/dice]

You want to play a D12 ?
[dice=1]12[/dice]

You want to play a D20 ?
[dice=1]20[/dice]

Other dices won't work because pictures don't exist ;)

N.B : Pictures are in png format. To avoid grey line arround them in Internet Explorer 6, you need a png transparency hack (available here). Otherwise i could do a gif release.

So you can only roll 1 dice at a time with this version? Any way to make it work to ALWAYS roll a die with 6 faces but make the # of dice variable? i.e.
[dice=1]6[/dice]
[dice=2]6[/dice]
[dice=3]6[/dice]
[dice=4]6[/dice]
[dice=5]6[/dice]

That's what Emmy2 is looking for.
My group uses anywhere from 1-9 dice and anywhere from 2-100 faces, I was TRYING to just make a new bbcode button in the admincp bbcode manager, i could get the button image to work, but when you'd click it and vB asks you to input the number for the {option} the result would look like:

[DICE="4"][/DICE]

you still had to put the 'face' variable/option/param in physically between the two sets of brackets, but the quotes vB automatically put around the #ofdice of course kept it from working, was having trouble with the 'html' part in the 'add bbcode' panel also..

*sigh*... I just have to face it somethings I *can* do and some I just don't have the knowledge for.. I'm just belligerant and keep at it though... till I'm cross-eyed... LOL

I didn't realize IE put grey borders around gifs, i've never noticed it before.... hmmmm
If anyone wants me to turn the 1-100 Blue Dice in pentagonal shape (that I did as Rukbat) into png's let me know and I'll do a batch conversion and re-zip & re-upload here.

Eq4bits 05-27-2006 02:45 PM

cclaerhout,
One more question...
is the 'roll' still stored in the d/b?

Emmy2 05-27-2006 03:27 PM

There now seems to be several of you working on variations for this, and that's great! So, not to sidetrack everyone but I have a few more ideas....

Suppose I wanted to install this hack more than once, what would I need to change in the original xml file? In other words I want one hack called "dice" and another hack called "cards" that does the same thing but uses separate database tables and images. So for example, I can have one game that throws dice and another game that draws playing cards. Or another game that rolls letters of the alphabet.

In other words, suppose I want 3 separate games. Dice, Cards, Alpha, if you want to name them. What parts of the original script could I change so that I can install this game a second and third time (in a different place, not overwriting the first game)?

Then, to play, users would type (or I'd create buttons for):

[dice=5]6[/dice]
to roll a 6 sided dice five times

[cards=5]52[/card]
to draw 5 cards from a 52-card deck

[alpha=9]26[/alpha]
to roll 9 letters out of the 26 letter alphabet

I'm dreaming big here folks! :P

Another idea....suppose for the card game users are drawing 5 cards and I don't want them to draw the same card twice (this could also apply to dice). Is there a way to limit it so the same card/dice isn't drawn/rolled more than once in a roll of multiple die or cards?

Yeah, this is all pretty much off-base for the current project, but I thought I'd just throw these ideas out there.

cclaerhout 05-27-2006 04:31 PM

Quote:

Originally Posted by Eq4bits
So you can only roll 1 dice at a time with this version?

No, as many as you want.

The dice are still in database.

Eikinskjaldi 05-27-2006 05:00 PM

Well a standard deck has 52 cards so you bbcode would probaly look more like [cards]5[/cards]. With private text you could be on your way to having poker in threads. as far as limiting it, ya, it could be limited, it'd be as simple as stoirng the values in a array and testing to make shure none equal eachother.

However back on dice, Another idea is a prompt box which you can enter the number to roll after having selected the sides from a drop down.I'll look into that avenue. I am going to making a steep departure from the old system of rolling dice as it doesn't work for me, so this drop down idea won't work for me, in any case, all that well. Seeing as I help run one of the largest gaming sites for PbP it isnt easy to keep everything simple. A sample new style roll would be:
[dice=Dice Title]1d20 1d20 1d6[/dice]

Which would provide a much cleaner more cingular less bulky output. I also don't want images, so I will probaly provide to XML's, one with them and one without. If you visit my forum and check out some of the dice rolls you can see the output I will probaly be aiming for as I want to try and keep my dice standard.

The cards thing shouldn't be to hard and i'll look into it if I have time.

cclaerhout 05-27-2006 10:32 PM

Here is the kind of interface i'd like. It would be a popup. I'm going to ask Michelle if she can help us.

cclaerhout 05-28-2006 07:38 AM

Michelle is sorry but she doesn't have time to work on this. If an advanced coder can have a look, it would be nice.

Emmy2 05-28-2006 11:49 PM

Could the "onclick" command be used in conjuction with an image button to insert the roll into the textarea?

I've been looking at the smilie code and that's what it does. Click a smilie and it inserts something like :smilie: into the text box. Instead of :smilie: I need it to insert the code for a dice roll.

So something like this to create a button (this is just me expressing my idea, it is NOT real code):
Code:

<img src="http://www.mysite.com/dicebutton.gif" onclick="return value('[dice=5]6[/dice]')">
Then I think you'd have to create a little javascript to put in the page head for the onclick command, right? Can anyone help with this? I'm really keen to get it working.

Emmy2 05-29-2006 05:48 PM

Quote:

Originally Posted by cclaerhout
Michelle is sorry but she doesn't have time to work on this. If an advanced coder can have a look, it would be nice.

I'm not a coder but I think I did it! I've created code that will add an image button or a regular button to the quick reply and regular editors that when clicked by user automatically inserts the text for one pre-defined dice roll. It doesn't have a drop-down menu for multiple options, but hey it's a start! And maybe with the base code in place someone can look at it and see how to add a menu. All I did was research on google and played with some code I found and kept testing and this one finally worked.

I will post the code late tonight when I get home from work...I have been working on this all day.

:banana:


All times are GMT. The time now is 08:06 AM.

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.01763 seconds
  • Memory Usage 1,750KB
  • 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
  • (1)bbcode_code_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete