Advertisement:

Author Topic: Dice Roller  (Read 77677 times)

Offline oridyne

  • Semi-Newbie
  • *
  • Posts: 54
  • Gender: Male
    • @@BBBBForum on Twitter
    • Big Bang Burger Bar
Re: Dice Roller
« Reply #20 on: August 16, 2009, 01:31:52 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

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,980
    • StoryBB/StoryBB on GitHub
Re: Dice Roller
« Reply #21 on: August 16, 2009, 01:52:48 PM »
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.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline oridyne

  • Semi-Newbie
  • *
  • Posts: 54
  • Gender: Male
    • @@BBBBForum on Twitter
    • Big Bang Burger Bar
Re: Dice Roller
« Reply #22 on: August 17, 2009, 02:19:07 PM »
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

Offline danielwmoore

  • Jr. Member
  • **
  • Posts: 110
  • Gender: Male
Re: Dice Roller
« Reply #23 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.


Offline oridyne

  • Semi-Newbie
  • *
  • Posts: 54
  • Gender: Male
    • @@BBBBForum on Twitter
    • Big Bang Burger Bar
Re: Dice Roller
« Reply #24 on: September 01, 2009, 01:50:53 PM »
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

Offline danielwmoore

  • Jr. Member
  • **
  • Posts: 110
  • Gender: Male
Re: Dice Roller
« Reply #25 on: September 01, 2009, 01:58:11 PM »
Thanks!  That's very helpful.  Not a perfect solution, but definitely workable.

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,980
    • StoryBB/StoryBB on GitHub
Re: Dice Roller
« Reply #26 on: September 01, 2009, 03:48:23 PM »
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 :(
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline danielwmoore

  • Jr. Member
  • **
  • Posts: 110
  • Gender: Male
Re: Dice Roller
« Reply #27 on: September 01, 2009, 06:11:49 PM »
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. 

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,980
    • StoryBB/StoryBB on GitHub
Re: Dice Roller
« Reply #28 on: September 01, 2009, 06:20:05 PM »
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.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline selmiak

  • Semi-Newbie
  • *
  • Posts: 81
Re: Dice Roller
« Reply #29 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...
« Last Edit: September 04, 2009, 04:51:27 PM by selmiak »

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,980
    • StoryBB/StoryBB on GitHub
Re: Dice Roller
« Reply #30 on: September 04, 2009, 05:39:58 PM »
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.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Kyrna

  • Jr. Member
  • **
  • Posts: 104
  • Gender: Female
Re: Dice Roller
« Reply #31 on: September 08, 2009, 06:04:21 PM »
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!

Offline lhz

  • Newbie
  • *
  • Posts: 8
Re: Dice Roller
« Reply #32 on: September 16, 2009, 06:13:07 PM »
There is a way to limit the number of dices and sides, to prevent abuse?

Thanks.

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,980
    • StoryBB/StoryBB on GitHub
Re: Dice Roller
« Reply #33 on: September 16, 2009, 06:14:09 PM »
No, that's on my to-do list.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline lhz

  • Newbie
  • *
  • Posts: 8
Re: Dice Roller
« Reply #34 on: September 16, 2009, 08:36:50 PM »
Ok, I'll wait then.

Thanks for the fast answer :D

Offline david090366

  • Semi-Newbie
  • *
  • Posts: 40
  • Gender: Male
Re: Dice Roller
« Reply #35 on: September 19, 2009, 03:28:48 AM »
@ 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.

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,980
    • StoryBB/StoryBB on GitHub
Re: Dice Roller
« Reply #36 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.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Kyrna

  • Jr. Member
  • **
  • Posts: 104
  • Gender: Female
Re: Dice Roller
« Reply #37 on: September 19, 2009, 12:10:13 PM »
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.

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,980
    • StoryBB/StoryBB on GitHub
Re: Dice Roller
« Reply #38 on: September 19, 2009, 12:12:01 PM »
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.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,980
    • StoryBB/StoryBB on GitHub
Re: Dice Roller
« Reply #39 on: September 24, 2009, 07:56:43 AM »
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 :)
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.