[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.
Locked
MalkContent
Registered User
Posts: 203
Joined: Mon Aug 18, 2008 10:00 am

Re: [BETA] Dicemod

Post by MalkContent »

Xhanat wrote:- If a user edit a post with a dice roll by modifying it, the dices are not longer shown (being replaced by a code like [dice:1de74j6a]0[/dice:1de74j6a]). This can reverted by editing and saving the post again or disabling/enablig the bbcode in the post, but anyways is a problem.
did anyone else have that error?
I can't reproduce it. Xhanat, please try to specify how and what you are editing about the roll.
thegloater
Registered User
Posts: 1
Joined: Mon May 07, 2012 11:36 am

Re: [BETA] Dicemod

Post by thegloater »

Hi folks - I installed Dicemod on my 3.0.9 forum, but all I'm getting when I post a diceroll (say [dice]2d6[/dice]) is [dice]0[/dice]. I've scanned through the history on this thread, but haven't found my error yet. Anyone have any pointers for which file I could have edited wrongly?

Much obliged for any assistance :D
MalkContent
Registered User
Posts: 203
Joined: Mon Aug 18, 2008 10:00 am

Re: [BETA] Dicemod

Post by MalkContent »

thegloater wrote:Hi folks - I installed Dicemod on my 3.0.9 forum, but all I'm getting when I post a diceroll (say [dice]2d6[/dice]) is [dice]0[/dice]. I've scanned through the history on this thread, but haven't found my error yet. Anyone have any pointers for which file I could have edited wrongly?

Much obliged for any assistance :D
you probably did not install the custom bbcodes (under adminpanel -> posting -> bbcodes) OR forgot to edit includes/constants.php afterwards. see DIY instructions three to four.

On other news, I fixed smileys. Problem here was, that smileys get parsed to html code, which contains "
These " cancled out a sql command, which I used to edit the post message after the post has been submitted, too early, resulting in the sql error.

Making the install/update for the fixed version right now, pls all thank Silverman for telling me about that problem. I hope that this is the end of any critical bugs. I feel a little stupid with the last release being meant to do that, but I had a feeling that there would be problems with editing post messages after the standard parsing.
MalkContent
Registered User
Posts: 203
Joined: Mon Aug 18, 2008 10:00 am

Re: [BETA] Dicemod

Post by MalkContent »

Update is out, see op.
I replaced the link to 0.8.4 with a link to 0.8.4b.
It's really just a small adjustment.
If you don't want to download the pack for it, just go to posting.php, around line 1200 find

Code: Select all

					$db->sql_freeresult($result);
				}
				$message_parser->message = $dmessage;
				$sql = 'UPDATE ' . POSTS_TABLE . ' SET post_text = "' . $message_parser->message . '", post_checksum = "' . md5($message_parser->message) . '" WHERE post_id = ' . $data['post_id'];
				$db->sql_query($sql); 
and replace it with

Code: Select all

					$db->sql_freeresult($result);

					$message_parser->message = $dmessage;
					$sql = 'UPDATE ' . POSTS_TABLE . ' SET post_text = \'' . $message_parser->message . '\', post_checksum = "' . md5($message_parser->message) . '" WHERE post_id = ' . $data['post_id'];
					$db->sql_query($sql); 
				}
(you might also want to update the dice version number, but that is not required for functionality ^^ if you don't understand the next code bubble, just forget it or download the pack and use the database update)

Code: Select all

"UPDATE " . $table_prefix . "config SET config_value = '0.8.4b' WHERE config_name = 'dice_version';";
User avatar
alicia86
Registered User
Posts: 75
Joined: Sat Oct 10, 2009 10:10 pm
Name: Alicia
Contact:

Re: [BETA] Dicemod

Post by alicia86 »

MalkContent wrote:Update is out, see op.
I replaced the link to 0.8.4 with a link to 0.8.4b.
It's really just a small adjustment.
If you don't want to download the pack for it, just go to posting.php, around line 1200 find

Code: Select all

					$db->sql_freeresult($result);
				}
				$message_parser->message = $dmessage;
				$sql = 'UPDATE ' . POSTS_TABLE . ' SET post_text = "' . $message_parser->message . '", post_checksum = "' . md5($message_parser->message) . '" WHERE post_id = ' . $data['post_id'];
				$db->sql_query($sql); 
and replace it with

