[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: [BETA] hanelyp fancy dice

Post by hanelyp » Thu Jul 02, 2015 3:32 pm

4+d6 yields 4d6
That is expected behavior with the way the dice parser works. "d" is not a primitive operator but a macro that takes the previous and following values, previous value becoming 1 if not defined. "+" is a token delimiter, not a token in itself. I suppose the parser could be modified so "+" drains off the stack of operating values, forcing 4+d6 to evaluate as 4+1d6.

shurijo
Registered User
Posts: 33
Joined: Sun Mar 15, 2015 8:37 pm

Re: [BETA] hanelyp fancy dice

Post by shurijo » Mon Jul 06, 2015 1:19 am

How could I add something like 3d6k2, where "k" means keep 2 highest of the 3 rolled dice?

Also, is it possible to add a checkbox (boolean/bit field) the to definition table for whether or not to total the results? For more complicated dice systems (like FFG's Star Wars), it would be nice to just show the results and not duplicate the results as the totals (since it's not totalling the dice).

Or maybe if the {results} == {total}, then don't show total, so 1d6=> 4 => 4 would just be 1d6 => 4.
Last edited by shurijo on Mon Jul 06, 2015 2:42 pm, edited 1 time in total.

shurijo
Registered User
Posts: 33
Joined: Sun Mar 15, 2015 8:37 pm

Re: [BETA] hanelyp fancy dice

Post by shurijo » Mon Jul 06, 2015 1:04 pm

Error -> I'm trying to add some CSS around the dice results, so I changed the presentation to

Code: Select all

<div class="dicebox"><span class="dice-spec">{SPEC}</span> <span class="dice-divider">=></span> <span class="dice-result">{DICE}</span> <span class="dice-divider">=></span> <span class="dice-total">{TOTAL}</span> <span class="dice-valid">{VALID}</span></div>
However, that string is too big for the config field and throws a SQL error message about the value being too long for the field. Can you do some client side string length validation to make sure the SQL database error doesn't appear and increase that field size so we can add a longer presentation string to the results?

Thanks!

shurijo
Registered User
Posts: 33
Joined: Sun Mar 15, 2015 8:37 pm

Re: [BETA] hanelyp fancy dice

Post by shurijo » Mon Jul 06, 2015 3:22 pm

If anyone needs the definitions for "The One Ring" RPG dice, let me know. I modified Shepskii's FFG's Star Wars RPG dice to work for that system as well.

koraldon
Registered User
Posts: 511
Joined: Sat Jun 30, 2007 12:42 pm

Re: [BETA] hanelyp fancy dice

Post by koraldon » Mon Jul 06, 2015 3:34 pm

That will be very cool :)

User avatar
hanelyp
Registered User
Posts: 124
Joined: Wed Apr 02, 2014 10:20 pm

Re: [BETA] hanelyp fancy dice

Post by hanelyp » Mon Jul 06, 2015 4:20 pm

shurijo wrote:How could I add something like 3d6k2, where "k" means keep 2 highest of the 3 rolled dice?
Not supported by the current dice engine.
Also, is it possible to add a checkbox (boolean/bit field) the to definition table for whether or not to total the results? For more complicated dice systems (like FFG's Star Wars), it would be nice to just show the results and not duplicate the results as the totals (since it's not totalling the dice).

Or maybe if the {results} == {total}, then don't show total, so 1d6=> 4 => 4 would just be 1d6 => 4.
You may want to replace {total} with {sum} in the ACP to show just the numeric sum.

As for overlength display specs, the current code uses the base config table to store extension configuration. I hadn't considered that you might want different CSS for each element of the output.

shurijo
Registered User
Posts: 33
Joined: Sun Mar 15, 2015 8:37 pm

Re: [BETA] hanelyp fancy dice

Post by shurijo » Mon Jul 06, 2015 4:31 pm

hanelyp wrote:
shurijo wrote:How could I add something like 3d6k2, where "k" means keep 2 highest of the 3 rolled dice?
Not supported by the current dice engine.
Ah. Cool. If I'm able to code that upgrade, can I email you the changes or check it into github?
hanelyp wrote:
shurijo wrote:Also, is it possible to add a checkbox (boolean/bit field) the to definition table for whether or not to total the results? For more complicated dice systems (like FFG's Star Wars), it would be nice to just show the results and not duplicate the results as the totals (since it's not totalling the dice).

Or maybe if the {results} == {total}, then don't show total, so 1d6=> 4 => 4 would just be 1d6 => 4.
You may want to replace {total} with {sum} in the ACP to show just the numeric sum.
The only downside is there's only 1 presentation block. If there were multiple presentation blocks and you could pick which definition is presented with which presentation block, then I could do that. I need to support multiple dice configs like the standard d6/20 stuff along with custom configs.
hanelyp wrote: As for overlength display specs, the current code uses the base config table to store extension configuration. I hadn't considered that you might want different CSS for each element of the output.
Yeah, no problem. Probably won't go this route, but you probably need to do some client side string length validation to prevent the SQL error before you save/insert the value into the config table. :)

User avatar
hanelyp
Registered User
Posts: 124
Joined: Wed Apr 02, 2014 10:20 pm

Re: [BETA] hanelyp fancy dice

Post by hanelyp » Mon Jul 06, 2015 4:44 pm

