Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.5 > vBulletin 3.5 Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Dice Roller Hack [BBCode] Details »»
Dice Roller Hack [BBCode]
Version: 1.00, by Eikinskjaldi Eikinskjaldi is offline
Developer Last Online: Jul 2023 Show Printable Version Email this Page

Version: 3.5.4 Rating:
Released: 04-24-2006 Last Update: 05-29-2006 Installs: 51
DB Changes Uses Plugins Template Edits
Additional Files  
No support by the author.

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:
Info for hackers:
You may modify, improve, upgrade, redistribute this hack, include it
in another hack or yours or translate it provided you do it free of
charge and you distribute it in www.vbulletin.org at least, there is no
need to pm me asking for permission.
This hack rolls a Graphic based dice roll in your post and features multiple dice rolls per post. The images are fully editable by those who know how and I must agree that I very much think they need an overhaul, so go for it.

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:
  • 04/29/06
    • Added new dice images which where provided by Rukbat.

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

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #12  
Old 04-25-2006, 12:40 PM
Rukbat Rukbat is offline
 
Join Date: Feb 2006
Location: Mississippi Gulf Coast
Posts: 47
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Now that I'm not so tired I thought of another question regarding my error message above. What MySQL d/b changes were made? Which table needs new fields and what would the names be to look for to be sure they are there?

EDIT 9:07 CDT

Okay, I went into phpMyAdmin and checked my forum tables '******_thread' and '******_post' and neither table has a 'dice' field.
so do I edit the xml file and change
Code:
<codes>
		<code version="1.0">
			<installcode>ALTER TABLE `thread` ADD `dice` MEDIUMTEXT NOT NULL ;
ALTER TABLE '******_' ADD 'dice' MEDIUMTEXT NOT NULL ;</installcode>
			<uninstallcode />
		</code>
	</codes>
to
Code:
	<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>
with the asterisks being the prefix for all tables in the d/b?

EDIT: 9:46am CDT
That didn't work, BUT, once i went in to phpMyAdmin and added the fields to the two tables it works GREAT!
so I guess there's something in the code in the xml file that didn't actually ALTER my tables.... or was there something else in the xml file that i didn't find where I should have typed in the name of the d/b? I assumed since it was imported/installed using the vB AdminCP that it would 'know' that was the d/b to alter the tables in......
Reply With Quote
  #13  
Old 04-25-2006, 03:14 PM
Rukbat Rukbat is offline
 
Join Date: Feb 2006
Location: Mississippi Gulf Coast
Posts: 47
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm working on making some new images for the die, playing with colors
examples below
Reply With Quote
  #14  
Old 04-25-2006, 06:08 PM
Ziki's Avatar
Ziki Ziki is offline
 
Join Date: Nov 2005
Posts: 2,704
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I got this error


Quote:
Database error in vBulletin 3.5.4:

Invalid SQL:
INSERT INTO forumziki_thread
(postusername, postuserid, title, iconid, visible, forumid, threadprefix, dice, dateline, open, attach, lastpost, lastposter, replycount, hiddencount)
VALUES
('Ziki', 1, 'Dices', 1, 1, 9, 'Site related', 'a:1:{i:0;a:3:{s:5:\"dices\";s:1:\"1\";s:5:\"faces \";s:1:\"6\";s:4:\"data\";a:1:{i:0;i:4;}}}', 1145991674, 1, 0, 1145991674, 'Ziki', 0, 0);

MySQL Error : Unknown column 'dice' in 'field list'
Error Number : 1054
Date : Tuesday, April 25th 2006 @ 03:01:14 PM
Script : http://www.xxxxx.com/forums/newthread.php
Referrer : http://www.xxxxx.com/forums/newthrea...=newthread&f=9
IP Address : XXXXXXXX
Username : XXX
Classname : vb_database
Reply With Quote
  #15  
Old 04-25-2006, 07:19 PM
Rukbat Rukbat is offline
 
