• Welcome to Simple Machines Community Forum. Please login or sign up.
November 30, 2021, 07:32:57 PM

News:

SMF 2.1 RC4 has been released! Try it out and help us test! :) Read more.


Dice Roller

Started by Colin, July 30, 2009, 09:52:06 PM

Previous topic - Next topic

oridyne

Quote from: Arantor on August 09, 2009, 08:46:38 PM
Good to hear :) Seriously though if you do come up with things you'd like to see I'll see what I can do about adding them here.

Really excellent mod thankyou.

Does the mod support rolling 4 dice and dropping the lowest value dice? If not is that possible to include? only this would be really useful for me..

Thanks again..
<*> I'm dangerous when I know what I'm doing <*>

Big Bang Burger Bar

Arantor

You can roll 4 dice with 4d6 for example, but dropping lowest is not yet supported. It is however on my todo list. No guarantee as to if/when that will materialise.
No good deed goes unpunished
All helpful urges should be circumvented

oridyne

Thanks for the reply.

I will await a possible future update then..

<*> I'm dangerous when I know what I'm doing <*>

Big Bang Burger Bar

danielwmoore

I am using 2.0 RC1.2, and am experiencing problems with this mod.


It also does not pay any attention to the [ nobbc ] tag.  When I need to include an instruction page, it is impossible to make a post on giving instructions.  Even with the nobbc tag it still rolls the dice, and places blockquote tags, but does not blockquote the entry due to the nobbc tags.

Could you make this behave better with the nobbc tag?  It's the first BB Code I've encountered that does not behave with the nobbc tag.


oridyne

Quote from: danielwmoore on September 01, 2009, 11:51:09 AM
I am using 2.0 RC1.2, and am experiencing problems with this mod.

It also does not pay any attention to the [ nobbc ] tag.  When I need to include an instruction page, it is impossible to make a post on giving instructions.  Even with the nobbc tag it still rolls the dice, and places blockquote tags, but does not blockquote the entry due to the nobbc tags.

Could you make this behave better with the nobbc tag?  It's the first BB Code I've encountered that does not behave with the nobbc tag.

I've found that:

[ nobbc ][roll]2d6x3[/roll] - roll 2d6 3 times and display the results overall[ /nobbc ]

will work whereas:

[ nobbc ]
[roll]2d6x3[/roll] - roll 2d6 3 times and display the results overall
[ /nobbc ]

will fail as you describe.
<*> I'm dangerous when I know what I'm doing <*>

Big Bang Burger Bar

danielwmoore

Thanks!  That's very helpful.  Not a perfect solution, but definitely workable.

Arantor

It has to bypass the nobbc tag for a specific reason, unfortunately.

Normally a BBcode is stored as-is in the database, and converted to HTML at display. Which is fine - but for this that would mean re-rolling the dice every page view, which doesn't help matters.

Instead what I had to do was modify the tag in-situ and turn it into blockquote etc, so it can be stored in the database and never changed, which means it doesn't normally properly respect nobbc, because by the time nobbc is handled, the tag has already been deleted and replaced with [blockquote].

The solution posted above will work, and I need to update the mod's page anyway so I can add this useful tip in (thank you!). Unfortunately there isn't really a much better way of doing it :(
No good deed goes unpunished
All helpful urges should be circumvented

danielwmoore

Totally understandable when you explain it that way. 

This won't be a problem.  I just use my programmer's text editor to highlight a line and insert the nobbc tags for me.  Much easier that way.  Instructions are done.

Perhaps a sample instruction page already marked up with BB Code could be helpful, included as a text file in the archive?  That way it's a simple copy, minor edit, and paste for admins.  Not necessary for me though, as I already have it.  Just a thought.

Thanks for this great mod. 

Arantor

Well, I already have two I can use as a template: http://www.simplemachines.org/community/index.php?topic=327831.0 and http://custom.simplemachines.org/mods/index.php?mod=2032 both have a full guide to the code available.

I can make an edit to the above pages though to cover posting the topic into your forum, with nobbc attached into it.
No good deed goes unpunished
All helpful urges should be circumvented

selmiak

September 04, 2009, 04:46:31 PM #29 Last Edit: September 04, 2009, 04:51:27 PM by selmiak
@ danielwmoore:
I had no problems when using e.g.

[[img][/img]roll] [/img]roll]

