[ABD] Dicemod

Any abandoned MODs will be moved to this forum.

WARNING: MODs in this forum are not currently being supported or maintained by the original MOD author. Proceed at your own risk.
Forum rules
IMPORTANT: MOD Development Forum rules

WARNING: MODs in this forum are not currently being supported nor updated by the original MOD author. Proceed at your own risk.
MalkContent
Registered User
Posts: 203
Joined: Mon Aug 18, 2008 10:00 am

[ABD] Dicemod

Post by MalkContent »

Modification Name: Dicemod
Author: MalkContent, former developer: surfer247

Modification Description::
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

Changelog::
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
0.8.8:
  • 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
0.8.4b:
  • 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
0.8.4:
  • repaired math parsing
  • put dicemod version number into the db
0.8.3:
  • 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
  • hopefully fixed issue with dice rolls being assinged wrong post_ids
0.8.1:
  • 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.
0.7.3:
  • 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...
0.7.2:
  • 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).
0.7.1:
  • 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.
0.5.0:
  • Added ACP module.
  • Refined code segments.
  • Renamed dice images for more significance and relocated them. Adapted Code.
0.4.5:
  • 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.
0.4.4:
  • 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.
0.3.7:
  • 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.)
0.3.1:
  • Accidently published wrong install.xml, replaced it with the actual one.
0.3.0:
  • 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.
Important Info: Custom BBCode helpline may not work with phpBB versions older than 3.0.5 . Php version it's developed on is 5.2.11.

Features:
Dice (Images). Yeah.

Screenshots: Image

Modification Download:

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:
[dice=tag]3d6[/dice]
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:
[dice=tag1,tag2,tag3]3d6[/dice]

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:
[dice]d6:2,1,6[/dice]

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 ;)

Known Issues:
  • 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.
To Come:
  • 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.

F.A.Q.:
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)
Last edited by MalkContent on Wed Jun 06, 2012 8:37 pm, edited 45 times in total.
User avatar
imkingdavid
Former Team Member
Posts: 2673
Joined: Sun Jul 26, 2009 7:59 pm
Location: EST
Name: David King

Re: [DEV] Dicemod

Post by imkingdavid »

wow, sounds great. I'll keep my eye on this thread. :D
Don't forget to smile today. :)
Please do NOT contact for support via PM or email.
User avatar
Ashley.S.
Registered User
Posts: 469
Joined: Mon Aug 04, 2008 6:01 pm
Location: Falmouth, Cornwall, UK
Name: Ashley .S.

Re: [ALPHA] Dicemod

Post by Ashley.S. »

hurray, hurray! I'll be watching for updates
Regards,
-Ashley.S. [ PurephpBB Founder ]
MalkContent
Registered User
Posts: 203
Joined: Mon Aug 18, 2008 10:00 am

Re: [ALPHA] Dicemod

Post by MalkContent »

By the way, I'd appreciate some testers and/or help with finding bugs.
The one thing that bugs me the most is that the dicerolls are referring to post_id both in the database and in the text.
I am not too familiar with the phpbb core code by now, but I guess there is some kind of function to rearrange the post_id count. If something like that happened it could leave a lot of trash in the database AND it could give complications when new posts get the post_id of old posts which had a dice roll in them.

But that's the only "serious" thing.
Only thing else is that it is by now possible to post more than one instance of the same dice roll without a quote tag in the original post. Some may call this unimportant. I call it a nightmare of gm's with powerplayers in their adventure xD
Minor thing though, but I need a little pause from coding atm. And the new semester started.
Don't expect a major update within this year ^^
Will only happen if I get help OR grow terribly bored with anything else fun.

Still, if some1 could point me to those "rearrange functions" (given the case of their existence) the bugfix will be done asap!

I also would be very grateful for a tutorial on how to add permission options in the acp!


Thanks every1 =)
MalkContent
Registered User
Posts: 203
Joined: Mon Aug 18, 2008 10:00 am

Re: [ALPHA] Dicemod

Post by MalkContent »

To everyone who already downloaded the mod:
Please re-download it.
Some minor changes have been applied to the install.xml because I swapped the install.xml with one around 5 minutes older than the actual one!
The new one saves you around 50 byte of data crap, perhaps more, and also comes with a working languagefile-based helpline.

Sorry for my little mistake.
bajah
Registered User
Posts: 17
Joined: Thu Oct 08, 2009 9:21 pm

Re: [ALPHA] Dicemod

Post by bajah »

Fantastic! Now I just need to put my php-noobness to work and figure out how to install it.

While I'm not a millionaire, nor expect to be one anytime in the foreseeable future, I'd happily buy you an ice cream. :lol:
bajah
Registered User
Posts: 17
Joined: Thu Oct 08, 2009 9:21 pm

Re: [ALPHA] Dicemod

Post by bajah »

Fatal error: Call to undefined method bbcode::decodedice() in /home/bajah/public_html/dnd/includes/bbcode.php(112) : regexp code on line 1
This is the error I get when I try to open any post where I've used the BBCode. As far as I'm aware, I've followed the installation/setup steps word for word.
Last edited by bajah on Tue Oct 13, 2009 3:29 pm, edited 1 time in total.
bajah
Registered User
Posts: 17
Joined: Thu Oct 08, 2009 9:21 pm

