[ABD] hanelyp fancy dice

Any abandoned Extensions will be moved to this forum.

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

WARNING: Extensions in this forum are not currently being supported nor updated by the original Extension author. Proceed at your own risk.
User avatar
hanelyp
Registered User
Posts: 124
Joined: Wed Apr 02, 2014 10:20 pm

Re: [dev]hanelyp/fancydice

Post by hanelyp »

koraldon wrote:Installed - not sure why, but when I use the same rolls on subsequent posts in the same topic - I get the same result.
Unable to reproduce that bug. Can you pull up a post with edit and quote for me what it has for the roll? It should look something like

Code: Select all

[dice seed=361968229026 secure=62c3a313]3d6[/dice]
koraldon
Registered User
Posts: 530
Joined: Sat Jun 30, 2007 12:42 pm

Re: [dev]hanelyp/fancydice

Post by koraldon »

Code: Select all

[dice seed=22348715964 secure=72022ea0]3d6[/dice]

[dice seed=21788815254 secure=58f05bbd]3d6[/dice]

[dice seed=23510591464 secure=fb3f6876]3d6[/dice]

[dice seed=22682042306 secure=5ac6a39d]3d6[/dice]
For me all dice results are one
User avatar
hanelyp
Registered User
Posts: 124
Joined: Wed Apr 02, 2014 10:20 pm

Re: [dev]hanelyp/fancydice

Post by hanelyp »

Those dice give me

Code: Select all

3d6 => 3, 3, 4 => 10 invalid
3d6 => 4, 5, 5 => 14 invalid
3d6 => 3, 4, 2 => 9 invalid
3d6 => 6, 1, 2 => 9 invalid
The "invalid" flag is expected taking seeds from a different board. Otherwise the roll results should be identical, unless you've changed the "d" definition to different from "@[1_>]". No obvious installation error would produce incorrect all 1 rolls.

As a test go into the ACP and define
'p' => '@["*", "**", "***", "****", "*****","******"]'
then roll a 3p.
koraldon
Registered User
Posts: 530
Joined: Sat Jun 30, 2007 12:42 pm

Re: [dev]hanelyp/fancydice

Post by koraldon »

Tried it, this is my result:
קוביות: 3p
תוצאות הגלגול: *, *, *. סך-הכל: * * *

Sorry for the hebrew, but it is basically again 1, 1, 1.
I have tried to reset the dice bbcode, didn't help.

this is the edit info:

Code: Select all

[dice seed=22348873619 secure=bd59fdd3]3p[/dice]
Also tried to disable and delete all data, also no effect.
Downgraded to 0.7, and it works.
Re-upgraded to 0.8, and again I get all 1,1,1 on 3d6 rolls.
Also no invalid message after edit.
User avatar
hanelyp
Registered User
Posts: 124
Joined: Wed Apr 02, 2014 10:20 pm

Re: [dev]hanelyp/fancydice

Post by hanelyp »

I'm hard pressed to explain the malfunction, but it looks like the rand() function in fancydice.php is having a problem. This is a long shot, but find the code

Code: Select all

		if ($max <= $min)
		{
			return $min;
		}
line 143 in fancydice.php and comment it out. My best guess is that the RTL text on your board is somehow messing it up. If that proves the case I'll write up a more general fix.
koraldon
Registered User
Posts: 530
Joined: Sat Jun 30, 2007 12:42 pm

Re: [dev]hanelyp/fancydice

Post by koraldon »

Performed the change, didn't solve the issue.
As I said, it is working in 0.7, but not in 0.8.
User avatar
hanelyp
Registered User
Posts: 124
Joined: Wed Apr 02, 2014 10:20 pm

Re: [dev]hanelyp/fancydice

Post by hanelyp »

A minor change in github. It doesn't make any difference on my test board, but fits my best longshot guess of the bug.
koraldon
Registered User
Posts: 530
Joined: Sat Jun 30, 2007 12:42 pm

Re: [dev]hanelyp/fancydice

Post by koraldon »

No Help.
Also tried to re-upload new files from github.

The only thing that works, is going back to 0.7.
User avatar
hanelyp
Registered User
Posts: 124
Joined: Wed Apr 02, 2014 10:20 pm

Re: [dev]hanelyp/fancydice

Post by hanelyp »

Still looking at longshots...
if you uncomment the line

Code: Select all

//return $list[rand(0,count($list)-1)];
in function selection() in fancydice.php what is the result? Be aware that this is expected to break reproducibility of rolls.

By the way, what php and phpbb versions are you running?
koraldon
Registered User
Posts: 530
Joined: Sat Jun 30, 2007 12:42 pm

Re: [dev]hanelyp/fancydice

Post by koraldon »

Yep, that did the trick
Also corrected all previous rolls
using phpbb 3.1.3 and php 5.4.something
User avatar
hanelyp
Registered User
Posts: 124
Joined: Wed Apr 02, 2014 10:20 pm

Re: [dev]hanelyp/fancydice

Post by hanelyp »

That was intended as a diagnostic, not a fix.

The current suspect is the code immediately following

Code: Select all

if (count($list) == 1)
		{
			return $list[0];
		}
I'm baffled how it might malfunction, but that block executing every time would produce the reported bug.
I've pushed a change with that block disabled. Please give it a try.
koraldon
Registered User
Posts: 530
Joined: Sat Jun 30, 2007 12:42 pm

Re: [dev]hanelyp/fancydice

Post by koraldon »

Back to all 1,1,1 with that block disable, so that is not the cause.
User avatar
hanelyp
Registered User
Posts: 124
Joined: Wed Apr 02, 2014 10:20 pm

Re: [dev]hanelyp/fancydice

Post by hanelyp »

I've installed phpbb3.1.3, installed this extension from code in github, and I'm still unable to reproduce the "all 1s" bug. I'm running PHP 5.5.23 on gentoo linux, not the php 5.4 on whatever system is experiencing the bug, but those seem unlikely to be the problem.

Still chasing longshots, what is the output of

Code: Select all

SELECT * FROM `phpbb_config` WHERE `config_name` LIKE 'fancyDice%' 
from your database?

I get

Code: Select all

+------------------+----------------------------------------------------------------+------------+
| config_name      | config_value                                                   | is_dynamic |
+------------------+----------------------------------------------------------------+------------+
| fancyDiceMacro_1 | {"d":"@[1_>]"}                                                 |          0 |
| fancyDicePresent | <div class="dicebox">{SPEC} => {DICE} => {TOTAL} {VALID}</div> |          0 |
| fancyDiceSecure  | xxxxxxxxx                                                      |          0 |
+------------------+----------------------------------------------------------------+------------+
(value of fancyDiceSecure obscured)

Not a complete waste, it exposed a bug in the extension install data that was otherwise not being exercised.
koraldon
Registered User
Posts: 530
Joined: Sat Jun 30, 2007 12:42 pm

Re: [dev]hanelyp/fancydice

Post by koraldon »

This is my values:
phpbb3_config` (`config_name`, `config_value`, `is_dynamic`) VALUES
('fancyDiceMacro_1', '{"d":"@[1_>]"}', 0),
('fancyDiceMacro_2', '{"p":"@[\\"*\\", \\"**\\", \\"***\\", \\"****\\", \\"*****\\",\\"******\\"]"}', 0),
('fancyDicePresent', '<div class="dicebox">קוביות: {SPEC}<Br>תוצאות הגלגול: {DICE}. סך-הכל: {TOTAL} {VALID}</div>', 1),
('fancyDiceSecure', '648067114', 0);
This is my migrations table

Code: Select all

\hanelyp\fancydice\migrations\acp 

a:0:{} 
This is my bbcode table

Code: Select all

INSERT INTO `phpbb3_bbcodes` (`bbcode_id`, `bbcode_tag`, `bbcode_helpline`, `display_on_posting`, `bbcode_match`, `bbcode_tpl`, `first_pass_match`, `first_pass_replace`, `second_pass_match`, `second_pass_replace`) VALUES
(17, 'dice', '[dice]3d6+1[/dice]', 1, '#[dice\\s+seed={number}\\s+secure={simpletext}]{text}[/dice]#ie', '<blockquote>hanelyp\\fancydice\\event\\main_listener::singlet()->replace_dice("{text}",{number},"{simpletext}")</blockquote>', '#\\[dice\\](.+)\\[/dice\\]#ie', 'hanelyp\\fancydice\\event\\main_listener::singlet()->bb_prep_dice("$1","$uid")', '#\\[dice\\s+seed=(\\d+)\\s+secure=(\\w+):?\\w*\\](.+)\\[/dice\\]#ie', 'hanelyp\\fancydice\\event\\main_listener::singlet()->bb_replace_dice("$3",$1,"$2")');
From phpbb_ext

Code: Select all

INSERT INTO `phpbb3_ext` (`ext_name`, `ext_active`, `ext_state`) VALUES
('hanelyp/fancydice', 1, 'b:0;');
I didn't see any table related to fancydice, should there be one?

EDIT: I have deleted the fancydicepresent field from phpbb_config and submitted it again from the ACP -no change.
Last edited by koraldon on Mon Apr 27, 2015 5:43 pm, edited 1 time in total.
koraldon
Registered User
Posts: 530
Joined: Sat Jun 30, 2007 12:42 pm

Re: [dev]hanelyp/fancydice

Post by koraldon »

ignore

Return to “Abandoned Extensions”