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 |
#52
|
|||
|
|||
Quote:
As previously stated on the FIRST page the changes are not being made to the database when you install/import this product. You'll have to ALTER the ***_thread & ***_post yourself. Do the following:
|
#53
|
|||
|
|||
also, as Eiikenskjaldi stated above he ported this product from it's original (written by someone else) that was for ver 3.0 so that it could be used for ver. 3.5.x the xml file
to add a button as Emma2 suggested would require more than this simple xml file/product. There is a hack somewhere for adding additional bbcode buttons to the editor. This is just a simple and easy way to be able to roll dice by typing the bbcode for it, just like adding an img tag or url tag when typing a post, it's NOT really that hard to type [dice=1]100[/dice] is it? Having 20 buttons for different dice rolls on the WYSIWYG editor could get a bit crowded anyway, don't you think? IF you were ONLY using, for your board a SINGLE predetermined number of die with a predetermined number of faces (i.e. only able to roll x number of die that have z number of faces) yes a button would be the thing to go with, but that wasn't the purpose of this hack.. You can always put a request for someone to write a hack that does this in the request forum, or pay someone to do it. I don't have all the know how to. |
#54
|
|||
|
|||
Quote:
That is in the actual xml file and has to be changed prior to importing. wherever you saved the xml file on your computer, open it using notepad or wordpad.. some type of equivalent editor. Then use 'Find' to seach and located the code, then change it EDIT: hit submit too soon :eeps: Then save the file and reimport, be sure to check 'Yes' to overwrite for the import process. EDIT: :eeps: i must need more coffee i totally read and replied wrong, have fixed my reply now tho ignore the attached image it has nothing to do with the section of code Zowner was asking about. Edit: I definiately need more coffee or another brain... the image attached DOES have everything to do with this all that code change in the xml file was change the 'wording' above the pics of the dice in the post 'dices' was not correct you would use either 'die' or 'dice' and it bugged me seeing 'dices' made me want to grab a knife and an onion... |
#55
|
|||
|
|||
Quote:
The changes I (as Rukbat at the time) made were for customizing it for MY board/forum (using up to 9 dice with up to 100 faces), and also changing the 'Dice roll with x dices of ** faces: *** points' phrase to 'Dice roll with x dice of ** faces: *** points' because 'dices' is not the plural and it bugged me. So now.... ################### INSTALL INSTRUCTIONS ################ 1. Access the database you use for your forum
4. Copy and paste the below code into notepad (or other xml editor), change the '***' prefix for the tables to the prefix YOUR database has for all it's tables, then SAVE it as: Eikin-DiceRoller-1_0.xml (in notepad 'save' box be sure to have the file type set to 'all files' NOT as TEXT/TXT and the encoding as ANSI): Code:
<?xml version="1.0" encoding="ISO-8859-1"?> <product productid="dice" active="1"> <title>Dice Roller</title> <description>Rolls dice in postbit</description> <version>1.0</version> <codes> <code version="1.0"> <installcode>ALTER TABLE `***_thread` ADD `dice` MEDIUMTEXT NOT NULL ; ALTER TABLE '***_post' ADD 'dice' MEDIUMTEXT NOT NULL ;</installcode> <uninstallcode /> </code> </codes> <templates> <template name="dice" templatetype="template" date="1145915902" username="admin" version="3.5.4"><![CDATA[<img src="images/dice/$point.gif" width="76" height="80" />]]></template> <template name="postbit_dice" templatetype="template" date="1145915990" username="admin" version="3.5.4"><![CDATA[<table border="0" align="center" width="90%" cellpadding="3" cellspacing="1"> <tr> <td><smallfont><b>Dice roll with $dicesno dice of $dicesfaces faces: $dicepoints points</b></smallfont></td> </tr> <tr> <td style="BORDER: #000000 1px solid; FONT-SIZE: 11px; COLOR: #000000; BACKGROUND-COLOR: #D7D7D7;"> $dicedata </td> </tr> </table><br/>]]></template> </templates> <plugins> <plugin active="1"> <title>dice_process_data</title> <hookname>newpost_process</hookname> <phpcode><![CDATA[// Hack if (@eregi("\[dice",$post['message'])) { $diceresult = array(); preg_match_all("/\[dice=([1-9])\]([0-9]?[0-9]?[0-9])\[\/dice\]/",$post['message'],$diceresult); $dices = $diceresult[1]; $faces = $diceresult[2]; $dicedetail = array(); $rollcount = count($dices); $validdice = 0; for ($i = 0; $i < $rollcount; $i++) { if ($faces[$i] >= 2 && $faces[$i] <= 100) { $diceresult[0][$i] = str_replace("[","\[",$diceresult[0][$i]); $diceresult[0][$i] = str_replace("]","\]",$diceresult[0][$i]); $diceresult[0][$i] = str_replace("/","\/",$diceresult[0][$i]); $post['message'] = preg_replace("/".$diceresult[0][$i]."/","[dice".($validdice)."]",$post['message'],1); $dicedetail[$validdice]['dices'] = $dices[$i]; $dicedetail[$validdice]['faces'] = $faces[$i]; $dicedetail[$validdice]['data'] = array(); for ($j = 0; $j < $dices[$i]; $j++) { $dicedetail[$validdice]['data'][] = rand(1,$faces[$i]); } $validdice++; } } if (!empty($dicedetail)) { $dataman->set('dice',serialize($dicedetail)); } } // End Hack]]></phpcode> </plugin> <plugin active="1"> <title>dice_postbit_convert</title> <hookname>postbit_display_complete</hookname> <phpcode><![CDATA[// Hack: dice if ($post['dice']) { $dicearray = unserialize($post['dice']); $totalroll = count($dicearray); for ($i = 0; $i < $totalroll; $i++) { $dicedata = ""; $dicepoints = 0; $dicesno = $dicearray[$i]['dices']; $dicesfaces = $dicearray[$i]['faces']; foreach ($dicearray[$i]['data'] as $point) { eval('$dicedata .= "' . fetch_template("dice") . '";'); $dicepoints += $point; } eval('$dice = "' . fetch_template("postbit_dice") . '";'); $post['message'] = preg_replace("/\[dice$i\]/i","$dice",$post['message']); } }]]></phpcode> </plugin> <plugin active="1"> <title>dice_set_valid_fields</title> <hookname>postdata_start</hookname> <phpcode><![CDATA[$this->validfields['dice'] = array(TYPE_STR, REQ_NO);]]></phpcode> </plugin> <plugin active="1"> <title>dice_set_valid_fields_new_thread</title> <hookname>threadfpdata_start</hookname> <phpcode><![CDATA[$this->validfields['dice'] = array(TYPE_STR, REQ_NO);]]></phpcode> </plugin> </plugins> <phrases> </phrases> <options> </options> </product> 4. Go to a forum and test the formatting (described below). ################# FORMATTING INFORMATION ################ To roll a dice use the following tag, [dice=X]Y[/dice] X - The number of dice to roll (This cannot be larger than 9 currently, I'm not a coding whiz and not sure how to fix this but I AM looking into it.) Y - The number of sides on the dice (This cannot be larger than 100 currently, mainly because I don't feel like making more dice, but if YOU do feel free, just find in the xml file (again using notepadchange the ) the following Code:
if ($faces[$i] >= 2 && $faces[$i] <= 100) so [dice=1]6[/dice] Roll's 1, 6 sided dice. NOTE: Currently you CANNOT make a dice roll in the first post of a new thread, only in reply posts. I'm not a coding-whiz so I don't know how to fix it, but I'll try looking into it in the next couple of days and post another reply here. The hack isn't buggy except for the table altering, as long as you go in and make those changes to the 2 tables yourself via phpMyAdmin (or whatever) it works fine. |
#56
|
|||
|
|||
Quote:
|
#57
|
||||
|
||||
I think the sql problem shoud be fixed with this new product file.
I'm still thinking the idea suggested above would be great. If each time you want to play dice you have to type the code, members are going to be upset. I'm going to look if i can do it. Anyway we can ask Michelle, the hacker of e-steki Smilie Maker 1.7 to help us Edit : file removed because update on next page. |
#58
|
||||
|
||||
Quote:
|
#59
|
||||
|
||||
it doesn't show the dices.I imported it and it doesn't show the dices there is only [dice=1]6[/dice]
|
#60
|
|||
|
|||
Quote:
|
#61
|
|||
|
|||
Quote:
That would be great if Michelle could help, bribe her maybe???? lol Looking at the xml version you attached it 'looks' like the code for altering the two tables should work (I was just looking at that part of the code and fixing to try to fix it... thanks for saving me the trouble), anyone try it yet? A note tho... the 'dices' word is still there instead of 'die' or 'dice' so that would need to be changed if anyone else is as anal about that as I am Another note your's is only for up to 5 dices of 30 faces each. So anyone needing up to 9 dice would need to change Code:
preg_match_all("/\[dice=([1-5])\]([0-9]?[0-9])\[\/dice\]/",$post['message'],$diceresult); Code:
preg_match_all("/\[dice=([1-9])\]([0-9]?[0-9]?[0-9])\[\/dice\]/",$post['message'],$diceresult); Code:
if ($faces[$i] >= 2 && $faces[$i] <= 30) |
Thread Tools | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|