Author: MalkContent, former developer: surfer247
Users may roll dice using the usual code: [dice]3d6[/dice] rolls three six-sided dice. The dice are unable to be changed by normal users, but moderators and administrators can remove and allow users to remove the dice BBCode.
Further it's possible to choose between displaying text or image results, as well as a total result only or in addition to the rest of the roll.
Modification Version:: 0.8.8b
- added a crucial forgotten line to install instructions that prevented the mod from working at all
- small bugfix to posting.php which caused empty array errors
- fixed dicemod acp module php
- a number of little Bugs found and fixed
- fixed Bug that prevented usage of ' in posts containing dicerolls
- rearranged Code
- made Mathparsing Depth available for configuration in ACP
- created "default dicemode" as a forum option
- replaced the modes total and totalonly with combinable modes string and total
- if only the total is displayed, the bbcode replacement now shows the diceroll as hovertext
- Bugfixes only
- fixed Smileys causing SQL errors and disabling usage of dicecode in posts containing Smileys
- fixed error causing posting posts to result empty posts or sql errors in forum that did not allow dice at all
- repaired math parsing
- put dicemod version number into the db
- fixed bug: broken dice quotes in new posts created via quote button
- enabled preview without dice bbcode parsing
- enabled disabling of dice bbcode by disabling bbcode in a post
- enabled disabling dice bbcode parsing by placing it within bbcode
Code: Select all
- hopefully fixed issue with dice rolls being assinged wrong post_ids
- Added a math parser.
- Supports addition, substraction, multiplication and division of float values.
- Supports only one calculation in one bracket set.
- Supports negative numbers.
- The dice roll must be in the deepest bracket layer.
- The function is simply written around the standard rolling code
- Using a function automatically displays the total value, no need for the total tag
- Example: [dice]10/(3d20+3)*-2.5)[/dice]
- To change the function on an existing roll, do as with the previous example, but surround the roll id with f( )
- Example: [dice]10/f(0)*-2.5)[/dice]
- To remove a function from a dice roll, surround the roll id with nomath( )
- Example: [dice]nomath(0)[/dice]
- Changed the way missing or redundant roll ids are handled durin posting:
- Missing dice rolls are added at the bottom of the post
- Redundant dice rolls are removed, only the first code is kept.
- Significant refining changes to old code.
- Added roll crafting.
- I.e. to craft 3 rolls of a d6 resulting in 2,1 and 6, post [dice]d6:2,1,6[/dice].
- You can't produce illegal rolls exceeding the selected die's max pips or the max dice-count.
- Crafting dice rolls requires permission of the moderator permission set.
- Tiny refining changes to old code.
- Updated version number displayed in the APC module. I won't miss updating that one again...
- All bugfixes.
- Added missing acp language file entries.
- Corrected wrong database column name of the v0.7.1 install version (doesn't affect people who updated to v0.7.1 from 0.5.0).
- Mod went Beta =)
- Removed a minor bug regarding the quote-post-button.
- Re-added the totalonly tag.
- Reformatted large sections of the code.
- Did some minor code improvements
- Added permission settings for fora and users/groups in fora.
- Reworked the ACP Module.
- Added semi-autodetect for available dice themes.
- Added ACP module.
- Refined code segments.
- Renamed dice images for more significance and relocated them. Adapted Code.
- Fixed critical bug which prevented usage of any display modes.
- Fixed issue with text mode only being displayed in Firefox Browsers.
- Rewrote installation instructions to fit phpbb 3.0.6
- No update instructions to prevent bugs being carried through updates. Also I don't have the time this time.
- Added UCP frontend.
- Refined parsing of the bbcode.
- Added database entry for the allowed dice.
- Added 'Bajahs Red' dice-skin, renamed 'stock'-skin to 'Classic Steel'.
- Minor bug regarding the parsing bbcode for existing rolls corrected.
- German language installation instructions now working.
- Changed the way the text like (USER rolled X Y-sided dice) in front of the actual dice roll was parsed in the bbcode.php to ease the translation and make the languagefile entries less confusing.
- Put in a small prevention against rolling new Dice via [dice]NumberNumber[/dice] for users using language packs without a set DICE_CHAR in language/*/common.php. If no DICE_CHAR is defined, the BBCode requires the english 'd' between the numbers.
- Made quoting via Quote-Button automatically insert the 'post_id:' in front of the roll_id: [dice]0[/dice] in the original Post with post_id = 254 -> [dice]254:0[/dice]
- Bug regarding the limit of allowed dice rolls per post corrected.
- Changed the location of the code segment responsible for deleting dice rolls on post deletion to grant greater consistency.
- Removed useless code segment from bbcode.php and built in a small method so that [dice][/dice] isn't parsed as [dice]0[/dice] anymore.
- Added langfile entries for quoted rolls former "Original post:" prefix and made it depending on users language.
- Added installation instructions for languages other than British English to the download file. Additional languages: US English, German (Casual Honorifics), German (Formal Honorifics) (For some reason .xml files for the german language files not working at the moment because of the use of the umlaut ü will release a version 0.3.7b when figured out. So far you can just open the .xml files with an editor to see the text, but please be careful.)
- Accidently published wrong install.xml, replaced it with the actual one.
- Seemingly abandoned mod overtaken by MalkContent.
- Fixed some bugs, made the mod more consistent and lightweight database-wise.
- Changed way of identification of dice rolls to be more intuitive.
- Removed the ACP module in favor of language files. Ability to remove dice still controllable by permissions.
- Added images for common dice.
- Version number went back to 0.3.0 as I consider it working yet incomplete.
Dice (Images). Yeah.
Download v0.8.8b targeted at 3.0.10, Warning: still experimental, probably more stable
Download v0.8.4b targeted at 3.0.10, Warning: still experimental
Download v0.8.3 targeted at 3.0.10, Warning: experimental
Download v0.8.1 WARNING, BUGGED! DL only for the sake of sharing the code. Unless you want to attempt to fix this version, please refrain from using it. targeted at 3.0.8, quite alot of code changes.
Download v0.7.3 targeted at 3.0.8, install.xml/update.xml are NOT tested! Does only contain update from 0.7.2 to 0.7.3.
Download v0.7.2 targeted at 3.0.7-PL1, tested
Download v0.7.1 targeted at 3.0.7-PL1, tested and slightly bugged, please update to 0.7.2 if you are currently using this version
Download v0.5.0 targeted at 3.0.6, not tested, but considered working, update included
Download v0.4.5 targeted at 3.0.6, working as intended
Download v0.4.4 old version, bugged, no update instructions
Download v0.3.7 old version, includes update instructions from v0.3.1 to v0.3.7 and installation instructions for US English, German (Casual Honorifics) and German (Formal Honorifics)
Download v0.3.1 old version (not recommended)
How to use the Dice BBCode:
You can, for example, roll 3 6-sided dice by typing [dice]3d6[/dice].
After posting, your roll is displayed as chosen by you in the user control panel.
You can add tags to the code, to differ the way the roll is displayed, by adding the tags like this:
You can also add the tags afterwards by editing your post. Note that the "3d6" will then already be replaced by a identifier code for this diceroll.
You also can combine tags like this:
Tags available at the moment:
total - displays the total of the dice roll in addition to the roll itself.
totalonly - displays only the total of the dice roll. Does not work together with total.
quote - used for quoting your own dicerolls in the same post.
As of v0.7.3, dice rolls can be crafted artificially.
In example: To craft a d6 roll resulting in 2,1 and 6, use:
EDIT: TEXT AND IMG TAGS FOR DICE BBCODE ARE NOT IN ANYMORE! TO SET THE DISPLAY MODE, VISIT THE UCP!
Alea iacta est:
Once you posted a dice roll, its original BBCode is replaced by one looking like this: [dice]0[/dice]
The zero can be anything between 0 and 255 and counts up with the number of dice rolls posted in your post, being the dice rolls id.
Also you can quote >other< peoples dice rolls with or without using the quote tag by writing [dice]91:0[/dice], where 91 is the post's id and 0 the roll's id.
Customising the BBCode:
There is an ACP module for the mod
I think it's pretty self explanatory. Setting limiter numbers to 0 removes the limit, but I highly advise against that. If any questions arise regarding the ACP module, use this topic to ask them and I might add more explanation unless I was bored by it
- No BBCode referring to existing rolls (all possible combinations tried, no quotes possible, too) is parsed when a post is shown in the news of phpbb3portal. However it still works correct if the post itself is looked at.
- While not tested and confirmed, I am practically sure that it might cause the code to work incorrect at times if multiple users using the same account at the same time post new dice rolls at the same time. Thus you should avoid enabling guest or anonymus accounts to post dice rolls.
- Extension of the ACP module for better management of dice themes
- Some fancy calculation and reroll features for the rolling process
Hope I didn't forget anything. Ahja! The mod was started in this thread by surfer247! I merely took it over.
Also please report bugs if you find them, ty =)
PS: The "classic steel" images for the dice are old renders done by me. Feel free to use them for anything you like even if you earn money with it. But I must insinst that, should you become OR be a millionaire(in US Dollars), you owe me an icecream. In any case I keep me the right to insist on a 2% share if I feel like it. So if you earn a Dollar (or Euro) I get my two cents. Yes, it's for the sake of the pun and yes I am serious. Imagine some kind of artist making a famous collage with those dice. Man would it suck if I wouldn't get my ice cream. And also the money. I spent good time rendering those dice back then ^^
But I guess I won't bug you if I don't feel like it or you are a cool guy who needs the money and didn't make it too big with my ohsoprofessional renders.
Q: I installed the mod but I can not roll dice or anything, BOOHOOOOOOO, what did I do wrong?
A: Nothing. You probably just failed to do something right. Do not forget to enable dice rolling in the forum settings. If it is set to "Depend on user", also don't forget to allow the respective users to roll in that forum.
Q: I installed the mod but I can not CRAFT dice or anything, BOOHOOOOOOO, what did I do wrong?
A: Are you serious? Just look at the damned previous question O.o You gotta allow dice crafting. It's in the moderator permission set. I am not sure if someone like you should be allowed to do such vile forgery as I enabled you to.(for the sake of the coolness factor of previous statement I hope my english skills didn't fail me)