as the empty image tags will disappear and just leave the roll tags standing there ;)


@Arantor:
My 1337haX0r uzerz managed to just write

[blockquote]Rolled 1d6 : 6, total 6[/blockquote]

:( ...is there any way to avoid this simple cheat.
maybe write CHEATING ATTEMPT when [blockquote] is used without the [roll] tag...

other than that... cool mod! :D

btw, I can translate the few words into german if you like this...

Arantor

I need to revisit this code again in the not too distant future, actually.

It needs miscellaneous tidy-ups with respect to stupidity protection (as I learned the hard way a week or so ago)

I could prevent the user writing [blockquote] manually, sure enough. As a byproduct it'd also break if they tried to edit the post.

That said, I am debating rehashing it all once I get my current project done (which is a huge paid mod) so that all rolls are DB stored and cannot be edited by any means. Though that raises the game in terms of complexity, and would likely be a fair performance hit.

I did actually look at doing some stuff while building this one, around encrypting/decrypting the rolls but never got anything particularly satisfactory that wasn't trivial to emulate manually.
No good deed goes unpunished
All helpful urges should be circumvented

Kyrna

This is the first mod I've installed that went in perfectly with no hitches at all. I'll definitely be keeping an eye out for updates - thanks so much for creating this mod!

lhz

There is a way to limit the number of dices and sides, to prevent abuse?

Thanks.

Arantor

No, that's on my to-do list.
No good deed goes unpunished
All helpful urges should be circumvented

lhz

Ok, I'll wait then.

Thanks for the fast answer :D

david090366

Quote from: selmiak on September 04, 2009, 04:46:31 PM
@ danielwmoore:
I had no problems when using e.g.

[[img][/img]roll] [/img]roll]

as the empty image tags will disappear and just leave the roll tags standing there ;)


@Arantor:
My 1337haX0r uzerz managed to just write

[blockquote]Rolled 1d6 : 6, total 6[/blockquote]

:( ...is there any way to avoid this simple cheat.
maybe write CHEATING ATTEMPT when [blockquote] is used without the [roll] tag...

other than that... cool mod! :D

btw, I can translate the few words into german if you like this...

I use another dice mod on my forum that posts an image of a little purple d6 with the post. This serves to let me know if someone has just typed in the dice roll or if they actually used the die roller. Also, if they edit the post once the post is saved it will show the html code for the image.

Arantor

Interesting idea, unfortunately ultimately defeatable - using a d6 image is not infallible, you can use img tags to replicate it. Plus this handles plenty more than just d6 (including but far from limited to d4, d8, d10, d12, d20)

I have an idea on defeating edited posts for the next version.
No good deed goes unpunished
All helpful urges should be circumvented

Kyrna

Quote from: Arantor on September 19, 2009, 04:37:05 AM
Interesting idea, unfortunately ultimately defeatable - using a d6 image is not infallible, you can use img tags to replicate it. Plus this handles plenty more than just d6 (including but far from limited to d4, d8, d10, d12, d20)

I have an idea on defeating edited posts for the next version.
Any idea when the next version will be? My users are playing D&D in one part of my forum and while at the moment, they think it isn't possible to cheat, if someone figures out that it is, even if they themselves don't cheat, they might start to suspect anyone else's good roll was a cheat.

Arantor

Unfortunately "when it's done". I have a lot of things going on and I haven't had time to sit and actually code the changes I have in mind. But what I do have will defeat anyone editing or posting the post - because it just won't look right.
No good deed goes unpunished
All helpful urges should be circumvented

Arantor

Right, two new updates today.

1. Limits on the numbers and types of dice, just to curtail possible abuse.

2. As stated, rendering is pushed through the [blockquote] tag, but if you try and use that tag outside of dice rolls - it gives you a warning :)
No good deed goes unpunished
All helpful urges should be circumvented

Advertisement: