![]() |
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;"> |
Quote:
Code:
[DICE][/DICE] Looking forward to seeing your fix around it. |
Quote:
This method has two problems : 1)you have to enter the number of faces. 2)you can't specify the number of dice. |
yeah I know, is why my eyes started bleeding trying to make it do one or the other and had to quite
|
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]'; Code:
<td><a href="javascript:void(0);"><img src="http://www.yoursite.com/diceimage.gif" title="Roll 5 Dice" 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). |
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? |
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')"> |
You dit it ;)
I've finished to integrate your code. I'm trying to improve user interface now. |
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. |
Also, for those who dont want a million buttons you can use this instead:
Code:
<script type="text/javascript"> 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> |
All times are GMT. The time now is 12:08 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 | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|