The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
Dice Roller Hack [BBCode] Details »» | ||||||||||||||||||||||||||
Dice Roller Hack [BBCode]
RPG Dice is currently a updated version Another updated version Note: Updated package includes only the correct XML. This hack is a port of: Dice Roll for vB3 and permissions was given to port by the following statement. Quote:
The basic bbcode format is: [dice=X]Y[/dice] X - The number of dice to roll, This cannot be larger then 5 currently, this may change later with demand. Y - The number of sides on the dice. so [dice=1]6[/dice] Roll's 1, 6 sided dice. The only limit that I have noticed so far is that dice will not apear correctly when rolled from the create thread editor. I am unsure as to why this is still and am working on this issue. However aside from this it is working as need be. This hack is mainly useful to Game websites that require dice rollers for gambling or roleplaying games. It can add an element of fun to a forum and is adapatable to most dice require situations. If enough demand is displayed I will work on removing the 5 roll limit or making it larger. The current maximum sides one can roll is 30. If you enjoy this hack or have it installed, then please click the install button so that you can remain informed when updates occur. As the original author said, You do not need to ask permission to update or do anything to this hack and can redistribute it if you feel you have made a great contribution to it. If someone does make new dice images and wishes to have them as part of the package then either post here or PM me and I will get them in there with full rights going to the sender for the images. Updates:
This hack was requested from: https://vborg.vbsupport.ru/showthread.php?t=97775 -Eikinskjaldi- Original Screenshots: https://vborg.vbsupport.ru/attachmen...3&d=1078098688 https://vborg.vbsupport.ru/attachmen...4&d=1078098702 Show Your Support
|
Comments |
#82
|
||||
|
||||
I'm waiting for you Since your last post, i've imagined a new user interface easier to code if you manage to do what you're trying.
The code will be something like this : Code:
<fieldset style="width:140px;"> <legend style="font-size: 14px;color:black;font-weight:bold;">Dice menu</legend> <span style="font-size: 12px;color:black;font-weight:bold;">D04 : </span> <input style="font-size: 9px; width:20px" type="submit" name="Submit" value="x1"><input style="font-size: 9px; width:20px" type="submit" name="Submit" value="x2"><input style="font-size: 9px; width:20px" type="submit" name="Submit" value="x3"><input style="font-size: 9px; width:20px" type="submit" name="Submit" value="x4"><input style="font-size: 9px; width:20px" type="submit" name="Submit" value="x5"> <br /> <span style="font-size: 12px;color:black;font-weight:bold;">D06 : </span> <input style="font-size: 9px; width:20px" type="submit" name="Submit" value="x1"><input style="font-size: 9px; width:20px" type="submit" name="Submit" value="x2"><input style="font-size: 9px; width:20px" type="submit" name="Submit" value="x3"><input style="font-size: 9px; width:20px" type="submit" name="Submit" value="x4"><input style="font-size: 9px; width:20px" type="submit" name="Submit" value="x5"> <br /> <span style="font-size: 12px;color:black;font-weight:bold;">D08 : </span> <input style="font-size: 9px; width:20px" type="submit" name="Submit" value="x1"><input style="font-size: 9px; width:20px" type="submit" name="Submit" value="x2"><input style="font-size: 9px; width:20px" type="submit" name="Submit" value="x3"><input style="font-size: 9px; width:20px" type="submit" name="Submit" value="x4"><input style="font-size: 9px; width:20px" type="submit" name="Submit" value="x5"> <br /> <span style="font-size: 12px;color:black;font-weight:bold;">D10 : </span> <input style="font-size: 9px; width:20px" type="submit" name="Submit" value="x1"><input style="font-size: 9px; width:20px" type="submit" name="Submit" value="x2"><input style="font-size: 9px; width:20px" type="submit" name="Submit" value="x3"><input style="font-size: 9px; width:20px" type="submit" name="Submit" value="x4"><input style="font-size: 9px; width:20px" type="submit" name="Submit" value="x5"> <br /> <span style="font-size: 12px;color:black;font-weight:bold;">D12 : </span> <input style="font-size: 9px; width:20px" type="submit" name="Submit" value="x1"><input style="font-size: 9px; width:20px" type="submit" name="Submit" value="x2"><input style="font-size: 9px; width:20px" type="submit" name="Submit" value="x3"><input style="font-size: 9px; width:20px" type="submit" name="Submit" value="x4"><input style="font-size: 9px; width:20px" type="submit" name="Submit" value="x5"> <br /> <span style="font-size: 12px;color:black;font-weight:bold;">D20 : </span> <input style="font-size: 9px; width:20px" type="submit" name="Submit" value="x1"><input style="font-size: 9px; width:20px" type="submit" name="Submit" value="x2"><input style="font-size: 9px; width:20px" type="submit" name="Submit" value="x3"><input style="font-size: 9px; width:20px" type="submit" name="Submit" value="x4"><input style="font-size: 9px; width:20px" type="submit" name="Submit" value="x5"> <br /> </fieldset> |
#83
|
|||
|
|||
Quote:
Code:
[DICE][/DICE] Looking forward to seeing your fix around it. |
#84
|
||||
|
||||
Quote:
This method has two problems : 1)you have to enter the number of faces. 2)you can't specify the number of dice. |
#85
|
|||
|
|||
yeah I know, is why my eyes started bleeding trying to make it do one or the other and had to quite
|
#86
|
|||
|
|||
vb Coders...
Okay, here is the code I worked out to add a button to the editor to automatically insert a dice roll. Remember I’m not a coder, so use this at your own risk. I just kept fiddling with it until it worked. I don’t know the possibility of any negative consequences of the script, so if there are flaws I’m not responsible! I also have never posted code or instructions before, so I hope my directions are coherent. I've included code for three different button types....a simple text link, a text button, and an image button. Choose the one you prefer. The two best are the text link and the image button. The text button is a little buggy, but still works. You need to install the script in two places, so that a button shows up on both the quick reply editor and the regular editor. So find these templates: editor_toolbar_on showthread_quickreply Into each template you will add a bit of code to make a button. To find the places to insert the code.... In editor_toolbar_on look for: Code:
$vBeditTemplate[extrabuttons] Code:
<if condition="!is_browser('opera')"> ABOVE each of those lines add ONE of the following codes to make your button: For a text button on the editor toolbar: Code:
<td><input type="button" value="Roll 3 Dice" onclick="document.getElementById('{$editorid}_textarea').value += '[dice=3]6[/dice]';"></a></td> Code:
<td><a href="javascript:void(0);" onclick="document.getElementById('{$editorid}_textarea').value += '[dice=2]6[/dice]'; return false;">Roll 2 Dice</a></td> Code:
<td><a href="javascript:void(0);"><img src="http://www.yoursite.com/diceimage.gif" title="Roll 5 Dice" onclick="document.getElementById('{$editorid}_textarea').value += '[dice=5]6[/dice]';"></a></td> Theoretically you can add as many buttons for as many different rolls as you want. However, I know that is too cumbersome. Ideally some sort of option menu would be ideal, like for smilies or fonts. But I don’t know how to code that. Maybe someone else can help now that I've worked out the basic code. Btw, this script could be used for more than just dice roll. It could be used for any other complex bbcode string that you want to preset, or even for full sentences (“Your post was very helpful to me.”). Just anything that would save the user some keystrokes (as long as there are no quotes in the text string, I think that would mess things up). |
#87
|
|||
|
|||
Quote:
am using ver. 3.5.4 I don't have that code in my showthread_quickreply template... it's never been changed since the upgrade. Any suggestions as to where to add this? |
#88
|
|||
|
|||
Oops, sorry, that is my fault. My showthread_quickreply is already hacked and that must be some additional code I have in mine.
Try putting it just before this line: Code:
<if condition="!is_browser('opera')"> |
#89
|
||||
|
||||
You dit it
I've finished to integrate your code. I'm trying to improve user interface now. |
#90
|
|||
|
|||
Okay I did what Emmy said and that worked perfectly.
For those who only see the "[dice=6]6[/dice]" and no images, be sure to UNINSTALL the 1_0 xml file before installing the 0_1 file. I believe the reason I had so many problems was that instead of unintalling I kept overwriting. |
#91
|
||||
|
||||
Also, for those who dont want a million buttons you can use this instead:
Code:
<script type="text/javascript"> function dropDownDice(obj){ if(obj.value != ''){ var data = obj.value; var indx = data.indexOf(';'); var diceToRoll = data.substr(0,indx); var faces = data.substr(indx+1); document.getElementById('{$editorid}_textarea').value += '[dice='+diceToRoll+']'+faces+'[/dice]'; } } </script> <td><select onChange="dropDownDice(this);"> <option></option> <option value="1;6">1d6</option> <option value="2;6">2d6</option> <option value="3;6">3d6</option> <option value="4;6">4d6</option> <option value="5;6">5d6</option> <option value="6;6">6d6</option> </select></td> Code:
<if condition="!is_browser('opera')"> NOTE: These do not work if you have WYSIWIG turned on. To add a new dice just add: Code:
<option value="Number of dice to roll;Number of faces">Descriptor</option> |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|