Code: Select all

					$db->sql_freeresult($result);

					$message_parser->message = $dmessage;
					$sql = 'UPDATE ' . POSTS_TABLE . ' SET post_text = \'' . $message_parser->message . '\', post_checksum = "' . md5($message_parser->message) . '" WHERE post_id = ' . $data['post_id'];
					$db->sql_query($sql); 
				}
(you might also want to update the dice version number, but that is not required for functionality ^^ if you don't understand the next code bubble, just forget it or download the pack and use the database update)

Code: Select all

"UPDATE " . $table_prefix . "config SET config_value = '0.8.4b' WHERE config_name = 'dice_version';";

I'm getting the following error when a user posts with apostrophes:

Code: Select all

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 't realise blasters did that much damage! 4.5*3 + 5 per hit on average. Yeah make' at line 1 [1064]

SQL

UPDATE phpbb_posts SET post_text = '[quote="jaybee3":7fgsypfc]Heh yeah! Wow didn't realise blasters did that much damage! 4.5*3 + 5 per hit on average. Yeah makes sense now. No crits or DPs used?[/quote:7fgsypfc] test quoting', post_checksum = "69eea86ca773dc6de6181a561cf0a405" WHERE post_id = 62558

BACKTRACE

FILE: [ROOT]/includes/db/mysqli.php
LINE: 182
CALL: dbal->sql_error()

FILE: [ROOT]/posting.php
LINE: 1211
CALL: dbal_mysqli->sql_query()
Edit: Only get this error when using apostrophes on forums with Dice enabled. Forum's without dice enabled don't get the error.
User avatar
alicia86
Registered User
Posts: 75
Joined: Sat Oct 10, 2009 10:10 pm
Name: Alicia
Contact:

Re: [BETA] Dicemod

Post by alicia86 »

Alright...
When there's an apostrophe in the post dice bbcode aren't rolled, also it doesn't seem to matter if dice are enabled or not as if there's an apostrophe in the post the SQL error above is appearing.

Here's a couple test posts from my forum:
http://galacticcampaigns.com/forum/view ... =1&t=25234
http://galacticcampaigns.com/forum/view ... 568#p62565
MalkContent
Registered User
Posts: 203
Joined: Mon Aug 18, 2008 10:00 am

Re: [BETA] Dicemod

Post by MalkContent »

god bloody fucking damn. that's what you get when you get too hacky with this crap. I'll try and look up and copy how the original phpbb submits the message to the database. If anyone needs this to work asap, just add

Code: Select all

$dmessage = str_replace("'", "\\'", $dmessage);
before

Code: Select all

					$message_parser->message = $dmessage;
					$sql = 'UPDATE ' . POSTS_TABLE . ' SET post_text = \'' . $message_parser->message . '\', post_checksum = "' . md5($message_parser->message) . '" WHERE post_id = ' . $data['post_id'];
					$db->sql_query($sql); 
in posting.php with dicemod 0.8.4b installed
MalkContent
Registered User
Posts: 203
Joined: Mon Aug 18, 2008 10:00 am

Re: [BETA] Dicemod

Post by MalkContent »

alicia86 wrote:also it doesn't seem to matter if dice are enabled or not as if there's an apostrophe in the post the SQL error above is appearing.
That should not be the case. If rolling dice is completely disabled in a forum by setting the forumsetting "Allow Dice" to no, the redefinition of the post msg by dicemode does not happen. If that is happening to you, I am positive that that's not dicemod related.
User avatar
alicia86
Registered User
Posts: 75
Joined: Sat Oct 10, 2009 10:10 pm
Name: Alicia
Contact:

Re: [BETA] Dicemod

Post by alicia86 »

MalkContent wrote:god bloody *beep* damn. that's what you get when you get too hacky with this crap. I'll try and look up and copy how the original phpbb submits the message to the database. If anyone needs this to work asap, just add

Code: Select all

$dmessage = str_replace("'", "\\'", $dmessage);
before

Code: Select all

					$message_parser->message = $dmessage;
					$sql = 'UPDATE ' . POSTS_TABLE . ' SET post_text = \'' . $message_parser->message . '\', post_checksum = "' . md5($message_parser->message) . '" WHERE post_id = ' . $data['post_id'];
					$db->sql_query($sql); 
in posting.php with dicemod 0.8.4b installed
This seems to have fixed all the issues.
Thanks
vipaka
Registered User
Posts: 492
Joined: Sun Aug 28, 2011 7:25 pm
Contact:

Re: [BETA] Dicemod

Post by vipaka »

I had this mod working before today, now for some reason when posting it shows as the code

Code: Select all

[dice]4d6[/dice]
instead of the actual dice rolls.

All permissions are set to allow dice rolling (in all forums), and all manual instructions for adding the bbcode instructions were followed.

I updated your first update (the change to posting.php) to fix the array offset issue, but not your second since I had already fixed the dmessage string-cleaning issue. Apostrophes, smilies etc will still work with text in a post, but for some reason the dice rolling itself is no longer working. I'm going to try uninstalling and reinstalling with your new version instead of working off the old version and see if that works, but if its the same code as before (with the updates) than this error will still be occurring and I'll still need some support.

Edit: Yeah, broken. When the edits for the last update were not included, it still generates an array offset error, and the post is shown as blank (no matter what) and when they are, the array offset error is gone but the dice rolling code shows as above.
MalkContent
Registered User
Posts: 203
Joined: Mon Aug 18, 2008 10:00 am

Re: [BETA] Dicemod

Post by MalkContent »

vipaka wrote:I had this mod working before today, now for some reason when posting it shows as the code

Code: Select all

[dice]4d6[/dice]
instead of the actual dice rolls.
I fail to reprocude this error :/
Reasons why the code does not get parsed could be:
Dice not allowed (which you ruled out), BBcode disabled, an alternate 'd' (i.e. in the german version it's 4w6 instead of 4d6. the letter is defined in the language files) or maybe a strange pattern failure so the code isn't recognized anymore. I would not rule the last thing out, because since I updated the parsing to take place after the post has been created, the pattern has to include a checksum, since bbcodes work with checksums now.

You should also check the forum administrations mods tab to see if you did mess up the dice constrictions. i.e. if you have "real dice" enabled and d6 is not included in the real dice array anymore, then you won't get that lines parsed.
vipaka
Registered User
Posts: 492
Joined: Sun Aug 28, 2011 7:25 pm
Contact:

Re: [BETA] Dicemod

Post by vipaka »

I'm going to uninstall and reinstall on a vanilla board to be sure it works (regularly) and then retry installing it on my live board. I'll edit any errors/progress into this post.
lagame
Registered User
Posts: 16
Joined: Sun Mar 28, 2010 5:00 pm
Name: Cristiano Lagame

Re: [BETA] Dicemod

Post by lagame »

I would like to thank for the mod, it is actually quite useful, I installed from scratch in a forum and upgraded from an old version to another and had no problem, it took me much longer than imagined, even using Automod, but at least managed to install and update. I don't know if it would be possible, but it would be interesting if you had the option of having buttons custom rollover for each dice type, with the option to choose the amount of dices as well.
MalkContent
Registered User
Posts: 203
Joined: Mon Aug 18, 2008 10:00 am

Re: [BETA] Dicemod

Post by MalkContent »

alright everybody, new version 0.8.8 is out. for the general updatelist, see op.

it includes a couple of small bugfixes, so if you had trouble using dicemod before, it might just work now.
i introduced a new dicemode "string" and removed "totalonly"
[dice=string] results in displaying some kind of representation of the rolled dice (previous standard without any modes), while [dice=total] results in what previously was totalonly. you can combine them like [dice=string,total] to get... both... tadaa. if you don't enter any modes, there now is a forumsetting that allows you to set default modes.

Please be aware that some old files are not needed anymore or are relocated, so please read the DIY instructions carefully if you are updating.

I'll try to look in here for about a month or so, in case there are still bugreports.
-Kind Regards
User avatar
alicia86
Registered User
Posts: 75
Joined: Sat Oct 10, 2009 10:10 pm
Name: Alicia
Contact:

Re: [BETA] Dicemod

Post by alicia86 »

I updated to .88 and even though the update instructions said to delete the old image location the Admin page is throwing this error:
[phpBB Debug] PHP Warning: in file [ROOT]/includes/acp/acp_dicemod.php on line 206: scandir(./../images/mods/dicemod/) [function.scandir]: failed to open dir: No such file or directory

Apparently /includes/acp/acp_dicemod.php included in the root is not current and is not pointing to the new image location.

I changed line 206 of /includes/acp/acp_dicemod.php to:

Code: Select all

$scan = scandir($phpbb_root_path . 'dicemod/skins/');
and it's now working correctly.
Locked

Return to “[3.0.x] Abandoned MODs”