shurijo wrote:
hanelyp wrote:
shurijo wrote:How could I add something like 3d6k2, where "k" means keep 2 highest of the 3 rolled dice?
Not supported by the current dice engine.
Ah. Cool. If I'm able to code that upgrade, can I email you the changes or check it into github?
I'll want to double check the code before it goes into gethub, but I'll accept a good improvement on the code.
hanelyp wrote:
shurijo wrote:Also, is it possible to add a checkbox (boolean/bit field) the to definition table for whether or not to total the results? For more complicated dice systems (like FFG's Star Wars), it would be nice to just show the results and not duplicate the results as the totals (since it's not totalling the dice).

Or maybe if the {results} == {total}, then don't show total, so 1d6=> 4 => 4 would just be 1d6 => 4.
You may want to replace {total} with {sum} in the ACP to show just the numeric sum.
The only downside is there's only 1 presentation block. If there were multiple presentation blocks and you could pick which definition is presented with which presentation block, then I could do that. I need to support multiple dice configs like the standard d6/20 stuff along with custom configs.
I added the {sum} option as an improvement over {total} in such cases. But I can see how the total is just noise if there is no meaningful numeric total. Not entirely sure how to do a switch between presentation blocks cleanly.
hanelyp wrote: As for overlength display specs, the current code uses the base config table to store extension configuration. I hadn't considered that you might want different CSS for each element of the output.
Yeah, no problem. Probably won't go this route, but you probably need to do some client side string length validation to prevent the SQL error before you save/insert the value into the config table. :)
You're right, some basic validation on the ACP would be good.

poenn
Registered User
Posts: 34
Joined: Thu Oct 30, 2014 8:40 am

Re: [BETA] hanelyp fancy dice

Post by poenn » Sat Jul 11, 2015 12:49 pm

Hi hanelyp,

sorry for bothering you so much. Did you manage to test your extension with the shoutbox extension we were talking about? I would really love to be able to use a simpler syntax since the shoutbox extension does not have BBCode buttons (and will not implement any) thus forcing the users to type the full [dice]1d6[/dice] every single time. :(

User avatar
hanelyp
Registered User
Posts: 124
Joined: Wed Apr 02, 2014 10:20 pm

Re: [BETA] hanelyp fancy dice

Post by hanelyp » Mon Jul 13, 2015 2:32 pm

I wasn't able to get the shoutbox extension to work.

poenn
Registered User
Posts: 34
Joined: Thu Oct 30, 2014 8:40 am

Re: [BETA] hanelyp fancy dice

Post by poenn » Mon Jul 13, 2015 2:40 pm

If you want to just take a look at it, you can go to http://www.ajax-shoutbox.com and login with

user: test
pw: testtest

It seems to me that text in the shoutbox just works (=is parsed) the same as in the forums, because all BBCodes work the same as in a forum post. Even this Extension’s functionality works in the shoutbox, meaning that videos are directly shown there.

So I suppose if you change the dice syntax it will affect both the forum as well as the shoutbox. Still I could create a temporary user account on my board for you if you need that.

By the way: Is it somehow possible to rename the BBCode dice to something else? My german users usually do not know the english word. ;)

Thanks for your patience!
poenn

CGbiv
Registered User
Posts: 3
Joined: Sun Jul 26, 2015 12:23 am

Re: [BETA] hanelyp fancy dice

Post by CGbiv » Sun Jul 26, 2015 12:34 am

Hey there,

I'm trying to get this to work on a test board and I need a little help.

I'm getting this error when I try to post with the dicemod:

Code: Select all

[phpBB Debug] PHP Warning: in file [ROOT]/ext/hanelyp/fancydice/event/main_listener.php on line 135: preg_match_all() expects at least 3 parameters, 2 given
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 2412: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3899)
It appears on a fully white screen with just this in black text on it. However, when you go back to the forum and to the thread you tried to create/respond to, the dicemod actually worked. For whatever reason though, it doesn't seem to want to complete and just takes you to an error page.

Here is the URL to the test forum: http://cherrywoodworks.com/testforum/

I'm not super savvy on php, as a headsup. I did try an entirely fresh up-to-date reinstall of phpbb to see if that would help. I made sure that my ACP copies the image provided for the "d" and "p". I've also tried a bbcode reset. Any help would be super appreciated because this is a mod that could really save my skin in the future. Thanks for any assistance!

User avatar
hanelyp
Registered User
Posts: 124
Joined: Wed Apr 02, 2014 10:20 pm

Re: [BETA] hanelyp fancy dice

Post by hanelyp » Sun Jul 26, 2015 3:57 pm

CGbiv, what version of php is installed on your system? The error message you report is inconsistent with documentation at http://php.net/manual/en/function.preg-match-all.php

CGbiv
Registered User
Posts: 3
Joined: Sun Jul 26, 2015 12:23 am

Re: [BETA] hanelyp fancy dice

Post by CGbiv » Sun Jul 26, 2015 9:41 pm

I'm running 3.1.5, I hope that's alright. I saw a few people on here managed to get it to work with that (although with a few bugs that I haven't experienced). I should have mentioned the version in my post. Sorry about the inconvenience. If I missed anything stating compatibility I apologize. I also want to add that we attempted the fix mentioned in the thread about the corrupted seeds but that also didn't work.

User avatar
hanelyp
Registered User
Posts: 124
Joined: Wed Apr 02, 2014 10:20 pm

Re: [BETA] hanelyp fancy dice

Post by hanelyp » Mon Jul 27, 2015 4:49 pm

3.1.5 would be the phpbb version. I'm running a test board with that version.

Looking a bit deeper, phpbb3.1 requires php 5.3.3 or later, but my code was using an option that wasn't available until php 5.4. Patch in github.

Locked

Return to “Abandoned Extensions”