The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Javascript dice roller in bbcode
I'm attempting to make a javascript based dice roller inside of a bbcode.
Issue is that I'd like it to be [roll]{param1}d{param2}[/roll] and I'm pretty sure that isn't possible. Am I barking up the wrong tree trying to do it this way? And if so, does anyone have advice on a better way to do this? |
#2
|
||||
|
||||
|
#3
|
||||
|
||||
I did. Oddly enough I can't even get it to install on 4.2.3
That it doesn't even make the database changes in threads and posts like it's suppose to, it just kind of stops after you upload it. |
#4
|
||||
|
||||
What kind of behavior are you looking for exactly? Are you looking for something static (the dice are "rolled" and the values stored in the database upon submitting the post), and remains fixed thereafter, or something that rolls the dice each time the page is loaded, with different results, or even something that can be clicked (an unlimited number of times) once the page is loaded?
|
#5
|
||||
|
||||
I'm looking for something static, for sure.
|
#6
|
||||
|
||||
In order for it to be static, you could use PHP, and parse the post either on preview or submitting the post (whichever happens first) to change pre-defined text into the dice roll before the post is saved to the db. You could choose to have the parsing only take place when the post is submitted, and skip the preview, allowing the tags or whatever code you define to be a dice roll remain until the post is actually submitted. My choice would be to parse the post in both places.
I do something similar in a couple of my products. Let me know the parameters you want (number of dice, number of faces on each die, etc.) and I will see what I can come up with. |
#7
|
||||
|
||||
I'd really appreciate it. I was thinking of allowing something like xdy+z where x is the number of dice being thrown, y is the number of sides on the dice, and z is the modifier being applied to the dice. So if a member where to use [roll]3d10+2[/roll] it would roll three ten sided dice and add 2 to whatever the total was.
I'd appreciate any help I can get, but I really don't want to make you go out of your way: I do appreciate it though. |
#8
|
||||
|
||||
Quote:
|
#9
|
||||
|
||||
Well, having them all in a nice box as 4,7,2 (+2) = 15 would be nice, having any number show up would be ideal. To be honest, I'd take whatever you feel would be best in this situation.
|
#10
|
||||
|
||||
Okay, create a plugin hooked at "newpost_process" with the "Plugin PHP Code":
PHP Code:
|
Благодарность от: | ||
kerrghann |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|