Re: [ALPHA] Dicemod

Post by bajah »

All right. I just deleted the changed bbcode.php and started over with the changes. Seems to work now, sort of. No errors. But the post is blank. I'll have to keep playing with it :)
bajah
Registered User
Posts: 17
Joined: Thu Oct 08, 2009 9:21 pm

Re: [ALPHA] Dicemod

Post by bajah »

Okay, I've tried everything I can think of and while I'm no longer getting errors, I just get a blank anytime I try to use the bbcode. I'd welcome any thoughts. Thanks! :)
MalkContent
Registered User
Posts: 203
Joined: Mon Aug 18, 2008 10:00 am

Re: [ALPHA] Dicemod

Post by MalkContent »

Hm, that's strange :/ I installed the mod to my (non test) board yesterday and it works fine.

Did you try adding some text to the dice roll? If you did, was the whole post blank or only without the dice code? What Board-Version are you running?

Also: Purging the cache is necessary (just in case ^^).

By the way, the error message above makes me question you if you added the second mod codelines for include/bbcode.php

In case you did everything right, please note that you are required to add the language strings for languages other than english by yourself (in case you are using a language other than english i guess the text the bbcode would simply be: "", nothing at all).
Last edited by MalkContent on Tue Oct 13, 2009 4:33 pm, edited 1 time in total.
bajah
Registered User
Posts: 17
Joined: Thu Oct 08, 2009 9:21 pm

Re: [ALPHA] Dicemod

Post by bajah »

I tried copy/pasting your "how to use" text and I still had all of the normal text, just any code spit out as not being there at all.

Example:

Your message
While [dice]3d6[/dice] rolls 3 6-sided dice and stores them, one can choose the way the roll is displayed with a number of tags.
[dice=img]3d6[/dice] would display the roll using the images included in the mod's files.
[dice=total]4d10[/dice] displays only the total of the whole roll of 4 10-sided dice.
img and total can be combined using a comma between like this: [dice=text,total]1d20[/dice]
text? yes, there's a text mode, which displays written numbers instead of images for the single dice results.
However, you can NOT combine the img and the text mode.
Last but not least, there's the quote tag which allows to quote your own dice roll within it's own post (you can not double post the same diceroll without a quote tag).
In case no tag is defined, the standard mode, which is defined in the database, is choosen.
returns as:
While rolls 3 6-sided dice and stores them, one can choose the way the roll is displayed with a number of tags.
would display the roll using the images included in the mod's files.
displays only the total of the whole roll of 4 10-sided dice.
img and total can be combined using a comma between like this:
text? yes, there's a text mode, which displays written numbers instead of images for the single dice results.
However, you can NOT combine the img and the text mode.
Last but not least, there's the quote tag which allows to quote your own dice roll within it's own post (you can not double post the same diceroll without a quote tag).
In case no tag is defined, the standard mode, which is defined in the database, is choosen.
on my boards.

I fixed the error, though. I had a { in the wrong place :)

I'm running 3.0.5

I'll PM you the URL if you want to visit and take a look for yourself. (also, purging the cache - how do I do that? remember, I'm a noob :))
User avatar
Brf
Support Team Member
Support Team Member
Posts: 53609
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}

Re: [ALPHA] Dicemod

Post by Brf »

There are no "rearrange functions" to change post_ids. You should be probably safe using it as a key, as long as you delete your rolls in the delete_post function of functions_posting.
MalkContent
Registered User
Posts: 203
Joined: Mon Aug 18, 2008 10:00 am

Re: [ALPHA] Dicemod

Post by MalkContent »

deleting the dice rolls when their post is deleted is already implented, though not in the functions_posting.php
admin and mod deletions are covered by a small change by me to the functions_admin.php
the delete-button delete however is covered by surfers old code (which i found to seem working and didn't look further into it) within the posting.php. i might change the position of the code if you deem it a more consinstent way, Brf.

@ bajah:
Purging the Cache is done through the ACP. Theres a "Purge Cache" button (ok, the button itself says "Run now") in the General Tab. Not difficult to find =)
Also: I pm'ed you
Last edited by MalkContent on Tue Oct 13, 2009 4:54 pm, edited 1 time in total.
User avatar
Brf
Support Team Member
Support Team Member
Posts: 53609
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}

Re: [ALPHA] Dicemod

Post by Brf »

You should put it in the delete_post function. That handles all of the different ways a post might be deleted, such as when you delete a user or delete a forum.
MalkContent
Registered User
Posts: 203
Joined: Mon Aug 18, 2008 10:00 am

Re: [ALPHA] Dicemod

Post by MalkContent »

Ok, will be done. Since this is something more important, I will do it as soon as I find the time, but you can count on it being done by next monday.
In the meantime please don't mind testing the mod, I will release update instructions from the old version to the new one. So as long as you don't get too delety using other ways then the standard delete-button, you're database should be safe.

Return to “[3.0.x] Abandoned MODs”