Join Date: Feb 2006
Location: Mississippi Gulf Coast
Posts: 47
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ziki-set,
I was having the same problem. For some reason the installer isn't altering your forum database tables (_thread & _post). You need to go into your database and physically add the 'dice' field (mediumtext not null) to those two tables.
That fixed the problem for me.

Also, before installing I corrected some wording in the xml file to correct 'dices' to 'die' because it 'bugged' me:
FIND
Code:
<td><smallfont><b>Dice roll with $dicesno dices of $dicesfaces faces: $dicepoints points</b></smallfont></td>
CHANGE TO
Code:
<td><smallfont><b>Dice roll with $dicesno die of $dicesfaces faces: $dicepoints points</b></smallfont></td>
Also increased the number of 'faces' for dice to 100 since that is what my members needed.
FIND
Code:
if ($faces[$i] >= 2 && $faces[$i] <= 30)
CHANGED TO
Code:
if ($faces[$i] >= 2 && $faces[$i] <= 100)
Of course I had to 'make' die images for 31-100, and upload them to the ../images/dice folder but that didn't take too long.

Hope this helps

EDIT: 3:30pm CDT
hmmmm, that works up to '99' faces but can't get it to work for '100'..... *wanders off to ponder a bit*

EDIT: 3:47pm CDT
got it to work
FIND:
Code:
preg_match_all("/\[dice=([1-5])\]([0-9]?[0-9])\[\/dice\]/",$post['message'],$diceresult);
CHANGE TO:
Code:
preg_match_all("/\[dice=([1-5])\]([0-9]?[0-9]?[0-9])\[\/dice\]/",$post['message'],$diceresult);
see attached screenshot
Reply With Quote
  #16  
Old 04-25-2006, 10:34 PM
Eikinskjaldi's Avatar
Eikinskjaldi Eikinskjaldi is offline
 
Join Date: Feb 2006
Location: Hell, never looked better
Posts: 572
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ya, the install code seems to be errored, I'll work on it and upload the right installer, Thanks rukbat for posting the little mods for others. I might have messed that part up as well.

EDIT:
Upload XML fixed with the correct queries. Sorry about that.
Reply With Quote
  #17  
Old 04-26-2006, 11:33 AM
Ziki's Avatar
Ziki Ziki is offline
 
Join Date: Nov 2005
Posts: 2,704
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Now it doesn't show the dices.I imported it and it doesn't show the dices but only the [dice=2]5[/dice]
Reply With Quote
  #18  
Old 04-26-2006, 11:40 AM
Rukbat Rukbat is offline
 
Join Date: Feb 2006
Location: Mississippi Gulf Coast
Posts: 47
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Did you FTP the dice images into a 'dice' folder in images at your site?
Also, go into your PlugIn Manager in your vB admincp, look to be sure all the plug-ins for 'Dice Roller' are checked as 'active'.
Did you 'unistall' via product manager before installing again?
Reply With Quote
  #19  
Old 04-26-2006, 11:51 AM
Rukbat Rukbat is offline
 
Join Date: Feb 2006
Location: Mississippi Gulf Coast
Posts: 47
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

oops also, you can't create a thread with a post that includes a dice roll
only replies can include the dice roll
easy solution:
create a new thread i.e.
title: dice roller test
text in post: this thread is to test the dice roller
submit the new thread
then post a reply/quick reply to it, including the dice roll bbcode
Reply With Quote
  #20  
Old 04-26-2006, 06:24 PM
Eikinskjaldi's Avatar
Eikinskjaldi Eikinskjaldi is offline
 
Join Date: Feb 2006
Location: Hell, never looked better
Posts: 572
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yes, I need to find the right place to inser the code for the first post, I looked in my quick porting of the hack but didn't find it. It's as simple a fix as inserting the code before the first post is output.
Reply With Quote
  #21  
Old 04-27-2006, 02:50 AM
username12 username12 is offline
 
Join Date: Jan 2006
Posts: 109
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Don't know how high you would be able to go, but here's one vote for more than 5 dice.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:54 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05007 seconds
  • Memory Usage 2,319KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (8)bbcode_code
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete