![]() |
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> |
....and another variation that requires less work from you but a little more from the users:
Code:
<script type="text/javascript"> |
so these only work with quick reply or the non advanced wysiwyg editor? or it won't even work on quick reply if the other is enabled?
|
RPG DICE IS READY !
That's good, i've finished my job :) Sorry for the delay, i had a busy day. So what's new : -sql problem is fixed -dice in first thread are working -new user interface integrated in Quickreply and in Editor tool bar And the best for the end : Everything is automatically installed with the xml product file :) To see the result, have a look at the pictures. P.S : I'd like to know if i can translate and distribute this hack to vbulletin-fr for french users. EDIT : files removed for a new release. |
wow, all of the menus look great! I'll be studying them and figuring out which one to add to my site. So glad we were able to figure something out for this...will really make it easier for the game players.
Quote:
Is this a good time to re-ask one last question I have? I mentioned it before in another post. But I would like to install this hack more than once, to use to play different games that have different images...numbered dice, playing cards, rolling alphabet letters. If I took the xml file and changed every instance of "dice" to "dice2" and then imported it would I get a second installation of the game that uses [dice2] as the bbcode? Would that work? Or can someone rewrite the code using "cards" and "alpha" instead? Thanks for any help. |
Yes, in theory if you changed all that it would make a new bbcode, but of identical function. you'd need to add new templates as well if you wanted to change output and modify the code for cards to some extent.
You can translate this into any langauge you'd like, but it isnt done yet. I like the drop down below but I prefer my own method as its smaller, to each his own. When i attempted the use of it in a WYSIWIG it did not apear in the editor because you have to write special code from what i recall to handle the WYSIWIG. That is something a little more complex then this simple JS. It should in theory show up but unparsed. I may look into this later. In a few hours when i have this other work done i am going to tackle the code and rip it to pieces for my own uses which does sort of render the buttons as useless to some extent but I will see what I can do. |
Just to say that i've also got the wysiwyg problem.
|
speaking of modifying the code for cards....I guess what I'd need is something that assures that the same card isn't drawn twice (suppose you draw 5 cards...two of them can't be the ace of hearts...unlike dice, where you CAN roll the same number twice). I don't suppose anyone here would know how to make that modification? :hopeful: :D
Oh, oh, oh....just had another idea. What would be ideal for cards is if the same card couldn't be drawn more than once in EACH THREAD. That way if you're playing a card game, taking turns drawing from the deck, you don't get cards repeating themselves, no matter who is doing the drawing. If each thread was a new game, then limiting it to one draw of each card PER THREAD would be the way to go. I would absolutely love this....any possibility? |
To avoid the wysiwyg problem, just tell for the moment your members to click "A/A" in the top right corner of the editor to make dice buttons work.
To see RPG Dice in action go there : www.lesatirique.info/forum/showthread.php?t=2421 |
Thanks for the work around cclaerhout, or should I say Merci?
One more question, on your interface can you 'mix' the different dice in one roll? i.e. 1d5 1d10 1d20 (1 for # of dice,d for dice, 5/10/20 for # of faces) did that make sense? |
Quote:
|
Add that to the select in the same post. It will add another entry to the option drop down.
|
Nice work cclaerhout!
Although there seems to be another bug, when rolling multiples of a d10 sometimes it drops the last image of the dice. For instances if I do 2d10 I only see one image of the dice and if I do 3d10 I only see 2 images. It seems to replace an image with the "D10" at times. Here is an example that I have: http://www.darkram4.com/forums/showthread.php?p=9#post9 |
The script is executing okay but you are getting red x's instead of two of the images. It looks like those images are missing, either they were accidentally left out of the package or they didn't upload properly to your images folder.
You're missing: d10_8.png d10_9.png |
Quote:
As the original script you can mix dice, but it will give you several windows with one for the D4, one for the D6, one for D10, etc. In fact the roll is the moment whrn you press the "Ok" button. I think it's better to have several windows to count different faces dice seperately. But you can't launch a 1D5, because D5 doesn't exist in user interface. If you do it manually with the bbcode, the dice window will be blank because the D5 has no picture (i don't think it exists). |
Quote:
In fact i've seen this problem yesterday night (In France it was night) but i was too tired to correct it ;D It's very easy : picture exist but are called "d10_08.png d10_09.png" ; rename them "d10_8.png" "d10_9.png" |
Quote:
|
|
I've updated my archive here.
The name of two pictures have been corrected. Eikinskjaldi you don't answer me, can i distribute RPG hack to vbulletin-fr.org ? Of course, everybody will be in the credit. |
Quote:
:banana: BTW: Thanks its from the World of Warcraft style here. |
I've got another question/idea.
I'm using Eiken's drop down menu to choose the dice roll. Is there any way to have that menu ONLY show up in my games forum? So it doesn't appear on all the toolbars in all my forums? What would the conditional statement for that be? I can express it verbally but I can't code it.... Code:
<if forum id = 6> |
The solution is :
For forums ID : Code:
<if condition="in_array($GLOBALS[forumid], array(XX,XX,XX,XX))">THE CODE</if> Code:
<if condition="in_array($bbuserinfo[usergroupid], array(XX,XX,XX,XX))">THE CODE</if> Code:
<if condition="in_array($GLOBALS[forumid], array(XX,XX,XX,XX)) AND in_array($bbuserinfo[usergroupid], array(XX,XX,XX,XX))">THE CODE</if> !in_array instead in_array. |
I've updated again RPG DICE archive... I've forgot to rename one picture this morning :D I musn't be awaken.
To make me forgiven, i've uploaded a new blue dice set in option. Click here to see the post |
cclaerhout, thank you so much! I will try it out. Quick question though, do I need to use an array if it's just one forum I want in there?
|
Quote:
Just use that syntax : <if condition="in_array($GLOBALS[forumid], array(XX))">THE CODE</if> If you want to add a parameter later, it would be easier with the array syntax. |
He makes a very good point, its not how id do it for a released hack with options page, but for this hack this is the smart way to go, at least for now, I havn't decided if the re-write will use option pages, maybe.
|
okay thanks, I'll give it a try!
|
RPG DICE
Version 2.0 >Credits : -Dice Roll (original script) by Rigel Kentaurus -Ported to vB 3.5 by Eikinskjaldi -RPG version developped by C?dric Claerhout -Thanks to Emmy2 for her help >What does this hack do ? It gives your forum a RPG Dice system. >Is it hard to install ? No at all ! -Download a set of dice (red or blue at the moment) then upload the images to ./images/dice in your main forum directory, you will need to create the dice folder. -Go into ACP and upload the XML through the product manager. -Go to vBulletin options (admincp) and configure RPG Dice. >Is there any bug ? Unfortunately yes. Just one. The user interface dice buttons doen't work with wysiwyg editor. Solution : tell your members to click on the A/A button in the top right corner of the editor. >Functionalities : -(nice :D)user interface to throw the dice integrated both in classic editor and quickreply -admincp configuration to choose usergroupid and forumid -type of dice : D4, D6, D8, D10, D12 and D20 -Dice pictures in PNG format -installation only requires one xml file thanks to vB product import system |
I still haven't had my answer to a question i've asked several times above. Can i distribution the french version of this hack on vbulletin-fr.org ?
|
I said yes a page back....
|
Quote:
|
All times are GMT. The time now is 01:05 PM. |
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:
|