[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 »

Deleting fancyDicePresent from config should break output. I'm not seeing anything that could explain the reported bug. But some freaky factor is causing code to behave differently between out systems.
User avatar
hanelyp
Registered User
Posts: 124
Joined: Wed Apr 02, 2014 10:20 pm

Re: [dev]hanelyp/fancydice

Post by hanelyp »

Since the problem appears to operate inside the dice processor routine, I've added a test driver for that library to github, testfancydice.php. It's designed to run on the command line and exercise basic operations of rolling the dice without the complications of phpbb or any other application that might use the dice.
shurijo
Registered User
Posts: 35
Joined: Sun Mar 15, 2015 8:37 pm

Re: [dev]hanelyp/fancydice

Post by shurijo »

Will you support different dice sets other than normal die? Like L5R, Star Wars (FFG), The One Ring, etc.

I can help you with the details and rules. Basically, some die have symbols or things that mod the results, it's not just numbers that are added up.
User avatar
hanelyp
Registered User
Posts: 124
Joined: Wed Apr 02, 2014 10:20 pm

Re: [dev]hanelyp/fancydice

Post by hanelyp »

the macros from my test script:
'd' => '@[1_>]',
'p' => '@["*", "**", "***", "****", "*****","******"]',

'ef' => '@["⚫","⚫","⚫","⚫","⚫","⚫","⚫⚫","O","O","O","OO","OO"]',
'ea' => '@[".","ⵜ","ⵜ","ⵜⵜ","⚚","⚚","ⵜ⚚","⚚⚚"]',
'ep' => '@[".","ⵜ","ⵜ","ⵜⵜ","ⵜⵜ","ⵜ⚚","ⵜ⚚","ⵜ⚚","⚚","⚚⚚","⚚⚚","ⴲ"]',
'eb' => '@[".",".","ⵜ","⚚","⚚⚚","ⵜ⚚"]',
'ed' => '@[".","☠","☠","☠","☠☠","☠/","/","⁄⁄"]',
'ec' => '@[".","/","/","//","//","☠/","☠/","☠","☠","☠☠","☠☠","ⵁ"]',
'es' => '@[".",".","☠","☠","/","/"]',

// negative binomial 50%
'nbb' => '[0,1]?(1,nb)',
'nb' => '[0,(1,nbb)]',

'coin' => '[0,1]',

The code can handle custom dice, and some moderately fancy stuff. Conversion of text symbols into images is also possible.
Shepskii
Registered User
Posts: 27
Joined: Mon Feb 23, 2015 10:51 pm

Re: [dev]hanelyp/fancydice

Post by Shepskii »

This looks like an excellent extension, one that I am very keen to see working so I've been trying to install it on my test forum but have run into some trouble.

The extension is installed and the ACP options are all visible but the [dice][/dice] bbcode doesn't appear to work in posts, it just displays as plain text. I was assuming the bbcode is part of the extension but I may be wrong - do I need to manually specify the new [dice] bbcode? Or perhaps I have overlooked something stupid/obvious.

Assuming I can get the basics down, some questions on the more fancy stuff...
hanelyp wrote: 'ef' => '@["⚫","⚫","⚫","⚫","⚫","⚫","⚫⚫","O","O","O","OO","OO"]',
'ea' => '@[".","ⵜ","ⵜ","ⵜⵜ","⚚","⚚","ⵜ⚚","⚚⚚"]',
'ep' => '@[".","ⵜ","ⵜ","ⵜⵜ","ⵜⵜ","ⵜ⚚","ⵜ⚚","ⵜ⚚","⚚","⚚⚚","⚚⚚","ⴲ"]',
'eb' => '@[".",".","ⵜ","⚚","⚚⚚","ⵜ⚚"]',
'ed' => '@[".","☠","☠","☠","☠☠","☠/","/","⁄⁄"]',
'ec' => '@[".","/","/","//","//","☠/","☠/","☠","☠","☠☠","☠☠","ⵁ"]',
'es' => '@[".",".","☠","☠","/","/"]',
I presume I would simply enter each one of these into a new line in the ACP section for dice definitions?
hanelyp wrote:The code can handle custom dice, and some moderately fancy stuff. Conversion of text symbols into images is also possible.
Likewise, for images, would I add these to the same definitions section (using your similies as an example):

Code: Select all

'sm' => 'smilie [smtag]'
'smilie' => '"<img src="./images/smilies/icon_>.gif">"'
'smtag' =>	'["e_biggrin","e_sad","evil","lol","cool","e_smile","e_wink","mad","e_geek","mrgreen"]'
Or should this be added to fancydice.php directly?
User avatar
hanelyp
Registered User
Posts: 124
Joined: Wed Apr 02, 2014 10:20 pm

Re: [dev]hanelyp/fancydice

Post by hanelyp »

Shepskii wrote:This looks like an excellent extension, one that I am very keen to see working so I've been trying to install it on my test forum but have run into some trouble.

The extension is installed and the ACP options are all visible but the [dice][/dice] bbcode doesn't appear to work in posts, it just displays as plain text. I was assuming the bbcode is part of the extension but I may be wrong - do I need to manually specify the new [dice] bbcode? Or perhaps I have overlooked something stupid/obvious.
Unless you define something fancy in the dice defs (see smiley dice below) this extension displays text output. The smiley dice below show a way to do that using phpbb included images. The [dice] bbcode should have a button in the post editor.
Assuming I can get the basics down, some questions on the more fancy stuff...
hanelyp wrote: 'ef' => '@["⚫","⚫","⚫","⚫","⚫","⚫","⚫⚫","O","O","O","OO","OO"]',
'ea' => '@[".","ⵜ","ⵜ","ⵜⵜ","⚚","⚚","ⵜ⚚","⚚⚚"]',
'ep' => '@[".","ⵜ","ⵜ","ⵜⵜ","ⵜⵜ","ⵜ⚚","ⵜ⚚","ⵜ⚚","⚚","⚚⚚","⚚⚚","ⴲ"]',
'eb' => '@[".",".","ⵜ","⚚","⚚⚚","ⵜ⚚"]',
'ed' => '@[".","☠","☠","☠","☠☠","☠/","/","⁄⁄"]',
'ec' => '@[".","/","/","//","//","☠/","☠/","☠","☠","☠☠","☠☠","ⵁ"]',
'es' => '@[".",".","☠","☠","/","/"]',
I presume I would simply enter each one of these into a new line in the ACP section for dice definitions?
Enter those in the ACP. ACP definitions override defaults in fancydice.php, which was written for more general use.
hanelyp wrote:The code can handle custom dice, and some moderately fancy stuff. Conversion of text symbols into images is also possible.
Likewise, for images, would I add these to the same definitions section (using your similies as an example):

Code: Select all

'sm' => 'smilie [smtag]'
'smilie' => '"<img src="./images/smilies/icon_>.gif">"'
'smtag' =>	'["e_biggrin","e_sad","evil","lol","cool","e_smile","e_wink","mad","e_geek","mrgreen"]'
Or should this be added to fancydice.php directly?
Again, add that to the ACP if you want to use the sm dice. The same syntax can support your own images for other dice.
Shepskii
Registered User
Posts: 27
Joined: Mon Feb 23, 2015 10:51 pm

Re: [dev]hanelyp/fancydice

Post by Shepskii »

Thanks for the reply on the custom definitions - that clarifies things nicely :)
hanelyp wrote:Unless you define something fancy in the dice defs (see smiley dice below) this extension displays text output. The smiley dice below show a way to do that using phpbb included images. The [dice] bbcode should have a button in the post editor.
I should have clarified sorry, when I said plain text I meant that the post displayed:
[dice]2d20[/dice]
Instead of the formatted text as per the sample images.

And the bbcode is not appearing in the post editor so it would appear I have not installed things correctly or there is some other problem.

I have the Advanced BBcode extension installed - could this be conflicting? I've disabled it for now but the [dice] bbcode is still not showing in the post editor.

I've also noticed that when I try a fresh install (disable, delete data, delete files via FTP, reinstall etc.), the custom definitions reappear in the ACP on the newly installed extension whereas I would have expected to have to re-enter them.
User avatar
hanelyp
Registered User
Posts: 124
Joined: Wed Apr 02, 2014 10:20 pm

Re: [dev]hanelyp/fancydice

Post by hanelyp »

Shepskii wrote:I should have clarified sorry, when I said plain text I meant that the post displayed:
[dice]2d20[/dice]
Instead of the formatted text as per the sample images.

And the bbcode is not appearing in the post editor so it would appear I have not installed things correctly or there is some other problem.
Something is definitely not working right with that install. If you go into the bbcode ACP and make sure that [dice] is defined, then use the "Reset [dice] BBcode definition" option on the fancydice ACP that should clear up the problem if the bbcode record didn't get created.
I have the Advanced BBcode extension installed - could this be conflicting? I've disabled it for now but the [dice] bbcode is still not showing in the post editor.
Could be, I don't know that extension. Try again after validating the bbcode record. Note that this extension does processing at edit time that isn't happening.
I've also noticed that when I try a fresh install (disable, delete data, delete files via FTP, reinstall etc.), the custom definitions reappear in the ACP on the newly installed extension whereas I would have expected to have to re-enter them.
There is no code to remove dice definitions with extension uninstall.
Shepskii
Registered User
Posts: 27
Joined: Mon Feb 23, 2015 10:51 pm

Re: [dev]hanelyp/fancydice

Post by Shepskii »

hanelyp wrote:
Shepskii wrote:I should have clarified sorry, when I said plain text I meant that the post displayed:
[dice]2d20[/dice]
Instead of the formatted text as per the sample images.

And the bbcode is not appearing in the post editor so it would appear I have not installed things correctly or there is some other problem.
Something is definitely not working right with that install. If you go into the bbcode ACP and make sure that [dice] is defined, then use the "Reset [dice] BBcode definition" option on the fancydice ACP that should clear up the problem if the bbcode record didn't get created.
I have the Advanced BBcode extension installed - could this be conflicting? I've disabled it for now but the [dice] bbcode is still not showing in the post editor.
Could be, I don't know that extension. Try again after validating the bbcode record. Note that this extension does processing at edit time that isn't happening.
I've also noticed that when I try a fresh install (disable, delete data, delete files via FTP, reinstall etc.), the custom definitions reappear in the ACP on the newly installed extension whereas I would have expected to have to re-enter them.
There is no code to remove dice definitions with extension uninstall.
Aha! I recreated the [dice] bbcode and reset the definition as you suggested and all looks to be working now. I'll look at updating the custom definitions to use images for the Star Wars dice next and I look forward to future developments! Thanks again :)
User avatar
hanelyp
Registered User
Posts: 124
Joined: Wed Apr 02, 2014 10:20 pm

Re: [dev]hanelyp/fancydice

Post by hanelyp »

Looks like I'll need to pay some attention to the install to figure why the bbcode wasn't created. So far I'm unable to reproduce that problem. What php and phpbb versions are you running?
Shepskii
Registered User
Posts: 27
Joined: Mon Feb 23, 2015 10:51 pm

Re: [dev]hanelyp/fancydice

Post by Shepskii »

phpbb is v3.1.3
php is 5.4.35

I'm trying to recall the exact sequence of events as I went through the install and it's entirely possible I inadvertently broke it myself as I have experimented with other scripts and a [dice] bbcode so it may be that something I had done previously caused the problem.

Rather than you spend loads of time digging into it, I would suggest the most likely answer is operator error :)
Shepskii
Registered User
Posts: 27
Joined: Mon Feb 23, 2015 10:51 pm

Re: [dev]hanelyp/fancydice

Post by Shepskii »

You're probably not going to want to hear this but I'm experiencing the same issue as koraldon with all roll results coming back as '1'.
User avatar
hanelyp
Registered User
Posts: 124
Joined: Wed Apr 02, 2014 10:20 pm

Re: [dev]hanelyp/fancydice

Post by hanelyp »

I'm still unable to reproduce the all 1s bug.

As a test, paste

Code: Select all

[dice seed=361108916317 secure=7ac094e7]3d6[/dice]
into a post. It should produce
3d6 => 3, 1, 3 => 7 invalid
If you can run testfancydice.php from the command line and note if the bug is still present that may also be useful.

I've tested the code generating dice rolls with php 5.3 and 5.5. It would be most perverse if 5.4 breaks my code.
Shepskii
Registered User
Posts: 27
Joined: Mon Feb 23, 2015 10:51 pm

Re: [dev]hanelyp/fancydice

Post by Shepskii »

Pasting

Code: Select all

[dice seed=361108916317 secure=7ac094e7]3d6[/dice]
Resulted in:

3d6 => 1, 1, 1 => 3 invalid

Image

I'll have a go with the testing function when I get out of the office today and let you know what the results are.
koraldon
Registered User
Posts: 530
Joined: Sat Jun 30, 2007 12:42 pm

Re: [dev]hanelyp/fancydice

Post by koraldon »

Well, at least the all 1's is not a unique bug, and It didn't come as a result from installing all previous versions - as in my case that I started from 0.1. I understand that shurijo started with 0.8.

Anyway, maybe also the enviroment has an effect?
I'm using:
Language - hebrew
Style - PBtech (prosilver based)
Extensions: Quickedit, Board Rules, Board announcements, Sharethis, Advanced Polls, Quick Login, Google analytics, ELONW.

p.s. about the dice bbcode, I had to do the same "trick" when Installed - there is an issue there.

Return to “Abandoned Extensions”